This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

Django’s admin accepts callables for list_display and readonly_fields. In order to customize these callables (e.g. annotate them with a description) django requires developer to set an attribute on a callable (e.g. ‘short_description’). This is a simple approach and it works.

But it is easy to make a typo or to forget what attribute should be set on a callable because there is no autocompletion.

This app provides an alternative (decorator) syntax for that + a couple of other decorators useful for customizing django admin.


pip install django-admin-decorators


from django.contrib import admin
from admin_decorators import (short_description, limit_width, boolean,
                               apply_filter, order_field, allow_tags)
from myapp.models import MyModel

class MyModelAdmin(admin.ModelAdmin):
    list_display = 'name', '_text', 'has_huge_text', 'html_url'
    readonly_fields = ['name', 'html_url']

    @short_description('The text limited to 100 chars')
    def _text(self, obj):
        return obj.text

    @short_description('The text is huge')
    def has_huge_text(self, obj):
        return len(obj.text) > 100

    def html_url(self, obj):
        return obj.url, MyModelAdmin)

Note that allow_tags decorator marks result as safe so it will be html both in list_display and readonly_fields.

Take a look at source code for more decorators.


Development happens at bitbucket and github.

If you’ve found a bug or have an idea for a new decorator feel free to open a ticket and/or send a pull request.

Release History

Release History


This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
django-admin-decorators-0.1.tar.gz (3.6 kB) Copy SHA256 Checksum SHA256 Source Mar 5, 2012

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting