Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Design Issue: To what extent should the Django Admin site be used?

I'm relatively new to Django and especially new to the admin functionality. I've read many articles expounding the benefits of the built-in admin site but I'm not sure to what extent they should be used.

Some general questions:

  • What sort of database interactions should be in admin and which should be part of the general site functionality?
  • I understand that models can be easily changed/deleted on the admin site but is it the best way to add new objects rather than in a custom page?

A more specific question:

  • I'm creating a website for tracking packages. The idea is that staff would scan and insert many (hundreds of) packages into the database on a daily basis. I'm unsure whether this could be done efficiently in admin as the current process of adding a model is a slow, multi-step process (I don't know to what extent that can be customized). As this is one of the site's main functionalities it also seems odd that it would reside in the admin site. Would it make more sense in the Django framework to write my own page? Or would I just be rewriting (probably less efficiently) what's already been created with django-admin?

Any suggestions or Django standards you guys have would be greatly appreciated.

like image 783
WillMartin Avatar asked Nov 06 '12 10:11

WillMartin


1 Answers

Generally the django-admin should be used for CRUD (Create, Read, Update and Delete) operations. It should be used where you want to quickly setup a facility to allow people to manage the data. It can handle complex database relationships and inline editing, however it would be more appropriate to build a seperate django application if your adminstration facility is going to be bespoke. Django-admin can be customised heavily and you can subclass its inner workings, however it's a lot easier in the long run to code and maintain your own application albeit it will take longer to get it up and running.

One way of finding out if the django-admin is appropriate to use or not is to pick one important requirement and try to implement it, if it feels like it's a lot of work trying to implement it in django-admin then it's probably a case of shoehorning. I think sometimes requirements are shoehorned into django-admin by developers who think it's a one-size-fits-all solution which it simply isn't.

like image 192
Imran Azad Avatar answered Sep 23 '22 15:09

Imran Azad