django-south

What value do I use for _ptr when migrating reparented classes with South?

别等时光非礼了梦想. 提交于 2019-12-03 11:34:05
I have two classes, one of which is descended from the other, and I would like to make them both sibling classes descended from the same base class. Before: from django.db import models class A(models.Model): name = models.CharField(max_length=10) class B(models.Model): title = models.CharField(max_length=10) After: from django.db import models class Base(models.Model): name = models.CharField(max_length=10) class A(Base): pass class B(Base): title = models.CharField(max_length=10) When I generate a schema migration, this is the output, including my answers to the questions: + Added model

Django South migration conflict while working in a team

耗尽温柔 提交于 2019-12-03 11:09:42
I have a short question about how to use Django-South while working in a team. What happens if two people simultaneously create migration file on changes to the same file? For example, A and B are working on same Django app. They are working in different branch and both at migration 005. Now, both A and B modifies apple/models.py and created migration file using startmigration. They are both at migration 006 but with completely different migration file 006. I guess when they merge their branches, there might be some error with South. Is there any workaround to resolve this conflict? Or is

Django south migration - Adding FULLTEXT indexes

北战南征 提交于 2019-12-03 09:51:16
I need to add a FULLTEXT index to one of my Django model's fields and understand that there is no built in functionality to do this and that such an index must be added manually in mysql (our back end DB). I want this index to be created in every environment. I understand model changes can be dealt with Django south migrations, but is there a way I could add such a FULLTEXT index as part of a migration? In general, if there is any custom SQL that needs to be run, how can I make it a part of a migration. Thanks. You can write anything as a migration. That's the point! Once you have South up and

Is there a Django 1.7+ replacement for South's add_introspection_rules()?

半腔热情 提交于 2019-12-03 09:35:50
Back in the days of South migrations, if you wanted to create a custom model field that extended a Django field's functionality, you could tell South to use the introspection rules of the parent class like so: from south.modelsinspector import add_introspection_rules add_introspection_rules([], ["^myapp\.stuff\.fields\.SomeNewField"]) Now that migrations have been moved to Django, is there a non-South equivalent of the above? Is an equivalent even needed anymore, or is the new migration stuff smart enough to just figure it out on its own? As Phillip mentions in the comments, deconstruct() is

Django - South - Is There a way to view the SQL it runs?

坚强是说给别人听的谎言 提交于 2019-12-03 07:32:54
问题 Here's what I want to do. Develop a Django project on a development server with a development database. Run the south migrations as necessary when I change the model. Save the SQL from each migration, and apply those to the production server when I'm ready to deploy. Is such a thing possible with South? (I'd also be curious what others do to get your development database changes on production when working with Django) 回答1: You can at least inspect the sql generated by doing manage.py migrate

django loading data from fixture after backward migration / loaddata is using model schema not database schema

北城余情 提交于 2019-12-03 06:59:42
问题 I have recenty came across a problem while importing older data than my current model schema. Flow which I use and lead to error: dumpdata with python manage.py dumpdata -> 0002 make some modifications to model generate migration with python manage.py schemamigration app_name --auto -> 0003 run migration play with database migrate to 0002 loaddata generate SQL in which I have current (migration 0003) fields, and cause failing loaddata process (mpoly is added field) File "/usr/local/lib

How to reset south migrations to capture the current state of my django models

对着背影说爱祢 提交于 2019-12-03 06:20:39
问题 I have an app that currently has 35 south migrations. These take a while to go through when setting up a new deployment (we create new deployments often), and the app is continually evolving--adding more migrations. Additionally, the migrations include some potentially complex data migrations and a few custom migrations that break SQLite3 (not a huge problem right now since everything is on Postgres, but its nice to be able to set up a quick test environment), and generally just more things

Django - Change a ForeignKey relation to OneToOne

◇◆丶佛笑我妖孽 提交于 2019-12-03 05:03:06
I am using South with my Django app. I have two models that I am changing from having a ForeignKey relation to having a OneToOneField relation. When I ran this migration on my dev database, it ran fine. When the migrations get ran as part of creating a test database, the latest migration fails with a MySQL 1005 error: "Can't create table mydb.#sql-3249_1d (errno: 121)". Doing some Googling revealed that this is usually a problem with trying to add a constraint with the same name as an existing constraint. The specific line in the migration that it fails on is: The relation was changed from:

Django South - Create Not Null ForeignKey

我的梦境 提交于 2019-12-03 04:56:24
I have a Model class Mystery(models.Model): first = models.CharField(max_length=256) second = models.CharField(max_length=256) third = models.CharField(max_length=256) player = models.ForeignKey(Player) I added the player ForeignKey but when I try to migrate it using South it seems that I can't create this whith a null=False. I have this message : The field 'Mystery.player' does not have a default specified, yet is NOT NULL. Since you are adding this field, you MUST specify a default value to use for existing rows. Would you like to: 1. Quit now, and add a default to the field in models.py 2.

Upgrading from Django 1.6 (with south) to 1.8 doesn't modify 'last_login' on the user table

ぃ、小莉子 提交于 2019-12-03 04:29:23
I have upgraded from Django 1.6.5 (with south migrations) to Django 1.8. I have followed the instructions here: https://docs.djangoproject.com/en/1.8/topics/migrations/#upgrading-from-south So, I remove South, delete my previous migrations and run python manage.py makemigrations which makes a new migration file. Then I run python manage.py migrate --fake-initial to fake the initial migration. Then I run python manage.py migrate . It all runs fine with no errors. I have a custom user model which inherits AbstractBaseUser . In Django 1.8 it seems there is a change to the last_login field where