user2284926
user2284926

Reputation: 651

Reflect changes in admin page Django

I have a model and originally it had these attributes

First Name
Last Name
Email

I altered the model to include an additional attribue : Address , now it looks like this

First Name
Last Name
Email
Address

I am using MySQL database and the changes are reflected in the table in the database , however the changes are not reflected in Django admin as the tables does not have a new column called Address.

I know it has something to do with overriding the admin template in Django but i cant seems to be able to do it , can someone guide me

Thanks

Upvotes: 1

Views: 1099

Answers (1)

Thomas
Thomas

Reputation: 11888

In your admin.py file in your app directory, there will be a subclass of ModelAdmin that is registered for this model. Make sure the address field is listed in either the fields or fieldsets property of this class, and make sure it is not listed in the exclude list on this class.

REF: https://docs.djangoproject.com/en/dev/ref/contrib/admin/

Upvotes: 1

Related Questions