django-south

Upgrading from Django 1.6 to 1.9: python manage.py migrate failure

不想你离开。 提交于 2019-11-29 14:03:28
I'm running Django 1.6.6 on production and have recently upgraded to 1.9.7 on staging (dev server). This update was performed on the server and I followed the steps outlined here Upgrading from South . I noticed that the structure of the migration files have changed, and they no longer include a create statement. This causes issues because if I pull this new code from my GitHub repo and run python manage.py makemigrations or python manage.py migrate , it says: django.db.utils.OperationalError: no such table: appname_modelname The traceback points to my urls.py because I'm referencing the model

Can stale content types be automatically deleted in Django?

帅比萌擦擦* 提交于 2019-11-29 10:20:32
I'm working with a PyQt application which uses Django to deliver it's content to desktop users. In the latest update we have stale content types stored in the database by Django and on startup of the application South's migrate or syncdb offers to delete them. Is it possible to do something with the call to migrate/syncdb that automatically deletes these? This prompt can't be exposed to the end user for obvious reasons, so I really hope there is some way we can take car of this automatically :) I've seen that with the South migrate you can call --noinput but that doesn't delete them, and it'd

Move Django model from one app to another [duplicate]

半腔热情 提交于 2019-11-29 06:56:25
This question already has an answer here: How do I migrate a model out of one django app and into a new one? 7 answers I made the stupid mistake of creating too many models in the same Django app, now I want to split it into 3 distinct ones. Problem is: there's already data in production in two customers' sites, so I need to carefully plan any schema/data migration to be done (I'm using django-south). I'm unsure on how to proceed, any advice would be greatly appreciated. (I'm using PostgreSQL on a Ubuntu server 12.4 LTS, if that's of any relevance) I thought about using db.rename_table , but

How to call a static methods on a django model class during a south migration

最后都变了- 提交于 2019-11-29 05:37:25
问题 I'm writing a data migration in south to fix some denormalized data I screwed up in earlier code. The way to figure out the right value for the incorrect field is to call a static method on the django model class. The code looks like this: class Account(models.Model): name = models.CharField() @staticmethod def lookup_by_name(name): # There's actually more to it than this return Account.objects.get(name=name) class Record(models.Model): account_name = models.CharField() acct = models

Migrating data from “Many-To-Many” to “Many-To-Many Through” in django

痴心易碎 提交于 2019-11-29 02:20:19
问题 I've got a model class Category(models.Model): title = models.CharField(...) entry = models.ManyToManyField(Entry,null=True,blank=True, related_name='category_entries', ) That I wish to refactor to have additional data with each relationship: class Category(models.Model): title = models.CharField(...) entry = models.ManyToManyField(Entry,null=True,blank=True, related_name='category_entries', through='CategoryEntry', ) But south deletes the existing table. How can I preserve the existing m-t-m

migrating django-model field-name change without losing data

江枫思渺然 提交于 2019-11-28 19:49:10
问题 I have a django project with a database table that already contains data. I'd like to change the field name without losing any of the data in that column. My original plan was to simply change the model field name in a way that would not actually alter the name of the db table (using the db_column column parameter): The original model: class Foo(models.Model): orig_name = models.CharField(max_length=50) The new model: class Foo(models.Model): name = models.CharField(max_length=50, db_column=

Django South error with initial migration

别等时光非礼了梦想. 提交于 2019-11-28 18:54:06
I have a new Django 1.3 project and app that I've created. I added south to my settings.py and have not yet run syncdb . When I execute the following commands per the South tutorial and documentation, I received the error shown below. Any thoughts on what's causing the problem? Update: Not properly installing South (see answer). Is South 0.7.3 compatible with Django 1.3? Update: Yes. Commands Executed and South Error $ python ./manage.py schemamigration qexpenses --initial Creating migrations directory at '/Users/matthew/development/quest-projects/qexpense-tracker/quexptrkr/../quexptrkr

Renaming an app with Django and South

别等时光非礼了梦想. 提交于 2019-11-28 17:01:24
I am renaming an application to a more suitable name. In doing so, I want to ensure that South properly migrates the database (renames database tables and changes references in django_content_type or south_migrationhistory). I know how to migrate a model to a different app , but when I try rename the app itself, South does not recognize the migration history properly. Undesirable solution : In renaming old_app to new_app I could leave old_app/migrations intact and add new migrations to this directory to migrate the database to reference new_app . If possible I would prefer to delete the

Migrating ManyToManyField to null true, blank true, isn't recognized

倖福魔咒の 提交于 2019-11-28 09:04:27
I have made a model change from standard = models.ManyToManyField(Standard) to standard = models.ManyToManyField(Standard, blank=True, null=True) South schemamigration for this app doesn't recognize the change? Similar to this question, which is unanswered: South migrations and changes to many-to-may fields That behavior is correct: null doesn't mean anything at the database level when used with a ManyToManyField . The declaration of a ManyToManyField causes the creation of an intermediate table to hold the relationship, and although Django will create a standard attribute on your model

Error creating new content types. Please make sure contenttypes is migrated before trying to migrate apps individually

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-28 08:02:37
I am trying to migrate from Django 1.6 to Django 1.8 . I was using South for managing migrations in Django 1.6. I have successfully created new migration files by python manage.py makemigrations . while running python manage.py migrate --fake-initial , I am getting this error Traceback (most recent call last): File "manage.py", line 39, in <module> execute_from_command_line(sys.argv) File "/home/jonty/.virtualenvs/squadrun/local/lib/python2.7/site- packages/django/core/management/__init__.py", line 338, in execute_from_command_line utility.execute() File "/home/jonty/.virtualenvs/squadrun