Package: django-extra-views
Django Extra Views - The missing class-based generic views for DjangoDjango-extra-views is a Django package which introduces additional class-based views
in order to simplify common design patterns such as those found in the Django
admin interface.Full documentation is available atread the docs.InstallationInstall the stable release from pypi (using pip):pipinstalldjango-extra-viewsOr install the current master branch from github:pipinstall-egit://github.com/AndrewIngram/django-extra-views.git#egg=django-extra-viewsThen add'extra_views'to yourINSTALLED_APPS:INSTALLED_APPS=[...'extra_views',...]FeaturesFormSetandModelFormSetviews - The formset equivalents ofFormViewandModelFormView.InlineFormSetView- Lets you edit a formset related to a model (using
Django’sinlineformset_factory).CreateWithInlinesViewandUpdateWithInlinesView- Lets you edit a
model and multiple inline formsets all in one view.GenericInlineFormSetView, the equivalent ofInlineFormSetViewbut forGenericForeignKeys.Support for generic inlines inCreateWithInlinesViewandUpdateWithInlinesView.Support for naming each inline or formset in the template context withNamedFormsetsMixin.SortableListMixin- Generic mixin for sorting functionality in your views.SearchableListMixin- Generic mixin for search functionality in your views.SuccessMessageMixinandFormSetSuccessMessageMixin- Generic mixins
to display success messages after form submission.Still to doAdd support for pagination in ModelFormSetView and its derivatives, the goal
being to be able to mimic the change_list view in Django’s admin. Currently this
is proving difficult because of how Django’s MultipleObjectMixin handles pagination.Quick ExamplesFormSetViewDefine aFormSetView, a view which creates a single formset fromdjango.forms.formset_factoryand adds it to the context.fromextra_viewsimportFormSetViewfrommy_formsimportAddressFormclassAddressFormSet(FormSetView):form_class=AddressFormtemplate_name='address_formset.html'Then withinaddress_formset.html, render the formset like this:<formmethod="post">...
  {{ formset }}
  ...<inputtype="submit"value="Submit"/></form>ModelFormSetViewDefine aModelFormSetView, a view which works asFormSetViewbut instead renders a model formset usingdjango.forms.modelformset_factory.fromextra_viewsimportModelFormSetViewclassItemFormSetView(ModelFormSetView):model=Itemfields=['name','sku']template_name='item_formset.html'CreateWithInlinesView or UpdateWithInlinesViewDefineCreateWithInlinesViewandUpdateWithInlinesView,
views which render a form to create/update a model instance and its related
inline formsets. Each of theInlineFormSetFactoryclasses use similar
class definitions as theModelFormSetView.fromextra_viewsimportCreateWithInlinesView,UpdateWithInlinesView,InlineFormSetFactoryclassItemInline(InlineFormSetFactory):model=Itemfields=['sku','price','name']classContactInline(InlineFormSetFactory):model=Contactfields=['name','email']classCreateOrderView(CreateWithInlinesView):model=Orderinlines=[ItemInline,ContactInline]fields=['customer','name']template_name='order_and_items.html'classUpdateOrderView(UpdateWithInlinesView):model=Orderinlines=[ItemInline,ContactInline]fields=['customer','name']template_name='order_and_items.html'Then withinorder_and_items.html, render the formset like this:<formmethod="post">...
  {{ form }}

  {% for formset in inlines %}
    {{ formset }}
  {% endfor %}
  ...<inputtype="submit"value="Submit"/></form>