Django migrate error - python

I have been reading tango_with_django tutorial, and when I managed to get to part 7, I was stucked.
When I added this code
from django.template.defaultfilters import slugify
class Category(models.Model):
name = models.CharField(max_length=128, unique=True)
views = models.IntegerField(default=0)
likes = models.IntegerField(default=0)
slug = models.SlugField(unique=True)
def save(self, *args, **kwargs):
self.slug = slugify(self.name)
super(Category, self).save(*args, **kwargs)
def __unicode__(self):
return self.name
I've got this
Traceback (most recent call last): File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv) File "C:\Python34\lib\site-packages\django\core\management\__init__.py", line 385, in execute_from_command_line
utility.execute() File "C:\Python34\lib\site-packages\django\core\management\__init__.py", line 377, in execute
self.fetch_command(subcommand).run_from_argv(self.argv) File "C:\Python34\lib\site-packages\django\core\management\base.py", line 288, in run_from_argv
self.execute(*args, **options.__dict__) File "C:\Python34\lib\site-packages\django\core\management\base.py", line 338, in execute
output = self.handle(*args, **options) File "C:\Python34\lib\site-packages\django\core\management\commands\migrate.py ", line 161, in handle
executor.migrate(targets, plan, fake=options.get("fake", False)) File "C:\Python34\lib\site-packages\django\db\migrations\executor.py", line 68 , in migrate
self.apply_migration(migration, fake=fake) File "C:\Python34\lib\site-packages\django\db\migrations\executor.py", line 10 2, in apply_migration
migration.apply(project_state, schema_editor) File "C:\Python34\lib\site-packages\django\db\migrations\migration.py", line 1 08, in apply
operation.database_forwards(self.app_label, schema_editor, project_state, ne w_state) File "C:\Python34\lib\site-packages\django\db\migrations\operations\fields.py" , line 37, in database_forwards
field, File "C:\Python34\lib\site-packages\django\db\backends\sqlite3\schema.py", lin e 176, in add_field
self._remake_table(model, create_fields=[field]) File "C:\Python34\lib\site-packages\django\db\backends\sqlite3\schema.py", lin e 144, in _remake_table
self.quote_name(model._meta.db_table), File "C:\Python34\lib\site-packages\django\db\backends\schema.py", line 102, i n execute
cursor.execute(sql, params) File "C:\Python34\lib\site-packages\django\db\backends\utils.py", line 81, in execute
return super(CursorDebugWrapper, self).execute(sql, params) File "C:\Python34\lib\site-packages\django\db\backends\utils.py", line 65, in execute
return self.cursor.execute(sql, params) File "C:\Python34\lib\site-packages\django\db\utils.py", line 94, in
__exit__
six.reraise(dj_exc_type, dj_exc_value, traceback) File "C:\Python34\lib\site-packages\django\utils\six.py", line 658, in reraise
raise value.with_traceback(tb) File "C:\Python34\lib\site-packages\django\db\backends\utils.py", line 65, in execute
return self.cursor.execute(sql, params) File "C:\Python34\lib\site-packages\django\db\backends\sqlite3\base.py", line 485, in execute
return Database.Cursor.execute(self, query, params) django.db.utils.IntegrityError: UNIQUE constraint failed: rango_category__new.sl ug
After I removed this code, I still get same error message while trying to do
python manage.py migrate
After I deleted database with
python manage.py flush
And entered
python manage.py migrate
I also got the same error.
What's going on?

try rolling back the migration to the previous state. Assuming this is your first migration - lets roll back to zero
python manage.py migrate category zero
slug logic can get a bit complex
despite names being different they can have the same slug
e.g.
Name: Foo Bar
Slug: foo-bar
Name: foo bar
Slug: foo-bar
Name: Foo Bar
Slug: foo-bar
Name: Foo! Bar
Slug: foo-bar
...you get the idea
you defiantly want unique slugs to make url access nice
e.g. domain.com/category/1234 (using id)
vs domain.com/category/foo-bar
have a look at AutoSlugField which will do lots of the hard work for you in terms of making unique slugs

Related

Adding array field OperationalError

I am very new to django(version 1.11).I am trying to make a shoppingwebsite and i am confused in creating Order model.
In here you can see my first (version 1) models.py
from django.db import models
from django.contrib.auth.models import User
from django.db.models.signals import post_save
from django.contrib.postgres.fields import ArrayField
class Products(models.Model):
name = models.CharField(max_length = 20 , default='')
description = models.CharField(max_length = 100 , default='')
price = models.IntegerField(default=0)
image = models.ImageField(upload_to='product_image',blank=True)
vojood = models.BooleanField(default=False)
unique = models.CharField(max_length = 100 ,default='')
typ = models.CharField(max_length = 100 ,default='')
def __str__ (self):
return self.name
#classmethod
def turn_on(prds,pk):
prds[pk].vojood=true
#classmethod
def turn_off(prds,pk):
prds[pk].vojood=false
class Order(models.Model):
username = models.CharField(max_length = 300 , default='')
address = models.CharField(max_length = 300 , default='')
time = models.IntegerField(default=0)
price = models.IntegerField(default=0)
arrived = models.BooleanField(default=False)
basket = ArrayField(models.CharField(max_length=300,default=''),default=list)
def __str__ (self):
return self.username
After python manage.py makemigrations when i tried to migrate the new field (arrayfield) with python manage.py migrate i got a very long error . So the last line was django.db.utils.OperationalError: near "[]": syntax errorSo i deleted the new field(arrayfield) and again i used makemigrations but the error during migrate did not change.And now i cant migrate any field with any type!
And here is my Error :
E:\django projects\4\third>python manage.py makemigrations
Migrations for 'shop':
shop\migrations\0013_auto_20180611_1518.py
- Alter field basket on order
E:\django projects\4\third>python manage.py migrate
Operations to perform:
Apply all migrations: accounts, admin, auth, contenttypes, sessions, shop
Running migrations:
Applying shop.0005_order_prds...Traceback (most recent call last):
File "C:\Python34\lib\site-packages\django\db\backends\utils.py", line 63, in
execute
return self.cursor.execute(sql)
File "C:\Python34\lib\site-packages\django\db\backends\sqlite3\base.py", line
326, in execute
return Database.Cursor.execute(self, query)
sqlite3.OperationalError: near "[]": syntax error
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "manage.py", line 22, in <module>
execute_from_command_line(sys.argv)
File "C:\Python34\lib\site-packages\django\core\management\__init__.py", line
364, in execute_from_command_line
utility.execute()
File "C:\Python34\lib\site-packages\django\core\management\__init__.py", line
356, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:\Python34\lib\site-packages\django\core\management\base.py", line 283,
in run_from_argv
self.execute(*args, **cmd_options)
File "C:\Python34\lib\site-packages\django\core\management\base.py", line 330,
in execute
output = self.handle(*args, **options)
File "C:\Python34\lib\site-packages\django\core\management\commands\migrate.py
", line 204, in handle
fake_initial=fake_initial,
File "C:\Python34\lib\site-packages\django\db\migrations\executor.py", line 11
5, in migrate
state = self._migrate_all_forwards(state, plan, full_plan, fake=fake, fake_i
nitial=fake_initial)
File "C:\Python34\lib\site-packages\django\db\migrations\executor.py", line 14
5, in _migrate_all_forwards
state = self.apply_migration(state, migration, fake=fake, fake_initial=fake_
initial)
File "C:\Python34\lib\site-packages\django\db\migrations\executor.py", line 24
4, in apply_migration
state = migration.apply(state, schema_editor)
File "C:\Python34\lib\site-packages\django\db\migrations\migration.py", line 1
29, in apply
operation.database_forwards(self.app_label, schema_editor, old_state, projec
t_state)
File "C:\Python34\lib\site-packages\django\db\migrations\operations\fields.py"
, line 87, in database_forwards
field,
File "C:\Python34\lib\site-packages\django\db\backends\sqlite3\schema.py", lin
e 238, in add_field
self._remake_table(model, create_field=field)
File "C:\Python34\lib\site-packages\django\db\backends\sqlite3\schema.py", lin
e 198, in _remake_table
self.create_model(temp_model)
File "C:\Python34\lib\site-packages\django\db\backends\base\schema.py", line 3
03, in create_model
self.execute(sql, params or None)
File "C:\Python34\lib\site-packages\django\db\backends\base\schema.py", line 1
20, in execute
cursor.execute(sql, params)
File "C:\Python34\lib\site-packages\django\db\backends\utils.py", line 80, in
execute
return super(CursorDebugWrapper, self).execute(sql, params)
File "C:\Python34\lib\site-packages\django\db\backends\utils.py", line 65, in
execute
return self.cursor.execute(sql, params)
File "C:\Python34\lib\site-packages\django\db\utils.py", line 94, in __exit__
six.reraise(dj_exc_type, dj_exc_value, traceback)
File "C:\Python34\lib\site-packages\django\utils\six.py", line 685, in reraise
raise value.with_traceback(tb)
File "C:\Python34\lib\site-packages\django\db\backends\utils.py", line 63, in
execute
return self.cursor.execute(sql)
File "C:\Python34\lib\site-packages\django\db\backends\sqlite3\base.py", line
326, in execute
return Database.Cursor.execute(self, query)
django.db.utils.OperationalError: near "[]": syntax error
E:\django projects\4\third>
I also changed the name of array field from prds to basket but you can see in the error the name did not change !!!!! And it runs 0005_order_prds despite the last created migration is 00013_etc !
I think your problem is that you are using a SQLite database, you need to use a Postgres database - see this similar question.

Django- Change Username field to BigAutoField?

I'm designing an Application where username will be an AutoIntegerField and unique.
Here's my model.
class ModelA(models.Model):
username = models.BigAutoField(primary_key=True, db_index=False)
user_id = models.UUIDField(default=uuid.uuid4, unique=True,
editable=False)
Initially, I wanted user_id to be a primary_key, but I can't create an AutoField which is not primary_key. As a result, I'd to let go off user_id as primary_key and assigned username as the primary key.
Now, when I run the migrations, it throws an error saying,
django.db.utils.ProgrammingError: operator class "varchar_pattern_ops" does not accept data type bigint
Complete StackTrace:-
Applying users.0005_auto_20180626_0914...Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/django/db/backends/utils.py", line 65, in execute
return self.cursor.execute(sql, params)
psycopg2.ProgrammingError: operator class "varchar_pattern_ops" does not accept data type bigint
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "manage.py", line 22, in <module>
execute_from_command_line(sys.argv)
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/django/core/management/__init__.py", line 364, in execute_from_command_line
utility.execute()
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/django/core/management/__init__.py", line 356, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/django/core/management/base.py", line 283, in run_from_argv
self.execute(*args, **cmd_options)
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/django/core/management/base.py", line 330, in execute
output = self.handle(*args, **options)
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/django/core/management/commands/migrate.py", line 204, in handle
fake_initial=fake_initial,
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/django/db/migrations/executor.py", line 115, in migrate
state = self._migrate_all_forwards(state, plan, full_plan, fake=fake, fake_initial=fake_initial)
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/django/db/migrations/executor.py", line 145, in _migrate_all_forwards
state = self.apply_migration(state, migration, fake=fake, fake_initial=fake_initial)
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/django/db/migrations/executor.py", line 244, in apply_migration
state = migration.apply(state, schema_editor)
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/django/db/migrations/migration.py", line 129, in apply
operation.database_forwards(self.app_label, schema_editor, old_state, project_state)
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/django/db/migrations/operations/fields.py", line 216, in database_forwards
schema_editor.alter_field(from_model, from_field, to_field)
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/django/db/backends/base/schema.py", line 515, in alter_field
old_db_params, new_db_params, strict)
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/django/db/backends/postgresql/schema.py", line 112, in _alter_field
new_db_params, strict,
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/django/db/backends/base/schema.py", line 684, in _alter_field
params,
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/django/db/backends/base/schema.py", line 120, in execute
cursor.execute(sql, params)
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/django/db/backends/utils.py", line 80, in execute
return super(CursorDebugWrapper, self).execute(sql, params)
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/django/db/backends/utils.py", line 65, in execute
return self.cursor.execute(sql, params)
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/django/db/utils.py", line 94, in __exit__
six.reraise(dj_exc_type, dj_exc_value, traceback)
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/django/utils/six.py", line 685, in reraise
raise value.with_traceback(tb)
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/django/db/backends/utils.py", line 65, in execute
return self.cursor.execute(sql, params)
django.db.utils.ProgrammingError: operator class "varchar_pattern_ops" does not accept data type bigint
I think the issue is that you still have an old index on your username field that clashes with the new type. The db_index=False argument has no effect because primary_key=True always generates an index.
You might be able to solve this by removing primary_key=True, creating a migration, and then re-adding it and creating another migration. Alternatively, you can do it by hand by dropping and re-creating the index. If you want to go down that path, consult this answer.
If your project is still in an early stage and you don't have any valuable data, you can take the easy way out and drop any tables related to your users app or even the complete database, delete all migrations in the users app and create them from scratch.
in my case I was connecting django to postgres at localhost pgadmin
first deleted all the migrations except default one and also in the pycache
then just run python manage.py makemigrations and python manage.py migrate in your terminal

[Django]django.db.utils.IntegrityError

my app named mainsite
I have the table class named Weather in models.py
class Weather(models.Model):
tpr = models.CharField(max_length=5)
wet = models.CharField(max_length=5)
ur = models.CharField(max_length=5)
li = models.CharField(max_length=5)
observe_time = models.DateTimeField(default=None)
I don't want my observe_time set any deafult value
So I set to None .
I have made migrations.
when I made migrate
Then the traceback happen:
File "manage.py", line 22, in
execute_from_command_line(sys.argv)
File "C:\Users\User\Anaconda3\lib\site-packages\django\core\management__init__.py",
line 354, in execute_from_command_line
utility.execute() File "C:\Users\User\Anaconda3\lib\site-packages\django\core\management\__init__.py",
line 346, in execute
self.fetch_command(subcommand).run_from_argv(self.argv) File "C:\Users\User\Anaconda3\lib\site-packages\django\core\management\base.py",
line 394, in run_from_argv
self.execute(*args, **cmd_options) File "C:\Users\User\Anaconda3\lib\site-packages\django\core\management\base.py",
line 445, in execute
output = self.handle(*args, **options) File "C:\Users\User\Anaconda3\lib\site-packages\django\core\management\commands\migrate.py",
line 222, in handle
executor.migrate(targets, plan, fake=fake, fake_initial=fake_initial) File
"C:\Users\User\Anaconda3\lib\site-packages\django\db\migrations\executor.py",
line 110, in migrate
self.apply_migration(states[migration], migration, fake=fake, fake_initial=fake_initial) File
"C:\Users\User\Anaconda3\lib\site-packages\django\db\migrations\executor.py",
line 148, in apply_migration
state = migration.apply(state, schema_editor) File "C:\Users\User\Anaconda3\lib\site-packages\django\db\migrations\migration.py",
line 115, in apply
operation.database_forwards(self.app_label, schema_editor, old_state, project_state) File
"C:\Users\User\Anaconda3\lib\site-packages\django\db\migrations\operations\fields.py",
line 62, in database_forwards
field, File "C:\Users\User\Anaconda3\lib\site-packages\django\db\backends\sqlite3\schema.py",
line 179, in add_field
self._remake_table(model, create_fields=[field]) File "C:\Users\User\Anaconda3\lib\site-packages\django\db\backends\sqlite3\schema.py",
line 147, in _remake_table
self.quote_name(model._meta.db_table), File "C:\Users\User\Anaconda3\lib\site-packages\django\db\backends\base\schema.py",
line 111, in execute
cursor.execute(sql, params) File "C:\Users\User\Anaconda3\lib\site-packages\django\db\backends\utils.py",
line 79, in execute
return super(CursorDebugWrapper, self).execute(sql, params) File "C:\Users\User\Anaconda3\lib\site-packages\django\db\backends\utils.py",
line 64, in execute
return self.cursor.execute(sql, params) File "C:\Users\User\Anaconda3\lib\site-packages\django\db\utils.py", line
98, in exit
six.reraise(dj_exc_type, dj_exc_value, traceback) File "C:\Users\User\Anaconda3\lib\site-packages\django\utils\six.py", line
685, in reraise
raise value.with_traceback(tb) File "C:\Users\User\Anaconda3\lib\site-packages\django\db\backends\utils.py",
line 64, in execute
return self.cursor.execute(sql, params) File "C:\Users\User\Anaconda3\lib\site-packages\django\db\backends\sqlite3\base.py",
line 318, in execute
return Database.Cursor.execute(self, query, params) django.db.utils.IntegrityError: NOT NULL constraint failed:
mainsite_weather__new.observe_time
I don't know what caused this error.
thx.
In order for this to work you should also make this field nullable and blankable, like this:
observe_time = models.DateTimeField(default=None, blank=True, null=True)
or omit default=None completely, like this:
observe_time = models.DateTimeField(blank=True, null=True)
Also, after that, don't forget to delete the previous migration file and run makemigrations and migrate again.

Django Migration: NOT NULL constraint failed

here its my model code
class student(models.Model):
name = models.CharField(max_length=100)
age = models.IntegerField()
available = models.BooleanField(default=False, blank=True)
In above model available is my new field, now I want to migrate database but it give me error, when I'm run following command
python manage.py migrate
Operations to perform:
Apply all migrations: student
Running migrations:
Applying order.0004_auto_20150223_1758...Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/home/nikhil/live-devEnv/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 385, in execute_from_command_line
utility.execute()
File "/home/nikhil/live-devEnv/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 377, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home/nikhil/live-devEnv/local/lib/python2.7/site-packages/django/core/management/base.py", line 288, in run_from_argv
self.execute(*args, **options.__dict__)
File "/home/nikhil/live-devEnv/local/lib/python2.7/site-packages/django/core/management/base.py", line 338, in execute
output = self.handle(*args, **options)
File "/home/nikhil/live-devEnv/local/lib/python2.7/site-packages/django/core/management/commands/migrate.py", line 160, in handle
executor.migrate(targets, plan, fake=options.get("fake", False))
File "/home/nikhil/live-devEnv/local/lib/python2.7/site-packages/django/db/migrations/executor.py", line 63, in migrate
self.apply_migration(migration, fake=fake)
File "/home/nikhil/live-devEnv/local/lib/python2.7/site-packages/django/db/migrations/executor.py", line 97, in apply_migration
migration.apply(project_state, schema_editor)
File "/home/nikhil/live-devEnv/local/lib/python2.7/site-packages/django/db/migrations/migration.py", line 107, in apply
operation.database_forwards(self.app_label, schema_editor, project_state, new_state)
File "/home/nikhil/live-devEnv/local/lib/python2.7/site-packages/django/db/migrations/operations/fields.py", line 37, in database_forwards
field,
File "/home/nikhil/live-devEnv/local/lib/python2.7/site-packages/django/db/backends/sqlite3/schema.py", line 167, in add_field
self._remake_table(model, create_fields=[field])
File "/home/nikhil/live-devEnv/local/lib/python2.7/site-packages/django/db/backends/sqlite3/schema.py", line 135, in _remake_table
self.quote_name(model._meta.db_table),
File "/home/nikhil/live-devEnv/local/lib/python2.7/site-packages/django/db/backends/schema.py", line 99, in execute
cursor.execute(sql, params)
File "/home/nikhil/live-devEnv/local/lib/python2.7/site-packages/django/db/backends/utils.py", line 81, in execute
return super(CursorDebugWrapper, self).execute(sql, params)
File "/home/nikhil/live-devEnv/local/lib/python2.7/site-packages/django/db/backends/utils.py", line 65, in execute
return self.cursor.execute(sql, params)
File "/home/nikhil/live-devEnv/local/lib/python2.7/site-packages/django/db/utils.py", line 94, in __exit__
six.reraise(dj_exc_type, dj_exc_value, traceback)
File "/home/nikhil/live-devEnv/local/lib/python2.7/site-packages/django/db/backends/utils.py", line 65, in execute
return self.cursor.execute(sql, params)
File "/home/nikhil/live-devEnv/local/lib/python2.7/site-packages/django/db/backends/sqlite3/base.py", line 485, in execute
return Database.Cursor.execute(self, query, params)
django.db.utils.IntegrityError: NOT NULL constraint failed: student.available
something wrong here please give me a solution for above problem.
I had this issue, when I wanted to change a field to be non-nullable, but there were already data in the database, where this value was null, which brought the conflict. I was able to resolve it by
Add the nullable field.
migrations.AddField(
model_name='mymodel',
name='new_field',
field=models.OneToOneField(to='app.OtherModel', null=True, default=None),
preserve_default=False,
),
Use RunPython to populate the fields of the existing data with something that made sense
migrations.RunPython(fix_null_fields)
Finally alter the field to be non-nullable
migrations.AlterField(
model_name='mymodel',
name='new_field',
field=models.OneToOneField(to='app.OtherModel'),
preserve_default=True,
),
This seemed to work for me without any trouble. For more information, look into Migrations and Migration operations

Django south illogical error

So I am using south for my django project, and have been changing some model logic. I changed a bunch of things, but regardless, my model looks like this now:
class Group(models.Model):
'''table of organizational groups'''
group_id = models.AutoField(primary_key=True)
group_name = models.CharField(max_length=100,unique=True) #name of group as string
icon_path_clicked = models.CharField(blank=True,max_length=255) #location icon is stored
icon_path_unclicked = models.CharField(blank=True,max_length=255) #location icon is stored
group_description = models.CharField(max_length=255) #description of the group
is_active = models.BooleanField(default=True)
date_created = models.DateTimeField(auto_now_add=True)
now previously, both icon_path_clicked and icon_path_unclicked had unique=True, but I took that out, yet when I try and migrate, I get the following error:
django.db.utils.IntegrityError: could not create unique index "everything_group_icon_path_clicked_key"
DETAIL: Key (icon_path_clicked)=() is duplicated.
why is it still treating this as if I no longer have that field as unique?
full traceback
Running migrations for app:
- Migrating forwards to 0013_auto__chg_field_group_icon_path_clicked__chg_field_group_icon_path_unc.
> everything:0007_auto__add_field_group_icon_path_clicked__add_field_group_icon_path_unc
FATAL ERROR - The following SQL query failed: ALTER TABLE "everything_group" ADD COLUMN "icon_path_clicked" varchar(255) NOT NULL UNIQUE DEFAULT '';
The error was: could not create unique index "everything_group_icon_path_clicked_key"
DETAIL: Key (icon_path_clicked)=() is duplicated.
Error in migration: everything:0007_auto__add_field_group_icon_path_clicked__add_field_group_icon_path_unc
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/Library/Python/2.7/site-packages/Django-1.6-py2.7.egg/django/core/management/__init__.py", line 399, in execute_from_command_line
utility.execute()
File "/Library/Python/2.7/site-packages/Django-1.6-py2.7.egg/django/core/management/__init__.py", line 392, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/Library/Python/2.7/site-packages/Django-1.6-py2.7.egg/django/core/management/base.py", line 242, in run_from_argv
self.execute(*args, **options.__dict__)
File "/Library/Python/2.7/site-packages/Django-1.6-py2.7.egg/django/core/management/base.py", line 285, in execute
output = self.handle(*args, **options)
File "/Library/Python/2.7/site-packages/South-0.8.3-py2.7.egg/south/management/commands/migrate.py", line 111, in handle
ignore_ghosts = ignore_ghosts,
File "/Library/Python/2.7/site-packages/South-0.8.3-py2.7.egg/south/migration/__init__.py", line 220, in migrate_app
success = migrator.migrate_many(target, workplan, database)
File "/Library/Python/2.7/site-packages/South-0.8.3-py2.7.egg/south/migration/migrators.py", line 230, in migrate_many
result = migrator.__class__.migrate_many(migrator, target, migrations, database)
File "/Library/Python/2.7/site-packages/South-0.8.3-py2.7.egg/south/migration/migrators.py", line 305, in migrate_many
result = self.migrate(migration, database)
File "/Library/Python/2.7/site-packages/South-0.8.3-py2.7.egg/south/migration/migrators.py", line 134, in migrate
result = self.run(migration, database)
File "/Library/Python/2.7/site-packages/South-0.8.3-py2.7.egg/south/migration/migrators.py", line 115, in run
return self.run_migration(migration, database)
File "/Library/Python/2.7/site-packages/South-0.8.3-py2.7.egg/south/migration/migrators.py", line 85, in run_migration
migration_function()
File "/Library/Python/2.7/site-packages/South-0.8.3-py2.7.egg/south/migration/migrators.py", line 61, in <lambda>
return (lambda: direction(orm))
File "/Users/ryansaxe/Documents/project/app/migrations/0007_auto__add_field_group_icon_path_clicked__add_field_group_icon_path_unc.py", line 14, in forwards
keep_default=False)
File "/Library/Python/2.7/site-packages/South-0.8.3-py2.7.egg/south/db/generic.py", line 47, in _cache_clear
return func(self, table, *args, **opts)
File "/Library/Python/2.7/site-packages/South-0.8.3-py2.7.egg/south/db/generic.py", line 418, in add_column
self.execute(sql)
File "/Library/Python/2.7/site-packages/South-0.8.3-py2.7.egg/south/db/generic.py", line 282, in execute
cursor.execute(sql, params)
File "/Library/Python/2.7/site-packages/Django-1.6-py2.7.egg/django/db/backends/util.py", line 69, in execute
return super(CursorDebugWrapper, self).execute(sql, params)
File "/Library/Python/2.7/site-packages/Django-1.6-py2.7.egg/django/db/backends/util.py", line 53, in execute
return self.cursor.execute(sql, params)
File "/Library/Python/2.7/site-packages/Django-1.6-py2.7.egg/django/db/utils.py", line 99, in __exit__
six.reraise(dj_exc_type, dj_exc_value, traceback)
File "/Library/Python/2.7/site-packages/Django-1.6-py2.7.egg/django/db/backends/util.py", line 53, in execute
return self.cursor.execute(sql, params)
django.db.utils.IntegrityError: could not create unique index "everything_group_icon_path_clicked_key"
DETAIL: Key (icon_path_clicked)=() is duplicated.

Categories