Skip to main content

django-adminextraviews

https://travis-ci.org/fusionbox/django-adminextraviews.png?branch=master

Mixin for adding class-based views to ModelAdmin.

Why

Class-based views are really useful, but it’s difficult to add them to the admin center. This makes it easy to add class-based views to the Django admin.

Installation

Install django-adminextraviews:

pip install django-adminextraviews

Usage

Add the ExtraViewsMixin to your ModelAdmin and define the extra_views attribute.

from adminextraviews import ExtraViewsMixin

class MyModelAdmin(ExtraViewsMixin, admin.ModelAdmin):
    extra_views = [
        ('login_as_user', r'(?P<pk>\d+)/login/', LoginAsUserView),
    ]

Now you can use it like a normal view, you can reverse it.

>>> urlresolvers.reverse('admin:myapp_mymodel_login_as_user', kwargs={'pk': 12})
'/admin/myapp/mymodel/12/login/'

If your view is a subclass of ModelFormMixin (like CreateView, UpdateView), ExtraViewsMixin will wrap the form class with the admin center widgets. It will also set the model attribute if it’s not set.

Changelog

1.1.0 (2015-03-24)

  • Allow for use of different models [#1].

1.0.0 (2015-03-19)

  • First release on PyPI.

Release files for django-adminextraviews 1.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-adminextraviews 1.1.0
File Size Uploaded
django-adminextraviews-1.1.0.tar.gz 7.7 kB Details

Release files / django-adminextraviews-1.1.0.tar.gz

Download URL django-adminextraviews-1.1.0.tar.gz
Size 7.7 kB
Tags Source
SHA-256 checksum
How to use checksums
da36fdd1e46816454c7f3c09b0713d90c89265eb76e922203c9ed0e24ea526ee
BLAKE2b-256 checksum
How to use checksums
c577b11dddeb8be487db69f41624144e9fa4e912cec10eeb9dc07336b024ea7a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

1.1.0 This release

1 release file

1.0.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page