Hi, Django masters! My app has simple models.py just two fields like below.
#models.py class List(models.Model): item = models.CharField(max_length=200) completed = models.BooleanField(default=False) #migration 0001 class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='List', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('item', models.CharField(max_length=200)), ('completed', models.BooleanField(default=False)), ], ), ] and after makemigrations/migrate, the app was working no problem. *Then, I wanted to try adding two more fields.* #new models.py class List(models.Model): item = models.CharField(max_length=200) completed = models.BooleanField(default=False) *created_at = models.DateTimeField('date', auto_now_add=True, null = True) * * updated_at = models.DateTimeField('update', auto_now=True, null = True) * #migrations 0002 class Migration(migrations.Migration): dependencies = [ ('pages', '0001_initial'), ] operations = [ migrations.AddField( model_name='list', name='created_at', field=models.DateTimeField(auto_now_add=True, null=True, verbose_name='date'), ), migrations.AddField( model_name='list', name='updated_at', field=models.DateTimeField(auto_now=True, null=True, verbose_name='update'), ), ] Django doc says that I need to add '*null = True*' because I am using postgresql as my database. Without '*null = True*', the program throws an error saying that column pages_list.created_at doesn't exist etc. when I try to see the web page. But, with '*null = True*', I successfully did makemigration and migrate, then web page showed up without any problem. *But, when I go to admin, I could not find any fields that I though I created.* I also looked at the table in my postgresql, but again, there are only original columns, but not other two columns. Do you know how to add new columns by changing models.py?? What should I take care to successfully modify models and add new columns in my database table (postgresql in my case). I really appreciate your advice! Looking forward to hearing from you. Nori -- 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+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. 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/a1d71d4c-1500-4972-af57-dc23f5d1ff20%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.