{% extends 'doc/en/base.html' %} {% load static %} {% block content %} {% verbatim %}

# CRUD

    from Book.models import Author, Book
    from blitz_work.blitzcrud import BlitzCRUD

    class BookCRUD(BlitzCRUD):
        show_title = True
        show_caption = False
        caption_is_title = True
        extend_template = "base.html"
        data = Book

Blitz Work provides many options to facilitate its use and visualization.

    class BlitzCRUD(View):
        template_name = "blitz_base_crud.html"
        extend_template = "blitz_base_offline.html"
        table_template = "blitz_crud_table.html"
        create_template = "blitz_crud_create.html"
        update_template = "blitz_crud_update.html"
        delete_template = "blitz_crud_delete.html"
        detail_template = "blitz_crud_detail.html"
        model = None
        paginate_by = 20
        title = None
        form = None
        formset = None
        show_caption = True
        create_title = "Create"
        show_title = True
        caption_is_title = False
        concat_function = default_concatenation
        exclude = ['id', ]
        dark_mode_switch_label = None
        delete_messages = {"success": "Element deleted",
                           "error": "Error on delete"}
        delete_title = "Delete"
        update_title = "Edit"
        detail_title = "Detail"
        delete_text = "The following elements will be deleted, do you want to delete them?"
        crud_buttons = {"add": "Add", "create": "Create", "details": "Details", "update": "Update",
                        "edit": "Edit", "delete": "Delete", "cancel": "Cancel", "return": "Return", "search": "Search"}
        allow_anonimous_in_debug = True

#### Template variables.

- ##### template_name

  Main template.This is the template that renders the list view. Must contain the search buttons, add, edit, delete, cancel and details as well as The data table.

- ##### extend_template

  This is the template that will be used as a basis all the views of not being modified. Its value will be that of the variable (extend_template) on the templates that provides Blitz Work

- ##### table_template

  This is the template that will be used to show the table in the list view of Do not be modified.

- ##### create_template

  This is the template that will be used for the creating view.

- ##### update_template

  This is the template that will be used for the update view.

- ##### delete_template

  This is the template that will be used for the delete view.

- ##### detail_template

  This is the template that will be used for the details view.

#### Data variables and list.

- ##### model

  Specifies the model that CRUD uses.

- ##### paginate_by

  Specifies the number of rows per page in the crud.

- ##### form

  Specifies the form that will be used for the Add to Crud view. If it is not specified Blitz Work will create a default form with all Fields of the model.

- ##### formset

  Specifies the form set that will be used for the edit view and details In CRUD.If not specified Blitz Work will create one by default with all Fields of the model.(Blitz Work provides multiple edition and view Of multiple details, this is why it is necessary.).

- ##### concat_function

  Specifies the function that will be used to concatenate the elements in a relationship (M2M), In the list view.If it is not specified Blitz Work will use the following function.

      def default_concatenation(self, list):
          """
          Default concatenation function
          """
          return ", ".join(list)

- ##### exclude

  Specify the fields that will be excluded from the model in the table.

- ##### allow_anonimous_in_debug

  Blitz WorkChecksIfTheUserHasPermissionsForEachOfThe viewsAndActionsThisVariableAllowsAUserWithoutAuthenticatingToSkipTheRestrictions. thisIsOnlyIfTheCurrentProjectIsInDebugMode

#### Text variables and titles.

- ##### title

  Specifies the title of the list view into the crud.

- ##### create_title

  Specifies the title of the creation view on the crud.

- ##### update_title

  Specifies the title of the actulating view in the crud.

- ##### detail_title

  Specifies the title of the details view in the crud.

- ##### delete_title

  Specifies the title of the disposal view on the crud.

- ##### delete_text

  Specifies the message from the removal view on the crud.

- ##### delete_messages

  Specify the text of crude removal messages.

- ##### crud_buttons

  Specify the text of the crud buttons.

- ##### show_title

  Specifies whether the title is displayed in the crude list view.

- ##### show_caption

  Specifies whether the description of the crud table is displayed.Its courage courage to the verbose_name of the model.

- ##### caption_is_title

  Specifies whether the verbose_name of the model will be used as a title.

- ##### dark_mode_switch_label

  Specifying dark mode switch text.

{% endverbatim %} {% endblock content %}