Re: unique not working as expected
Yes , Sam is right.
unique=True was added after table was created.
On Sat, May 11, 2013 at 12:12 AM, Sam Solomon <sssbox@gmail.com> wrote:
My guess is that unique=True was added after the table was created using syncdb.I'm guessing that most companies that use Django professionally use South (http://south.aeracode.org/) to make schema changes easier.Without South, you would have to keep the database in sync with the code manually (as in `CREATE INDEX...`)With South, before you change the schema, you can follow these instructions: http://south.readthedocs.org/en/latest/convertinganapp.html#converting-an-appAfter South has the existing structure synced in it's history, you can make schema changes and then create new migrations (python manage.py schemamigration --auto <app name>; python manage.py migrate)--
On Thursday, May 9, 2013 9:48:11 AM UTC-7, C. Kirby wrote:Could you elaborate on what the resolution was for future people who may run into this problem?
On Thursday, May 9, 2013 9:59:00 AM UTC-5, Amber Kulkarni wrote:Thanks Tom.Got the problem.Problem solved on creating new model.On Thu, May 9, 2013 at 6:53 PM, Tom Evans <teva...@googlemail.com> wrote:
On Thu, May 9, 2013 at 12:47 PM, Amber KulkarniThat just shows the SQL Django would use to create the table, it says
<amber.ku...@gmail.com> wrote:
> I checked the table using python manage.py sql app_name
> it shows the following
>
> create table "tp_app_server" (
> "id " integer not null primary key,
> "link" varchar(200) not null unique
> "crawled_flag" varchar(1) not null
> )
> ;
> COMMIT
>
nothing about how the table is currently constructed.
Use the .schema command in sqlite shell to see the current structure
of the table. Does it have a unique key on link?
Cheers
Tom
--
You received this message because you are subscribed to a topic in the Google Groups "Django users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/django-users/LFzuzEo-g1o/unsubscribe?hl=en.
To unsubscribe from this group and all its topics, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
--
AMBER KULKARNI
You received this message because you are subscribed to a topic in the Google Groups "Django users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/django-users/LFzuzEo-g1o/unsubscribe?hl=en.
To unsubscribe from this group and all its topics, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
AMBER KULKARNI
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home