Dino Geek, try to help you

How to use the Django administration interface?


Django Administration Interface, also known as Django Admin, is a powerful built-in tool that allows you to easily manage content on your site. It’s a versatile and secure way to manage your website’s content and users. It’s automatically generated with each Django project and includes user authentication, groups, and permissions [1].

Before beginning, make sure Django is installed correctly.

1. Setting up Admin Panel: To enable Django Admin for an app, the app needs to be included in the `INSTALLED_APPS` setting in the project’s setting.py file [2]. The instant Django project is set up, the admin panel is active by default. You can access it via `http://localhost:8000/admin/`.

1. Create ‘Superuser’: To access the Django admin interface you need to create a ‘superuser’ – an account that has total control over all things in the site. To create a superuser, open your terminal and type `python manage.py createsuperuser` and fill in the details requested [3].

1. Register Models in `admin.py`: To make your model editable in the Django admin, you should register it in `admin.py`. For instance, if you have created a model called ‘Programmer’ in your `models.py` file, you would need to include it in your `admin.py` file as such:

```
from django.contrib import admin
from .models import Programmer

admin.site.register(Programmer)
```
Now, when you access your Django admin interface, you would be able to add, delete, and edit ‘Programmer’ objects.

1. Customize Django Admin interface: The Django Admin interface is very flexible and can be tailored to your needs [4]. You can modify how the data is displayed, create and modify forms, filter data, etc. For instance, you can modify your `admin.py` file to include ’list\_display’ attribute to change how your model objects are displayed, as such:

```
class ProgrammerAdmin(admin.ModelAdmin): list_display = (‘name’, ‘language’, ‘experience’)

admin.site.register(Programmer, ProgrammerAdmin)
```
This will display the ‘name’, ‘language’, and ‘experience’ fields of each ‘Programmer’ object in the Django admin interface.

Sources:
1. Django Project Documentation: https://docs.djangoproject.com/en/2.2/ref/contrib/admin/
2. Django for Beginners by William S. Vincent (Chapter 16)
3. Django for Professionals by William S. Vincent (Chapter 9)
4. Django Central: https://djangocentral.com/creating-super-user-in-django/


Simply generate articles to optimize your SEO
Simply generate articles to optimize your SEO





DinoGeek offers simple articles on complex technologies

Would you like to be quoted in this article? It's very simple, contact us at dino@eiki.fr

CSS | NodeJS | DNS | DMARC | MAPI | NNTP | htaccess | PHP | HTTPS | Drupal | WEB3 | LLM | Wordpress | TLD | Domain name | IMAP | TCP | NFT | MariaDB | FTP | Zigbee | NMAP | SNMP | SEO | E-Mail | LXC | HTTP | MangoDB | SFTP | RAG | SSH | HTML | ChatGPT API | OSPF | JavaScript | Docker | OpenVZ | ChatGPT | VPS | ZIMBRA | SPF | UDP | Joomla | IPV6 | BGP | Django | Reactjs | DKIM | VMWare | RSYNC | Python | TFTP | Webdav | FAAS | Apache | IPV4 | LDAP | POP3 | SMTP

| Whispers of love (API) | Déclaration d'Amour |






Legal Notice / General Conditions of Use