Using Django admin look and feel in my own application

I like the very simple but still really elegant look and feel of the django admin and I was wondering if there is a way to apply it to my own application.

(I think that I've read something like that somewhere, but now I cannot find the page again.)

(edited: what I am looking for is a way to do it automatically by extending templates, importing modules, or something similar, not just copy&paste the css and javascript code)


Asked by: Carlos355 | Posted: 06-12-2021






Answer 1

Are you sure you want to take every bit of admin-site's look & feel?? I think you would need to customize some, as in header footer etc.

To do that, just copy base.html from

"djangosrc/contrib/admin/templates/admin/"

and keep it in

"your_template_dir/admin/base.html" or "your_template_dir/admin/mybase.html"

Just change whatever HTML you want to customize and keep rest as it is (like CSS and Javascript) and keep on extending this template in other templates of your application. Your view should provide what it needs to render (take a look at any django view from source) and you'll have everything what admin look & feel had. More you can do by extending base_site.html in same manner.

(Note: if you keep the name 'base.html' the changes made in html will affect Django Admin too. As this is the way we change how Django Admin look itself.)

Answered by: Brooke118 | Posted: 07-01-2022



Answer 2

{% extends "admin/base_site.html" %}

is usually a good place to start but do look at the templates in contrib/admin/templates and copy some of the techniques there.

Answered by: Oliver417 | Posted: 07-01-2022



Similar questions

python - Why won't Django 1.0 admin application work?

I've just started playing with Django and am loosely following the tutorial with my own set of basic requirements. The models I've sketched out so far are a lot more comprehensive than the tutorial, but they compile fine. Otherwise, everything should have been the same. My problem is with the admin application. I can log into it, and view the editable models, but when I click on a model or any of the change/add but...


python - Django admin style application for Java

I'm looking for a web framework or an application in Java that does what Django admin does - provides a friendly user interface for editing data in a relational database. I know it's possible to run Django on Jython and that way achieve a somewhat Java-based solution, but I'd prefer something pure-Java to keep the higher-ups happy.


python - What is the best way to add an API to a Django application?

I am adding MetaWeblog API support to a Django CMS, and am not quite sure how to layer the application. I am using django_xmlrpc, which allows me to map to parameterised functions for each request. It is just a case of what level do I hook in calls to the django application from the service functions (AddPage, EditPage etc) For django-page-cms, and I suppose many django apps, the business logic and validati...


python - Django admin won't let me delete a user in its auth admin application

This may be more of a serverfault question I'm not sure. I have two practically identical servers - I cloned the DB from one to the other, and now when I try to delete a user in the Admin > Auth application Django gives the following error: File "/usr/lib/python2.5/site-packages/django/db/models/sql/query.py", line 206, in results_iter for rows in self.execute_sql(MULTI): File "...


python - Large Django application layout

I am in a team developing a web-based university portal, which will be based on Django. We are still in the exploratory stages, and I am trying to find the best way to lay the project/development environment out. My initial idea is to develop the system as a Django "app", which contains sub-applications to separate out the different parts of the system. The reason I intended to make these "sub" applications is that...


python - Django for a simple web application

I'm developing an app (an API) in python and I would like to offer some of its functionality through a web interface (like web services do). I've been looking at django, but I don't know if really fits well in my idea. I only want to create a web page that invokes to my API methods in order to acomplish the functionality that offers that web page. But, after followed the tutorial, I feel a little confused about the point...


python - Django application does not create tables

So, I have created a django app here: http://fpaste.org/bkFf/ without using django-admin. I want the model that I have created in models.py (http://fpaste.org/i1Vd/) to automatically create the table in the database, as specified in settings.py (http://fpaste.org/GBz0/). I run the command django-admin syncdb --settings=settings.py, which gives me the fol...


python - Django get list of models in application

So, i have a file models.py in MyApp folder: from django.db import models class Model_One(models.Model): ... class Model_Two(models.Model): ... ... It can be about 10-15 classes. How to find all models in the MyApp and get their names? Since models are not iterable, I don't know if this is even possible.


python - Why my uWSGI cannot find my Django application?

I have been through numerous similar questions on this forum but my issue still beats me. My project layout /home/django/apps |- movehere_env <--- Virtualenv. Everthing, including uwsgi is installed in it. |- movehere_store |- settings.py |- apps |- Other project stuff |- prod <--- Stores settings for prod env |- uwsg...


python - How can I send data from one Django application to another?

Here is my issue. I need to send a form from one Django application to another (on separate machines). Taking into consideration line breaks, this is how I post my data. <form id="codeid" method="post" enctype="application/x-www-form-urlencoded" name="code" action="192.168.56.2:8000/api/comp/"> <input id="textarea_1" name="content" cols="80" rows="15"></input> <input id="thebutt...


python - Application that uses Django models need to be a Django app?

What is the definition of a Django application? Any application that uses Django features, such as orm and url-view mapping? I ask because I have a component which has 2 sub-components: a web service server and a standalone application. The web service server uses Django views to map url to request handlers. The web service server and the application use Django models and a database managed by Django. The web servi...


python - Django multi server application

I am currently developing an application in Python using Django in which users can upload files to a remote server. Here is the way I will proceed : User upload the file to the remote server (which can be a Django app either) The remote server get the file and validate this The remote server has to record the file in the SQL database Problem is that the remote server ...


python - different level of user role in a django application


python - What should be the URL of my Django Application

I have uploaded my first Django Application called survey (Its a work in progress) using mod_wsgi with Apache on an Ubuntu VM but I don't know what the URL of it should be. My VM has been made public through a proxyPass at http://phaedrus.scss.tcd.ie/bias_experiment. When worki...


python - Django Apache Application 404

I have tried my Django Application using the Django application server and it works just fine.However when I try to use the application with Apache I get a 404 with every URL that I am routing. Below is the 404 error that I am getting: Page not found (404) Request Method: GET Request URL: http://www.domain.com:8787/myapp Using the URLconf defined in myproject.urls, Django tried these URL patterns, in thi...


python - Find Host and Port in a Django Application

I'm connecting to the Twitter Streaming API and am setting up the OAuth handshake. I need to request a token and send a callback_url as a params dictionary along with post request. I've hardcoded in the url for development (http://localhost:8000/oauth) but when I deploy this will change. I want to set up something that will find the host and port and set a reference it. Ideally, looking...


python - Tests for views in Django application

I have few models in my models.py. Two of them are as follows: class Event(): eventName = models.CharField( unique = True ) class Job(): event = models.ForeignKey(Event) jobName = models.CharField class Meta: unique_together(('event','jobName')) I was testing a modelform of this class, using Client module from django.test


python - How to start and stop an application within Django

I have build an application outside of Django which i would like to interact with Django. So within a view in Django i would like to start and stop this application. While the application is running it will return a JSON string which has to be pushed back to the view and processed client-side with JavaScript. The application is pretty much blocking as it is a while-loop running until it has been killed. It is very ...


python - DJANGO Celery on Application Server + Mail server

I am trying to configure DJANGO + Celery on Application server with separate mail server. Both servers has same files: app_name/settings.py BROKER_URL = "sqs://%s:%s@" % (AWS_ACCESS_KEY_ID,AWS_SECRET_ACCESS_KEY) CELERY_TIMEZONE = 'America/New_York' CELERY_ACCEPT_CONTENT = ['pickle','json', 'msgpack', 'yaml'] from celery.schedules import crontab from datetime import timedelta CELERY_ROUTES = ...


python - Django Application down because of OS update in server

This is my first question on stack overflow so, please help me out. We have hosted our application in ulcis.com and recently dreamhost server updated from centOS to ubuntu and in result our application is down. We had our application running in virtualenv and now the virtualenv throws error when i try to validate my application. `(envnew)[ps#####3]:~/------/------]$ python manage.py validate Traceback (most...


python - Why won't Django 1.0 admin application work?

I've just started playing with Django and am loosely following the tutorial with my own set of basic requirements. The models I've sketched out so far are a lot more comprehensive than the tutorial, but they compile fine. Otherwise, everything should have been the same. My problem is with the admin application. I can log into it, and view the editable models, but when I click on a model or any of the change/add but...


python - How should I stress test / load test a client server application?

Closed. This question needs to be more focused. It ...


python - How do you deploy your WSGI application? (and why it is the best way)

I am deploying a WSGI application. There are many ways to skin this cat. I am currently using apache2 with mod-wsgi, but I can see some potential problems with this. So how can it be done? Apache Mod-wsgi (the other mod-wsgi's seem to not be worth it) Pure Python web server eg paste, cherrypy, Spawning, Twisted.web as 2 but with reverse proxy from nginx, apache2 etc, with good static f...


python - Django admin style application for Java

I'm looking for a web framework or an application in Java that does what Django admin does - provides a friendly user interface for editing data in a relational database. I know it's possible to run Django on Jython and that way achieve a somewhat Java-based solution, but I'd prefer something pure-Java to keep the higher-ups happy.


flex3 - Call python script from AIR application?

How can we invoke a python script using AIR 1.5?


python - PyS60 application not going full screen

I am very new to PyS60. I was testing how to set an application to full screen mode but unfortunately, it doesn't work as expected. I tested the script on Nokia 6120 Classic. Here is what I did: appuifw.app.screen = 'full' What I get is a half screen of my application with a plain white colour below. What am I doing wrong? Thanks in advance.


python - What is the best way to add an API to a Django application?

I am adding MetaWeblog API support to a Django CMS, and am not quite sure how to layer the application. I am using django_xmlrpc, which allows me to map to parameterised functions for each request. It is just a case of what level do I hook in calls to the django application from the service functions (AddPage, EditPage etc) For django-page-cms, and I suppose many django apps, the business logic and validati...


python - Simple tray icon application using pygtk

I'm writing a webmail checker in python and I want it to just sit on the tray icon and warn me when there is a new email. Could anyone point me in the right direction as far as the gtk code? I already coded the bits necessary to check for new email but it's CLI right now.


python - Prompt on exit in PyQt application

Is there any way to promt user to exit the gui-program written in Python? Something like "Are you sure you want to exit the program?" I'm using PyQt.


python - Django admin won't let me delete a user in its auth admin application

This may be more of a serverfault question I'm not sure. I have two practically identical servers - I cloned the DB from one to the other, and now when I try to delete a user in the Admin > Auth application Django gives the following error: File "/usr/lib/python2.5/site-packages/django/db/models/sql/query.py", line 206, in results_iter for rows in self.execute_sql(MULTI): File "...


python - Why won't Django 1.0 admin application work?

I've just started playing with Django and am loosely following the tutorial with my own set of basic requirements. The models I've sketched out so far are a lot more comprehensive than the tutorial, but they compile fine. Otherwise, everything should have been the same. My problem is with the admin application. I can log into it, and view the editable models, but when I click on a model or any of the change/add but...


python - What is the best way to serve static web pages from within a Django application?

I am building a relatively simple Django application and apart from the main page where most of the dynamic parts of the application are, there are a few pages that I will need that will not be dynamic at all (About, FAQ, etc.). What is the best way to integrate these into Django, idealing still using the Djang...


networking - Embedding a remote Python shell in an application

You can embed the IPython shell inside of your application so that it launches the shell in the foreground. Is there a way to embed a telnet server in a python app so that you can telnet to a certain port and launch a remote IPython shell? Any tips for redirecting the input/output streams for IPython or how to hook it up to a telnet server library or recom...


python - Debug Pylons application through Eclipse

I have Eclipse setup with PyDev and love being able to debug my scripts/apps. I've just started playing around with Pylons and was wondering if there is a way to start up the paster server through Eclipse so I can debug my webapp?


naming - Deploying a python application with shared package

I'm thinking how to arrange a deployed python application which will have a Executable script located in /usr/bin/ which will provide a CLI to functionality implemented in A library installed to wherever the current site-packages directory is. Now, currently, I have the following directory structure in my sources: foo.py foo/ __init__.py ... which...


python - How can I capture all exceptions from a wxPython application?

I'm writing a little debug app for a bit of kit we're developing and I'd like to roll it out to a few users to see if they can provoke any crashes. Does anyone know a way of effectively wrapping a wxPython app to catch any and all unhandled exceptions that would cause the app to crash? Ideally I'd want to capture all output (not just errors) and log it to a file. Any unhandled exceptions ought to log to the current...


deployment - How do I deploy a Python desktop application?

I have started on a personal python application that runs on the desktop. I am using wxPython as a GUI toolkit. Should there be a demand for this type of application, I would possibly like to commercialize it. I have no knowledge of deploying "real-life" Python applications, though I have used py2exe in the past with varied success. How would I obfu...


Starting a new database driven python web application would you use a javascript widget framework? If so which framework?

I am starting a new web application project. I want to use python as I am using it at my bread-and-butter-job. However I don't want to reinvent the wheel. Some things I have thought about: AJAX would be nice if it’s not too much of a hazzle. It is best if the licensing allows commercialization but is not crucial at this point. It could also be funny to try out the G...


console application - using curses with raw_input in python

In my python linux console application I use curses to handle displaying of data. At the same time I'd like to have an input line to enter commands, pretty much in good ol' irssi-style. With default curses getch() I'd have to do a lot of coding just to get the basic funcionality of raw_input function - arrow keys to move cursor / browse through the input history. Is there a simple way to get such behavior working w...


scripting - How can I launch an instance of an application using Python?

I am creating a Python script where it does a bunch of tasks and one of those tasks is to launch and open an instance of Excel. What is the ideal way of accomplishing that in my script?






Still can't find your answer? Check out these communities...



PySlackers | Full Stack Python | NHS Python | Pythonist Cafe | Hacker Earth | Discord Python



top