conjunto.views
¶
conjunto.views.AnonymousRequiredMixin
¶
Bases: PermissionRequiredMixin
View mixin that only allows access for anonymous users.
conjunto.views.AutoPermissionsViewMixin
¶
Bases: PermissionRequiredMixin
Automatically uses view/create/change/delete permissions for the given model.
It automatically generates the "
| Attributes: |
|
|---|
conjunto.views.DialogType
¶
Bases: Enum
Enumeration of possible dialog levels.
Levels are used from Python's logging module
conjunto.views.DynamicHtmxFormViewMixin
¶
Bases: PrepopulateFormViewMixin
Mixin class for dynamic form views.
This mixin can be used with any FormView class to automatically prepopulate fields from GET parameters, and adds them to a "context" variable which is available within the form instance.
This view is intended to be used together with DynamicHtmxFormMixin for the
form_class.
It creates a form_id (if not given) and passes it to the form. This is needed as HTMX target id.
conjunto.views.GenericLicenseView
¶
Bases: LatestVersionMixin, DetailView
Generic privacy page view that displays the newest LicensePage.
conjunto.views.GenericPrivacyView
¶
Bases: LatestVersionMixin, DetailView
Generic privacy page view that displays the newest PrivacyPage.
conjunto.views.HtmxDeleteView
¶
Bases: HtmxFormMixin, DeleteView
Enhanced DeleteView that per default returns an empty HttpResponse.
TODO either use success_url, OR success_event.¶
| Attributes: |
|
|---|
conjunto.views.HtmxFormMixin
¶
Bases: HtmxResponseMixin
Mixin for a form view that uses HTMX.
Returns an "Hx-Trigger" attribute which triggers a Javascript event on the client.
| Attributes: |
|
|---|
conjunto.views.HtmxResponseMixin
¶
View Mixin to add HTMX functionality.
optionally checks if request originates from an HTMX request.
| Attributes: |
|
|---|
| Raises: |
|
|---|
conjunto.views.HtmxTemplateMixin
¶
If called from HTMX, this view renders template names with a "_htmx" suffix.
conjunto.views.LatestVersionMixin
¶
A mixin for views that require fetching the latest version of an object.
You can override the template in <your_app_name>/versioned_page.html.
| Attributes: |
|
|---|
conjunto.views.ModalCreateView
¶
Bases: PermissionRequiredMixin, ModalFormViewMixin, CreateView
Convenience CreateView (with permissions) that lives in a Modal.
It automatically generates the Modal title and sets the "create_
conjunto.views.ModalFormViewMixin
¶
Bases: HtmxFormMixin
Mixin for FormViews that should live in a modal.
It relies on crispy-forms intensively, and already provides a form helper instance attribute you can use.
In many cases, you need no template, as this mixin provides a generic one with
a customizable title. The form is generated using crispy-forms.
If you want to customize if further, then, extend "conjunto/modal-form.html".
This template uses a header with a title block, a body,
and a footer block to override, for your modal dialog. In the
footer, there is always a "Cancel" button, and as default, a "Save"
button, which you can override using the "footer" block.
When the modal pops up, the focus is set to the first visible input element.
You can customize the content of the "Save" button by changing the button_content
attribute to another string.
If the form is saved successfully, it returns an empty HttpResponse(204)
and emits the event specified in success_event on the client,
so that it can reload changed content.
autofocus_field = ''
class-attribute
instance-attribute
¶
The field that gets the autofocus when the modal is shown
button_content = _('Save')
class-attribute
instance-attribute
¶
The content of the 'Save' button
dialog_type: DialogType = DialogType.NOTSET
class-attribute
instance-attribute
¶
The type of the dialog: INFO,
form_layout: list = []
class-attribute
instance-attribute
¶
The crispy forms layout for the form
modal_title: str = ''
class-attribute
instance-attribute
¶
The title of the modal form
template_name = 'conjunto/modal-form.html'
class-attribute
instance-attribute
¶
The default template name for the modal form. This template provides a simple modal form. You can extend it in your own templates too.
get_modal_title()
¶
Returns a string that is used as title of the modal.
conjunto.views.ModalUpdateView
¶
Bases: _ModalModelViewMixin, UpdateView
Convenience UpdateView (with permissions) that lives in a Modal.
It automatically generates the Modal title and sets the "change_
conjunto.views.PrepopulateFormViewMixin
¶
A mixin class that prepopulates form fields with values from the request.GET parameters.
This mixin can be used with any FormView class to automatically prepopulate form fields with values from the URL query string parameters.
Example usage:
class MyFormView(PrepopulateFormMixin, FormView): form_class = MyForm template_name = 'my_template.html' success_url = reverse_lazy('my_success_url')
In the above example, the form fields will be prepopulated with values from the URL query string parameters when the form view is loaded.
get_initial()
¶
Returns the initial data for the form.
conjunto.views.clean_dict(input_dict)
¶
Clean the input dictionary by removing any key-value pairs where the value is "undefined".
:param input_dict: The input dictionary to be cleaned. :return: A dictionary with the same keys as the input dictionary, but with the "undefined" values removed.