Hi You may change elogin column syntax and provide default="Some_Value" .This may work.
On Tuesday, May 28, 2019, Chandrashekhar Singh <[email protected]> wrote: > You have to add null= true to each model field since database needs > default value > > On Mon, May 27, 2019, 5:52 PM Saeed Pooladzadeh <[email protected]> > wrote: > >> Hello >> >> I made this model and think everything is fine: >> >> class Smodel(models.Model): >> >> eid=models.AutoField(primary_key=True) >> # eid=models.IntegerField(default=0) >> elogin = models.CharField(max_length=8) >> epassword= models.CharField(max_length=8) >> >> elikeDay=models.IntegerField(default=0) >> efollowPerDay=models.IntegerField(default=0) >> >> >> >> #esession = models.TextField() >> class Meta: >> db_table = "saeed" >> >> >> 'But when I try to 'make migration >> I get this error: >> >> You are trying to add a non-nullable field 'elogin' to smodel without a >> default; we can't do that (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 let me add a default in models.py >> Select an option: >> >> >> *What is wrong with this model and how can I resolve it?* >> >> regards, >> Saeed >> >> -- >> 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 [email protected]. >> To post to this group, send email to [email protected]. >> Visit this group at https://groups.google.com/group/django-users. >> To view this discussion on the web visit https://groups.google.com/d/ >> msgid/django-users/dee2a6de-49e9-45c4-8536-0bed15038bd9% >> 40googlegroups.com >> <https://groups.google.com/d/msgid/django-users/dee2a6de-49e9-45c4-8536-0bed15038bd9%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> For more options, visit https://groups.google.com/d/optout. >> > -- > 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 [email protected]. > To post to this group, send email to [email protected]. > Visit this group at https://groups.google.com/group/django-users. > To view this discussion on the web visit https://groups.google.com/d/ > msgid/django-users/CADNvQ1P1yGnosE7%3DLEaFsehLF3zLpWFgtgw_H560L% > 2BRkHjBiaQ%40mail.gmail.com > <https://groups.google.com/d/msgid/django-users/CADNvQ1P1yGnosE7%3DLEaFsehLF3zLpWFgtgw_H560L%2BRkHjBiaQ%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- Mr Shetty Balaji Asst. Prof. IT Department SGGS I&T Nanded. My. India -- 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 [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAECSbOs-2rPxAc9Zm0oLHn62iwZDu0OP6K4uOVb08NzXrORh0g%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.

