Skip to main content

Admin helpers

Project description

Django Model Admin Helpers

Link to repository: https://github.com/Arpaso/django-model-admin-helper

Provides classes to extend default django admin functionality:

  • ButtonableModelAdmin

  • ModelAdminWithForeignKeyLinksMetaclass - adds clickable foreign key links at admin interface in list view; Uses list_display fields to try adding link to the field in list item.

  • AdminURLMixin - provides ability to extend /admin/ urls and make views to urls like: /admin/myurl.

Usage

admin.py:

from admin_helpers import ButtonableModelAdmin, AdminURLMixin, ModelAdminWithForeignKeyLinksMetaclass

class MyModelAdmin(AdminURLMixin, ButtonableModelAdmin):
    __metaclass__ = ModelAdminWithForeignKeyLinksMetaclass

    list_display = ('title', 'link_to_user') # user is a foreignkey field of the MyModel

    def get_urls(self):
        urls = super(MyModelAdmin, self).get_urls()
        my_urls = patterns('',
            (r'^my_view/$', self.my_view)
        )
        return my_urls + urls

    def my_view(self, request):
        # custom view which should return an HttpResponse
        pass

Note: Notice that the custom patterns are included before the regular admin URLs: the admin URL patterns are very permissive and will match nearly anything, so you’ll usually want to prepend your custom URLs to the built-in ones. In this example, my_view will be accessed at /admin/myapp/mymodel/my_view/ (assuming the admin URLs are included at /admin/.)

Written by the development team of Arpaso company: http://arpaso.com

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-model-admin-helper-0.2.1.tar.gz (4.0 kB view details)

Uploaded Source

Built Distribution

File details

Details for the file django-model-admin-helper-0.2.1.tar.gz.

File metadata

File hashes

Hashes for django-model-admin-helper-0.2.1.tar.gz
Algorithm Hash digest
SHA256 bc3cf1722362aee2e9e67c6c42dcb82c5b60c549eb57a6197f8247eccfd68686
MD5 4ee8227d9a6041865ffdb66427947592
BLAKE2b-256 5a6d61c40cfb471dab4820ec910efe9ccf9a59f9590eea4f227eb160e7f29af1

See more details on using hashes here.

File details

Details for the file django-model-admin-helper-0.2.1.macosx-10.6-intel.exe.

File metadata

File hashes

Hashes for django-model-admin-helper-0.2.1.macosx-10.6-intel.exe
Algorithm Hash digest
SHA256 d7aa99c40b948bcf8f99ab5d64c251b880ea9350eea6a14504c02e1ba614eb85
MD5 f7250a85dafa4ef2ce9892d52c1a4e8f
BLAKE2b-256 665fd44ec0b9f0370f3151d3c0d9897efc9e2cf3c335e3bbe98e59287362d3d5

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page