makemigrations

794 views
Skip to first unread message

shiva singh

unread,
Sep 15, 2022, 3:38:56 PM9/15/22
to Django users
Hello I am new in Django users group. I am using Django and faching a problem when i do any changes in existing models after run  makemigrations.


This is problem :-It is impossible to add a non-nullable field 'logo' to jobdetails without specifying a default. This is because the database needs something to populate existing rows.
Please select a fix:
 1) Provide a one-off default now (will be set on all existing rows with a null value for this column)
 2) Quit and manually define a default value in models.py.
Select an option: 2


please help how can i solve this problem .

Thank you 

Adebileje Nurudeen

unread,
Sep 15, 2022, 3:51:54 PM9/15/22
to django...@googlegroups.com
Select option as 1

--
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...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/10c70cce-9e8e-46ca-8ab1-a2fc73ef4181n%40googlegroups.com.

Hafiza Nafeesa Asif

unread,
Sep 15, 2022, 4:09:27 PM9/15/22
to django...@googlegroups.com
If error not resolve attach pic ...

On Fri, 16 Sep 2022, 1:00 am Hafiza Nafeesa Asif, <nafees...@gmail.com> wrote:
default=True 

Hafiza Nafeesa Asif

unread,
Sep 15, 2022, 4:09:27 PM9/15/22
to django...@googlegroups.com
default=True 

On Fri, 16 Sep 2022, 12:51 am Adebileje Nurudeen, <lordn...@gmail.com> wrote:

Fortune Osho

unread,
Sep 15, 2022, 6:55:44 PM9/15/22
to django...@googlegroups.com
In the new added field “logo” set default = None or specify a default value 

--

shiva singh

unread,
Sep 16, 2022, 2:24:31 AM9/16/22
to Django users
Thank You  everyone for help me

On Friday, September 16, 2022 at 4:25:44 AM UTC+5:30 fortu...@gmail.com wrote:
In the new added field “logo” set default = None or specify a default value 

On Thu, Sep 15, 2022 at 8:38 PM shiva singh <shivas...@gmail.com> wrote:
Hello I am new in Django users group. I am using Django and faching a problem when i do any changes in existing models after run  makemigrations.


This is problem :-It is impossible to add a non-nullable field 'logo' to jobdetails without specifying a default. This is because the database needs something to populate existing rows.
Please select a fix:
 1) Provide a one-off default now (will be set on all existing rows with a null value for this column)
 2) Quit and manually define a default value in models.py.
Select an option: 2


please help how can i solve this problem .

Thank 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-users+unsubscribe@googlegroups.com.

rahul sharma

unread,
Sep 16, 2022, 2:28:13 AM9/16/22
to django...@googlegroups.com
Select option 1

On Fri, Sep 16, 2022, 11:24 shiva singh <shivas...@gmail.com> wrote:
Thank You  everyone for help me

On Friday, September 16, 2022 at 4:25:44 AM UTC+5:30 fortu...@gmail.com wrote:
In the new added field “logo” set default = None or specify a default value 

On Thu, Sep 15, 2022 at 8:38 PM shiva singh <shivas...@gmail.com> wrote:
Hello I am new in Django users group. I am using Django and faching a problem when i do any changes in existing models after run  makemigrations.


This is problem :-It is impossible to add a non-nullable field 'logo' to jobdetails without specifying a default. This is because the database needs something to populate existing rows.
Please select a fix:
 1) Provide a one-off default now (will be set on all existing rows with a null value for this column)
 2) Quit and manually define a default value in models.py.
Select an option: 2


please help how can i solve this problem .

Thank 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-users...@googlegroups.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...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/75c35525-6664-41cd-969c-ba0a2ad99218n%40googlegroups.com.

Alisher Shamuratov

unread,
Sep 16, 2022, 8:27:00 AM9/16/22
to django...@googlegroups.com
Just click 1 and write validate date and it populate database correctly , and be aware when writing correct populating data

пт, 16 сент. 2022 г., 00:38 shiva singh <shivas...@gmail.com>:
--

subin

unread,
Sep 16, 2022, 1:14:56 PM9/16/22
to django...@googlegroups.com

subin

unread,
Sep 16, 2022, 1:18:39 PM9/16/22
to django...@googlegroups.com
Thank you for visiting ! Use the code SALE20 to save 20% on any one item on your next visit.

subin

unread,
Sep 16, 2022, 1:19:30 PM9/16/22
to django...@googlegroups.com
Please reach out to Sophie at .

On Fri, Sep 16, 2022 at 7:24 AM shiva singh <shivas...@gmail.com> wrote:
Thank You  everyone for help me

On Friday, September 16, 2022 at 4:25:44 AM UTC+5:30 fortu...@gmail.com wrote:
In the new added field “logo” set default = None or specify a default value 

On Thu, Sep 15, 2022 at 8:38 PM shiva singh <shivas...@gmail.com> wrote:
Hello I am new in Django users group. I am using Django and faching a problem when i do any changes in existing models after run  makemigrations.


This is problem :-It is impossible to add a non-nullable field 'logo' to jobdetails without specifying a default. This is because the database needs something to populate existing rows.
Please select a fix:
 1) Provide a one-off default now (will be set on all existing rows with a null value for this column)
 2) Quit and manually define a default value in models.py.
Select an option: 2


please help how can i solve this problem .

Thank 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-users...@googlegroups.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...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/75c35525-6664-41cd-969c-ba0a2ad99218n%40googlegroups.com.

subin

unread,
Sep 16, 2022, 1:22:47 PM9/16/22
to django...@googlegroups.com
Thank you for your immediate response.

subin

unread,
Sep 16, 2022, 1:27:21 PM9/16/22
to django...@googlegroups.com
I will continue learning more about .

subin

unread,
Sep 16, 2022, 1:28:41 PM9/16/22
to django...@googlegroups.com
Hi

On Thu, Sep 15, 2022 at 9:09 PM Hafiza Nafeesa Asif <nafees...@gmail.com> wrote:

subin

unread,
Sep 16, 2022, 1:29:31 PM9/16/22
to django...@googlegroups.com
Thanks for contacting XYZ Company! One of our sales reps will reach out to you shortly. Tap to browse our summer sale while you wait

subin

unread,
Sep 16, 2022, 1:30:20 PM9/16/22
to django...@googlegroups.com
Have a good day.

--

Joel Wembo

unread,
Sep 19, 2022, 8:07:42 AM9/19/22
to Django users
Django can't add a new field by itself without null values being allowed here, especially when you have unique=True set on this field. To solve that issue, you have to perform it in steps:
  1. Add a column with null=True or without unique=True and with some default value
  2. Make sure that all records in database will have a unique value.
  3. Change the field to the final state.
Reply all
Reply to author
Forward
0 new messages