Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Creating an entire web application using django admin

I was thinking that django admin is an utility to provide trusted administrators of the site, full access to the site's data model.

However, after going through django admin in detail, I understand that it is very powerful set of views and templates that one can use to create an entire application.

How often do you create an entire application using admin alone? Is it easier to create using views itself than customizing admin that much?

How about building prototype using admin. Do we even need to build prototype? The admin customization cannot be re-used in real application.

If I want to use a part of the admin code in real application (with different templates), is there some kind of scaffolding option available?

like image 631
lprsd Avatar asked Mar 24 '09 11:03

lprsd


3 Answers

"The Admin is not your app."

If the customization goes beyond the trivial, write your own views.

In my experience, I leave the internal admin pages relatively untouched. Instead, I override the admin index template, where I put links to custom-written views when the user needs to do nontrivial reporting or form handling.

like image 147
AdamKG Avatar answered Oct 02 '22 13:10

AdamKG


I have done something like that before. It was a CMS for a university completely implemented by extending Django admin. It turned out it was a bad design descision. I had to jump through hoops to do some things.

It really depends on what the requirements are for your application. If there needs to be lots of ajax or some specific workflow extending the admin will not be the right thing to do. But I think 60% of cases can be covered by extending the admin.

It's also excellent for building prototypes.

EDIT

OK, that was in the 0.96 days.

So far I've built 2 "big" sites that are in production completely on top of the new admin. These are mostly case management, data entry and reporting so they could be squeezed into the workflow of the admin. But, not without a big effort going into extending the base Site, ModelAdmin, InlineModelAdmin etc. The decision to go this way is we were pressed to do it quick. But in the first case it was a perfect fit for the requirements too. Both run on an intranet in the government sector. Both do their job fine. One with 200 tables handling tens of thousands of entries. The other one manages payments.

So, yes it's true. The admin is not your app. However, it's extendable enough although much of it is not documented. And it fits in most basic enterpresey workflows. So it's worth considering in a limited number of scenarios.

like image 43
Vasil Avatar answered Oct 02 '22 15:10

Vasil


I disagree with most of the other answers.

Simply put, there is no match for what you get for free using the admin app.

Your first customization of the admin will be tough as you'll be facing a steep learning curve (you will need to deal with overriding templates, Managers, ModelAdmins, probably use database views, the CSS and JS, some additional forms and validation rules, etc...). But once that is done, you'll start to feel king in bending the admin system to your needs. I have built a complex inventory and accounting web application with data-entry, reporting, and permission system all based solely on the admin interface and back-end.

like image 34
Rabih Kodeih Avatar answered Oct 02 '22 14:10

Rabih Kodeih