skip to navigation
skip to content

django-adminextraviews 1.1.0

Mixin for adding class-based views to ModelAdmin


Mixin for adding class-based views to ModelAdmin.


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.


Install django-adminextraviews:

pip install django-adminextraviews


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})

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.


1.1.0 (2015-03-24)

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

1.0.0 (2015-03-19)

  • First release on PyPI.
File Type Py Version Uploaded on Size
django-adminextraviews-1.1.0.tar.gz (md5) Source 2015-03-24 7KB