0

I want to use the existing Django Admin template for a form of my own. The situation is like there are two models. say A and B and I want a form that displays the details about both the models in a songle form of my own. So I am using a ModelForm. But I want to use the templates from the django admin. How can I do that?

Indradhanush Gupta
  • 4,067
  • 10
  • 44
  • 60

2 Answers2

0

I think its better to override the admin interface. https://docs.djangoproject.com/en/dev/ref/contrib/admin/#overriding-admin-templates

Indradhanush Gupta
  • 4,067
  • 10
  • 44
  • 60
0

Would a Class-based generic view work for you?

Brent Washburne
  • 12,904
  • 4
  • 60
  • 82
  • Not sure about that. Overriding the admin feels good. But how do you think I can use both the models in one form? Any ideas? – Indradhanush Gupta Jun 20 '13 at 00:28
  • Yes, you can use two models in one form but it brings up questions on functionality. Mainly, how do you want to interact with two models on one page? You should try and find a form that mimics the one you want and then copy it. – Brent Washburne Jun 20 '13 at 00:38
  • Im considering over riding the model admin to include the functionalities of two models into one ModelAdmin. How can this be done? Check this question : http://stackoverflow.com/questions/17203589/how-may-i-overrride-the-modeladmin-so-that-it-displays-components-of-two-models – Indradhanush Gupta Jun 20 '13 at 00:42
  • There is not enough information here to answer your question. Post your models and code, and ask a more specific question. – Brent Washburne Jun 20 '13 at 16:31