Home Override django change_form.html template when a third app is overriding it
Reply: 1

Override django change_form.html template when a third app is overriding it

filtfilt
1#
filtfilt Published in 2017-12-07 22:08:10Z

I am trying to override change_form.html only for one model, so I did as explained in the django documentation and created /templates/my_app_name/my_model_name/change_form.html.

The problem is, it is not working and I am not seeing the extra features that I have added to the change_form template. I am using django_guardian, which also overrides the same template, so my assumption is that this is causing the issue. It is worth mentioning, that before placing the template in the my_app_name/my_model_name/ folder, the features of both templates were visible in the admin interface.

Is there a way to apply this only for 1 model?

Alasdair
2#
Alasdair Reply to 2017-12-07 22:24:33Z

The GuardedModelAdmin changes change_form_template to use the template from django-guardian. Try changing it back in your model admin class:

class MyModelAdmin(GuardedModelAdmin):
    ...
    change_form_template = 'my_app_name/my_model_name/change_form.html'
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.308862 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO