Code Monkey home page Code Monkey logo

django-admin-utils's Introduction

django-admin-utils

Travis-CI Build Status

AppVeyor Build Status

Coverage Status

PYPI Package

PYPI Package

Utility code and patterns.

Requirements

OS

Any

Runtime

Python 2.6, 2.7, 3.2, 3.3 or PyPy

Packages

Django>=1.4 (including 1.7); Django>=1.1 probably works but it's not tested, those releases should not be used (they are insecure).

Terse admin.py

from django.contrib import admin
from admin_utils import register, inline

from .models import MyModel, OtherModel

@register(MyModel)
class MyModelAdmin(admin.ModelAdmin):
    inlines = inline(OtherModel),

If you want custom admin sites:

customsite = admin.AdminSite()

@register(MyModel, site=customsite)
class MyModelAdmin(admin.ModelAdmin):
    inlines = inline(OherModel),

Mock admin (mount your views in admin using model wrappers)

Have you ever wanted a page in the admin that appears in the app list but you don't have any models ? Now you can have that without patching up the admin Site or the templates. Just put this in your admin.py:

from django.conf.urls import patterns, url
from admin_utils import make_admin_class

make_admin_class("Test1", patterns("test_app.views",
    url(r'^$', 'root', name='test_app_test1_changelist'),
    url(r'^level1/$', 'level1', name='level-1'),
    url(r'^level1/level2/$', 'level2', name='level-2'),
), "test_app")

To use different admin site:

make_admin_class("Test1", patterns("test_app.views",
    url(r'^$', 'root', name='test_app_test1_changelist'),
    url(r'^level1/$', 'level1', name='level-1'),
    url(r'^level1/level2/$', 'level2', name='level-2'),
), "test_app", site=customsite)

Admin mixins

admin_utils.mixins.FoldableListFilterAdminMixin

Adds nice filter toggling with cookie support. Largely based on django-foldable-list-filter but without the transition effect and no pictures.

Example:

from admin_utils.mixins import FoldableListFilterAdminMixin

class MyModelAdmin(FoldableListFilterAdminMixin, admin.ModelAdmin):
    pass

Looks like this:

Screenshort of FoldableListFilterAdminMixin

admin_utils.mixins.FullWidthAdminMixin

Make the changelist expand instead of having the width of the windows and having that nasty inner scrollbar. You never gonna notice that if your table is long !

Example:

from admin_utils.mixins import FoldableListFilterAdminMixin

class MyModelAdmin(FoldableListFilterAdminMixin, admin.ModelAdmin):
    pass

You probably didn't even notice you had this problem:

Screenshort of FullWidthAdminMixin

django-admin-utils's People

Contributors

ionelmc avatar suvit avatar bitdeli-chef avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.