Friday 15 February 2013

python - Django unique, null and blank CharField giving 'already exists' error on Admin page -


I'm getting the most awkward error I have a person model

  class Person (models.model): user = model.intoinfilled (user, primary_key = true) facebook_id = models.charfield (max_length = 225, unique = true, null = true = empty = true) twitter_id = models.charfield (max_length = 225 , Exclusive = true, zero = true, empty = true) suggest_person = model. Boolean field (default = false)   

I recently added the twitter_id field when I used the Django administrator page, and gave a suggestion to 'person', then I got the following error :

  Person with this Twitter ID already exists   

I find this error very strange because the Facebook_id field is similar to the Twitter_ID field Has been created only.

What could be the reason?

Since you have null = true, blank = true and Unique = True , considering the default place for any Django any or as a unique entry. Remove the unique obstacle and handle the uniqueness part in the code.

No comments:

Post a Comment