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.tar.gz (4.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django-model-admin-helper-0.2.macosx-10.6-intel.exe (67.4 kB view details)

Uploaded Source

File details

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

File metadata

File hashes

Hashes for django-model-admin-helper-0.2.tar.gz
Algorithm Hash digest
SHA256 84eb18d8c61608fa7ada052b0086adde8ed8f34a1cf70c35cb5b5e03f63ad858
MD5 f986f11f9b963255c60b5ed751a81c25
BLAKE2b-256 434780609a6462ac343ee5c425ddea06b27a6b8f836876d2a8be5f2d26e9d1b8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for django-model-admin-helper-0.2.macosx-10.6-intel.exe
Algorithm Hash digest
SHA256 ff76425b155d67470f71f8fa7bbcbbd69b40e3cc3b9bc73d0b7220ffa21b87fc
MD5 5a3801f1ac7e14e8a728be448c7019ba
BLAKE2b-256 77fb81498f356ac814c9ae75da55dd5106267bf57a4b7ee48288fecac2cad4f0

See more details on using hashes here.

Supported by

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