Sunday, April 26, 2020

Re: The database backend does not accept 0 as a value for AutoField.



On Sun, Apr 26, 2020 at 9:53 AM Antje Kazimiers <ntjkazim@gmail.com> wrote:

how about adding null=True and blank=True to the field?

On 4/26/20 6:38 PM, Mayur Bagul wrote:
Hey thanks for your response i did so because initially at the time of migration it was asking for default value and i just putted false in rush. that filed user from User model returns username as string autofield so what shall i put as default their?
i tried to put None for default value but while migrating it giving same error :-- 

 line 192, in validate_autopk_value
   
raise ValueError('The database backend does not accept 0 as a '
ValueError: The database backend does not accept 0 as a value for AutoField.

guys help me with this error .


On Sunday, April 26, 2020 at 9:10:41 PM UTC+5:30, Antje Kazimiers wrote:

setting default=False is odd for any field other than a BooleanField. I would take that out for the OneToOneField at least and see how things go.

Antje

On 4/26/20 4:19 PM, Mayur Bagul wrote:
Hello guys,

im stucked with this error mentioned in subject.
below link redirect details about question.


let me know how to get rid of this problem.


Thanking You.

--
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...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/cad442bf-e697-47c6-a0b4-3ce65bcef480%40googlegroups.com.
--
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 view this discussion on the web visit https://groups.google.com/d/msgid/django-users/7c34122c-0260-4a5b-8586-42c0037f8192%40googlegroups.com.
--
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 view this discussion on the web visit https://groups.google.com/d/msgid/django-users/5dd77724-3b33-ee13-41b0-19bbcc927fd0%40gmail.com.

I would remove all the default=False options from your model fields in Owner. Re-run migrations, and try to submit the form again.

-Jorge

--
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 view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CANfN%3DK8GEe%2BoATZM4t4QF7jOqQxJX7VXSj1sce57vpvsbDCHrA%40mail.gmail.com.

No comments:

Post a Comment