Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to have separate pages for inline admin forms in Django?

Lets say i have a model A. Then, i have several models B, C, D, E etc that each have a foreignKey to model A. I know that i can set B, C, D etc as inlines to model A so that when i create a model A it will show formsets for adding multiple items for each subModel, but i think this would make a fairly cluttered and very large page.

Is there a way to somehow, instead of having all of these formsets inline on the same page, to have each formset on a separate page? in other words, there would be links from model A to create/edit associate model B's, create/edit associated model C's, etc?

Thanks!

like image 916
user210881 Avatar asked May 11 '10 21:05

user210881


People also ask

How do I access my Django admin page?

To login to the site, open the /admin URL (e.g. http://127.0.0.1:8000/admin ) and enter your new superuser userid and password credentials (you'll be redirected to the login page, and then back to the /admin URL after you've entered your details).

What is Inlines in Django?

django-inline-actions provides a handy templatetag render_inline_action_fields , which adds these information as hidden fields to a form. As the action does not know that an intermediate form is used, we have to include some special handling.

Can I use Django admin in production?

your company should follow a least access principle policy; so yes: only select people should have access. Django has basic auditing capability via signals and displayed in the admin out of the box. You can build on top of this.

How can I remove extra's from Django admin panel?

You can add another class called Meta in your model to specify plural display name. For example, if the model's name is Category , the admin displays Categorys , but by adding the Meta class, we can change it to Categories . Literally saved my life!


1 Answers

I’m looking for a way to do exactly the same thing. It looks like the answer might be 'proxy models'. It's suggested as an answer to this Stack Overflow query:

django admin: separate read-only view and change view

…and this query asking about multiple admin lists for the same model:

Multiple ModelAdmins/views for same model in Django admin

Documentation on Proxy Models here:

Django | Models | Django documentation#Proxy models

I’m a newcomer to Django myself, so will post a more complete reply once I get it to work.

like image 67
andrewf Avatar answered Sep 17 '22 13:09

andrewf