There's a lot of various views in AMY, but some of them share common behavior. Since they are implemented in OOP (object-oriented programming), it was possible to extract common behaviours in form of class mixins. They are described below.
Mixins and base views¶
This mixin was designed to support triggering actions (from
automated emails project) by inheriting from it
in class-based views, but as it turned out this is never used. Its
static methods are used quite often, on the other hand.
This mixin should be redesigned to a controller or helper class.
This mixin is used in views:
The purpose is to provide initial values (like event start, end dates, tags, curricula,
public status, and contact information). Most of these values are the same for all 3
views, but in some corner cases they are located differently. For example, in
SelfOrganisedSubmission model there's a relation to curricula called
WorkshopInquiryRequest the same relation is called
AMYCreateView extended with fetching
a different object based on URL parameter.
Useful when there's a need to create an object related to another existing object, e.g.
to create an event from a
A small mixin fetching membership based on URL parameter on every request.
A mixin based on
FormView but intended for handling
formsets containing multiple membership-related objects (e.g. membership member
organisations and their roles, or membership tasks).
Used when URL slug field, needed to access the object represented by that field, may contain characters requiring unquoting. This is used by 3 organisation-related views (details, update, delete).
Add an error message on invalid form submission.
Almost a direct, not extended descendant of
with one small exception: it contains type annotation for
object attribute of the
Class-based view for creating objects that extends default template context by adding model class used in objects creation. Additionally defines default form template, default form helper, default title, default success message, and default invalid form message.
Class-based view for updating objects that extends default template context by adding proper page title.
Provides the same changes as
Class-based view for deleting objects that additionally handles
when attempting to delete a foreign-referenced object). Blocks
Not used, should be removed.
Used for sending emails when forms pass validation upon
Implements a safe redirect after form is submitted.
Supports populating some form fields with values, e.g. from
Automatically emails the form sender.
Small mixin used to change default filter value for
state field (sets it to pending).
Almost standalone view used by
SelfOrganisedSubmission to change request state (to accepted, discarded, or pending).
Almost standalone view used to assign specific person to
Mixin for enabling views based on feature flag.
Contains a pre-defined test function checking if user is authenticated and if user is considered an administrator.
OnlyForAdminsMixin, but will
not redirect to the login page when test function fails, but instead will throw
"permissions denied" exception.
Empty class to indicate that specific view is open to public, and doesn't need any permission checking.