Add a template for Django 1.7 admin background (use Django suit)

Time:2021-11-13

There seems to be a problem with using inline in Django Grappelli. Change the skin:

Django suit is the second admin skin recommended by 2scoops
Supports: Django 1.4-1.7. Python: 2.6-3.
The environment of this article is Django 1.7.1

Django suit official website
Installation guide link
Set strategy

The translation is as follows:

install

pip install django-suit

# settings.py
from django.conf.global_settings import TEMPLATE_CONTEXT_PROCESSORS as TCP

TEMPLATE_CONTEXT_PROCESSORS = TCP + (
'django.core.context_processors.request',

)

terminal

python manage.py makemigrations
python manage.py migrate
python manage.py collectstatic

congratulations! Basic installation is complete!

There are many detailed settings in the official strategy. I found that this plug-in is not only for background services, but also comes with many form widgets, which can also be used well in the foreground:
Examples are as follows:

datetime widget

SuitDateWidget, SuitTimeWidget and SuitSplitDateTimeWidget extends original admin widgets by adding some additional output styling only. Widgets still uses same original JavaScript for calendar and time. You can see example in Demo app: User changeform:

from django.forms import ModelForm
from suit.widgets import SuitDateWidget, SuitTimeWidget, SuitSplitDateTimeWidget

class UserChangeForm(UserChangeForm):
    class Meta:
        model = User
        widgets = {
            'last_login': SuitSplitDateTimeWidget,
            'date_joined': SuitSplitDateTimeWidget,
        }

Add a template for Django 1.7 admin background (use Django suit)

Recommended Today

Summary of basic knowledge points of react

Contents of this document: 1. React entrance 2. JSX syntax 3. Components 4. Use setstate correctly 5. Life cycle 6. Component composition 7.redux 8.react-redux 9.react-router 10.PureComponent 11. Know hook 12. Customize hook and hook usage rules 13. Usememo and usecallback of hook API Reference website:https://zh-hans.reactjs.org/docs/getting-started.html 1. React entrance start Create project: NPX create react app […]