Use django-suit to add a template for the django 1.7 admin background, django-suitdjango

Source: Internet
Author: User
Tags install django pip install django

Use django-suit to add a template for the django 1.7 admin background, django-suitdjango

It seems a bit problematic to use inline in django-grappelli. For another skin:

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

Django-suit Official Website
Installation Guide
Strategy

The translation is as follows:

Install

Copy codeThe Code is as follows:
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

Copy codeThe Code is as follows:
Python manage. py makemigrations
Python manage. py migrate
Python manage. py collectstatic

Congratulations! The basic installation is complete!

There are still 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 that can be used in the previous stage:
Example:

Datetime widget

Copy codeThe Code is as follows:
SuitDateWidget, SuitTimeWidget and 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,
}

Most of the above content is simplified to the official strategy. For more information, see.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.