Skip to content

Extendable, adaptable rewrite of django.contrib.admin

License

Notifications You must be signed in to change notification settings

brack3t/django-admin2

 
 

Repository files navigation

django-admin2

Build Status Coverage Status https://pypip.in/v/django-admin2/badge.png https://pypip.in/d/django-admin2/badge.png

One of the most useful parts of django.contrib.admin is the ability to configure various views that touch and alter data. django-admin2 is a complete rewrite of that library using modern Class-Based Views and enjoying a design focused on extendibility and adaptability. By starting over, we can avoid the legacy code and make it easier to write extensions and themes.

Full Documentation at: http://django-admin2.rtfd.org/

Features

  • Rewrite of the Django Admin backend
  • Drop-in themes
  • Built-in RESTful API

Screenshots

Site administration Select user

Requirements

Installation

Use pip to install from PyPI:

pip install django-admin2

Add djadmin2 and rest_framework to your settings file:

INSTALLED_APPS = (
    ...
    'djadmin2',
    'rest_framework', # for the browsable API templates
    'floppyforms', # For HTML5 form fields
    'crispy_forms', # Required for the default theme's layout
    ...
)

Add djadmin2 urls to your URLconf:

# urls.py
from django.conf.urls import patterns, include

import djadmin2

djadmin2.default.autodiscover()


urlpatterns = patterns(
   ...
   url(r'^admin2/', include(djadmin2.default.urls)),
)

How to write django-admin2 modules

# myapp/admin2.py
# Import your custom models
from django.contrib.auth.forms import UserCreationForm, UserChangeForm
from django.contrib.auth.models import User

from .models import Post, Comment

import djadmin2


class UserAdmin2(djadmin2.ModelAdmin2):
    # Replicates the traditional admin for django.contrib.auth.models.User
    create_form_class = UserCreationForm
    update_form_class = UserChangeForm


#  Register each model with the admin
djadmin2.default.register(Post)
djadmin2.default.register(Comment)
djadmin2.default.register(User, UserAdmin2)

Drop-In Themes

The default theme is whatever bootstrap is most current. Specifically:

# settings.py
ADMIN2_THEME_DIRECTORY = "djadmin2theme_default/"

If you create a new theme, you define it thus:

# settings.py
ADMIN2_THEME_DIRECTORY = "djadmin2/foundation/"

About

Extendable, adaptable rewrite of django.contrib.admin

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 96.3%
  • Shell 3.1%
  • JavaScript 0.6%