Reputation: 43
I use django admin to add data, i run makemigrations and migrate on my code but the Choice model won't update and i can't see the Choice model in admin.However the Question model is updated. Where is my mistake?
model.py:
class Choice(models.Model):
question = models.ForeignKey(Question, on_delete=models.CASCADE)
choice_text = models.CharField(max_length=200)
votes = models.IntegerField(default=0)
def __str__(self):
return self.choice_text
Upvotes: 2
Views: 2351
Reputation: 8324
You have to register it in admin.py
class ChoiceAdmin(admin.ModelAdmin):
pass
admin.site.register(Choice, ChoiceAdmin)
Documentation for Django Admin https://docs.djangoproject.com/en/2.1/ref/contrib/admin/
Upvotes: 1