south

How do I access auth User's User.objects.create_user(...) in a south migration?

Instead of using django's auth module I've used my own and already regret it a lot. In an effort to rectify the situation, I'm trying to migrate the data from my User model to django.auth.models.User. I've created a data migration as follows: def forwards(self, orm): """Migrate user information from mooi User model to auth User mo...

Changing the encoding of a table with django+south migrations

Hi Guys, Django and south newbie here I need to change the encoding of a table I created, does anyone know a way to do so using a migration? ...

Changing the encoding of a table with django+south migrations using --auto

Hi guys, Django newbie here I know that I can change the encoding of a table by writing my own south migration. My question is, is there a way doing it by changing my model and using ./manage.py schemamigration my_app --auto ? ...

Extending South Introspection in Django

I have a custom app which I wanted to start using South with. It uses a FK for associating a blog entry from another app (proprietary, not written by me). Problem is when I try to run the initial schemamigration I get an error that some of the blog entry app's fields cannot be frozen. The fields that can't be frozen are fields that us...

How to rename a foreignkey field with South ?

Renaming a simple charfield etc seems easy (http://stackoverflow.com/questions/3235995/django-how-to-rename-a-model-field-using-south) However when I try using the same on a ForeignKey field I get an error: _mysql_exceptions.OperationalError: (1091, "Can't DROP '[new_fkey_field_name]'; check that column/key exists") Which stems from...

migrating django-model field-name change without losing data

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...

How can I use South's DataMigration to change the storage backend of Django model ImageField instance?

I'm trying to migrate some models ImageFields to using the S3BotoStorage storage backend from django-storages. As part of this process I've changed my Model's ImageField declaration to include the storage=instance_of_s3botostorage argument, and new instances of my Model that save an image to the ImageField attribute now get stored in S...

Is having everything in Django models sensible?

I've just inherited a Django project for maintenance and continuous development. While I'm a fairly proficient programmer (also Python) I have next to no experience with Django, therefore I need a bit of saneness-checking for my ideas ;) The current problem is this: the project contains a custom install.sh file, which does three things:...

south django migrate

I installed south and I try to use it to migrate now: ./manage.py schemamigration myapp --initial I get a : -bash: ./manage.py: Permission denied and if I sudo I get: sudo: ./manage.py: command not found Response. Whats wrong? Thanks! ...

south django migrate

I just did: python manage.py schemamigration TestDBapp1 --initial python manage.py schemamigration TestDBapp1 --auto Successfully. But if I: python manage.py migrate TestDBapp1 a lot... and I get sqlite3.OperationalError: table "TestDBapp1_xyz" already exists What could be the problem? ...

Django South removes foreign key REFERENCES from SQLite3 schema. Why? Is it a problem?

When using syncdb the following schema is created: CREATE TABLE "MyApp_supervisor" ( "id" integer NOT NULL PRIMARY KEY, "supervisor_id" integer NOT NULL REFERENCES "MyApp_employee" ("id"), "section_id" integer NOT NULL REFERENCES "MyApp_section" ("id") ); When using migrate, it is changed to: CREATE TABLE "MyApp_superviso...

South does not recognize models when it is a package

I use South for schema and data migraton for my Django site. I'm happy about using it. One day I converted models.py file to models/__init__py and put some additional models at models/something.py. When I ran python manage.py schemamigration app --auto, I got the Nothing seems to have changed. message despite of the new classes at someth...

Configuring django south with PostgreSQL

I can't get my site running with south. I've successfully installed south, and I can 'import south' successfully. ./manage.py shell >>> import south >>> However, once I add 'south' to INSTALLED_APPS, and run ./manage.py syncdb (to complete the installation), I get the following error: There is no South database module 'south.db.d...

django.contrib.comments 'not synced' after adding it to installed_apps

Hi, I want to replace a home-made comment object by a proxy of django.contrib.comments.models.Comment. I modified my comments/models.py, added django.contrib.comments to my installed_apps and set COMMENTS_APPS to my comment app's name. When running python manage.py syncdb (I use South), I get 'django.contrib.comments' in the 'not sync...

DROP CASCADE in Sql Server

I'm running a South migration in a Django project that uses Sql Server and pyodbc. This is backwards migration so the South is trying to delete a few of my tables. The South executes the following method in order to drop the tables: def delete_table(self, table_name, cascade=True): """ Deletes the table 'table_name'. """ ...

South's syncdb/migrate creates pages of output?

I'm working a small, personal Django project and I've added South (latest mercurial as of 10/9/10) to my project. However, whenever I run "./manage.py syncdb" or "./manage.py migrate " I get about 13 pages (40 lines each) of output solely regarding 'initial_data' files not being found. I don't have any initial_data nor do I really want ...

Django South migration error "contains null values" with null=True field

When adding a field for easy-thumbnails to a model easy_thumbnail = ThumbnailerImageField( null=True, blank=True, verbose_name=_("Easy_Thumbnails"), upload_to="easy_thumbnails", resize_source=dict(size=(100, 100), crop="smart"), ) When executing ./manage.py schemamigration test --auto, South produces the following migratio...

Adding South to Django project, development & production

Adding South to an existing Django project. I have it installed on both the development machine and the "production" server. I've done the following on the development machine, then: added South app to settings.py, python manage.py syncdb python manage.py convert_to_south myproject.myapp then changed some models, then python manage...

Loading a fixture before a south migration run

Hi, I've made a mistake of creating my own User model and am trying to recover. I've created a south migration that copies my old user models and creates django.contrib.auth.models.User models. To ensure my current users don't get left in the dark, I created a bunch of unittests to ensure everything gets converted appropriately. So, I...

South django.db.utils.IntegrityError: django_content_type.name may not be NULL while running unit tests

I'm getting this error django.db.utils.IntegrityError: django_content_type.name may not be NULL while running tests via nosetest. I've done everything as told in south tutorial - initial migration, fake migration etc. Running site normally via runserver command works like charm, but while using test command - above error. Also, In my d...