View classes¶
There are just two essential views in django-latch: one for letting
a user configure the latch and another for unpairing it.
- class django_latch.views.PairLatchView(**kwargs)[source]¶
Implement the pairing operation for an authenticated and unpaired user.
It is a subclass of
UnpairedUserRequiredMixin, so only authenticated users without the latch configured can access it.- form_valid(form)[source]¶
If the form is valid, attempt to pair the user account to the Latch service and redirect to the success URL. If a
django_latch:exceptions.PairingLatchErroris raised, instead re-render the form and include information about the error in the template context.- Parameters:
form (django_latch.forms.PairLatchForm) – The token form to use.
- class django_latch.views.UnpairLatchView(**kwargs)[source]¶
Implement the unpairing operation for a authenticated paired user.
It is a subclass of
PairedUserRequiredMixin, so only authenticated users with the latch configured can access it.