Registry / web-framework / django-extra-views

django-extra-views

JSON →
library0.16.0pypypi✓ verified 86d ago

Django Extra Views provides a collection of useful, advanced class-based views for Django, extending the built-in generic views. It's particularly strong for handling complex formsets and inlines. The current version is 0.16.0, and releases are typically feature-driven, providing new views or compatibility updates for Django.

pip install django-extra-views
INSTALL
IMPORT
SIG · DJANGO-EXTRA-VIEWS
D
django-extra-views
web-frameworkpythonv0.16.0
Install
3.4s avg
Import
830ms
Disk
66MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.16.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.920 runs
installs and imports cleanly · install 0.0s · import 0.885s · 66.4MB
glibc
py 3.103.920 runs
installs and imports cleanly · install 3.4s · import 0.774s · 67MB
66MB installed
● package 66MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

InlineFormSetView
from extra_views import InlineFormSetView
CreateWithInlinesView
from extra_views import CreateWithInlinesView
UpdateWithInlinesView
from extra_views import UpdateWithInlinesView
ModelFormSetView
from extra_views import ModelFormSetView
SearchableListMixin
from extra_views import SearchableListMixin

This quickstart demonstrates how to use `CreateWithInlinesView` to create a parent object along with its related child objects in a single form. It defines a `Parent` model and a `Child` model, then sets up an `InlineFormSetFactory` for `Child` and integrates it into `CreateWithInlinesView`. Remember to define corresponding URL patterns and templates in your Django project.

from django.db import models from django.views.generic import ListView from extra_views import CreateWithInlinesView, InlineFormSetFactory # models.py example class Parent(models.Model): name = models.CharField(max_length=100) def __str__(self): return self.name class Child(models.Model): parent = models.ForeignKey(Parent, on_delete=models.CASCADE) item = models.CharField(max_length=100) def __str__(self): return f'{self.item} ({self.parent.name})' # views.py example class ChildInline(InlineFormSetFactory): model = Child fields = ['item'] factory_kwargs = {'extra': 1} class CreateParentWithChildrenView(CreateWithInlinesView): model = Parent fields = ['name'] inlines = [ChildInline] template_name = 'parent_create_with_children.html' success_url = '/parents/' # Or reverse_lazy('parent-list') # urls.py example # from django.urls import path # from .views import CreateParentWithChildrenView # # urlpatterns = [ # path('parents/create/', CreateParentWithChildrenView.as_view(), name='parent-create-with-children'), # ] # parent_create_with_children.html (simplified fragment) # <form method="post"> # {% csrf_token %} # {{ form.as_p }} # <h3>Children</h3> # {{ inlines.childinline.management_form }} # {% for formset in inlines.childinline %} # {{ formset.as_p }} # {% endfor %} # <button type="submit">Save</button> # </form> # To make this runnable, we need a minimal Django setup. # For testing purposes, you could try: # from django.conf import settings # if not settings.configured: # settings.configure(DEBUG=True, INSTALLED_APPS=['django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.admin', 'django.contrib.messages'], DATABASES={'default': {'ENGINE': 'django.db.backends.sqlite3', 'NAME': ':memory:'}}) # import django # django.setup() # # Then define Parent and Child models and run migrations implicitly. # from django.core.management import call_command # call_command('makemigrations', 'your_app_name', interactive=False) # call_command('migrate', interactive=False) # # This example is primarily for demonstrating the view setup.
Debug
Known issues
breakingDjango 2.x support was dropped in version 0.13.0. Projects using older Django versions (2.x) will need to upgrade Django to >=3.2 or stick to an older `django-extra-views` release (<0.13.0).
fix
Upgrade your Django project to version 3.2 or higher. Alternatively, pin `django-extra-views` to a compatible version like `django-extra-views<0.13`.
affects: >=0.13.0
breakingThe `SortableListMixin.get_queryset` method signature changed in version 0.10.0, adding an `ordering` parameter. If you override this method in your custom views, your existing implementation will break.
fix
Update your custom `get_queryset` method to accept the new `ordering` parameter: `def get_queryset(self, ordering=None): ...`. Ensure your logic handles the `ordering` parameter or passes it appropriately to the super method.
affects: >=0.10.0
deprecatedThe `FormSetFactory` class was removed in version 0.9.0. If you were directly using `FormSetFactory` to create formsets, you will need to refactor your code.
fix
Migrate to `InlineFormSetFactory` or use Django's built-in `inlineformset_factory` if `FormSetFactory` was used for model-based formsets. For non-model formsets, use Django's `formset_factory` directly.
affects: >=0.9.0
gotchaWhen using `SearchableListMixin`, `SearchableList` or `SortableListMixin`, `django-filter` must be installed. For `SearchableListMixin`, make sure to also define `search_fields`.
fix
Install `django-filter` via `pip install django-filter` and ensure your view or mixin has a `search_fields` attribute defined, e.g., `search_fields = ['name__icontains']`.
affects: All versions (where applicable)
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'extra_views.mixins'
Attempting to import from old submodule paths. In recent versions, most components are available directly under the `extra_views` namespace.
fix
Change your import statement from `from extra_views.mixins import SearchableListMixin` to `from extra_views import SearchableListMixin`.
ImproperlyConfigured: One of 'form_class', 'model' should be set for FormSetFactory.
You are using `InlineFormSetFactory` (or an older `FormSetFactory`) but have not specified either the `model` attribute (for model-based formsets) or `form_class` (for custom forms).
fix
Ensure your `InlineFormSetFactory` class explicitly defines `model = YourRelatedModel` or `form_class = YourCustomForm`.
django.core.exceptions.ImproperlyConfigured: ListView is missing a QuerySet. Define .model, .queryset, or override .get_queryset().
This error can occur with list-based views (e.g., `SortableListMixin` or `SearchableListMixin` when combined with a `ListView`) if you forget to specify the base queryset or model for the view.
fix
Ensure your view class has `model = YourModel` or `queryset = YourModel.objects.all()` defined, or that you override `get_queryset` correctly.
Upgrade
Version history
0.16.0latest on PyPI · released Apr 22, 2025
Audit
Dependencies
Django>=3.2requiredCore dependency for all views and mixins.
django-filter>=2.0optionalRequired for `SearchableListMixin` to enable filtering capabilities.
Agent activity
4 hits · last 30 days
node
4
Resources
django-extra-views — pip install django-extra-views · libregistry