# Views

Source is located in the `generic`, which we’ll describe here.

Crudlfa+ generic views and mixins.

Crudlfa+ takes views further than Django and are expected to:

- generate their URL definitions and reversions,
- check if a user has permission for an object,
- declare the names of the navigation menus they belong to.

class `crudlfap.views.generic.``CreateView`(**kwargs)

  View to create a model object.

class `crudlfap.views.generic.``DefaultTemplateMixin`

  Override for get_template_names to append default_template_name.

  This allows to configure “last resort” templates for each class, and thus to provide a working CRUD out of the box.

  `get_template_names`()

    Give a chance to default_template_name.

  `get_title_heading`()

    Return text for page heading.

  `get_title_html`()

    Return text for HTML title tag.

class `crudlfap.views.generic.``DeleteView`(**kwargs)

  View to delete a model object.

class `crudlfap.views.generic.``DetailView`(**kwargs)

  Templated model object detail view which takes a field option.

  `get_context_data`(*a, **k)

    Insert the single object into the context dict.

  classmethod `get_urlregex`()

    Identify the object by slug or pk in the pattern.

class `crudlfap.views.generic.``FormView`(**kwargs)

  Base FormView class.

class `crudlfap.views.generic.``FormViewMixin`

  Mixin for views which have a Form.

class `crudlfap.views.generic.``ListView`(**kwargs)

  Model list view.

  `get`(*a, **k)

    Enforce sane default paginate_by if not False.

  `get_paginate_by`(queryset=None)

    Get the number of items to paginate by, or `None` for no pagination.

class `crudlfap.views.generic.``ModelFormViewMixin`

  ModelForm ViewMixin using readable

class `crudlfap.views.generic.``ModelViewMixin`

  Mixin for views using a Model class but no instance.

  `get_queryset`()

    Return router.get_queryset() by default, otherwise super().

class `crudlfap.views.generic.``ObjectFormView`(**kwargs)

  Custom form view on an object.

class `crudlfap.views.generic.``ObjectFormViewMixin`

  Custom form view mixin on an object.

class `crudlfap.views.generic.``ObjectMixin`

  Make self.object call and cache self.get_object() automatically.

  WHAT A RELIEF

  However, if it has a router with the get_object() method, use it.

  `get_object`()

    Return router.get_object() by default, otherwise super().

  `object`

    Return the object, uses get_object() if necessary.

  `object_get`()

    Return the object, uses get_object() if necessary.

  `object_set`(value)

    Set self.object attribute.

class `crudlfap.views.generic.``ObjectView`(**kwargs)

class `crudlfap.views.generic.``ObjectViewMixin`

  Mixin for views using a Model instance.

  `get_slug_field`()

    Replace Django’s get_slug_field with get_url_field.

  `get_urlargs`()

    Return list with object’s urlfield attribute.

  classmethod `get_urlregex`()

    Identify the object by slug or pk in the pattern.

  `slug_url_kwarg`

    Replace Django’s slug_url_kwarg with get_url_field.

  classmethod `to_url_args`(*args)

    Return first arg’s url_field attribute.

class `crudlfap.views.generic.``UpdateView`(**kwargs)

  Model update view.

class `crudlfap.views.generic.``View`(**kwargs)

  Base view for CRUDLFA+.

class `crudlfap.views.generic.``ViewMixin`

  Base View mixin for CRUDLFA+.

  If you have any question about style then find your answers in DefaultTemplateMixin, otherwise in RoutableViewMixin.