18 lines
568 B
Python
18 lines
568 B
Python
from djeveric import Confirmation
|
|
from userausfall.emails import ConfidantConfirmationEmail
|
|
from userausfall.models import User
|
|
|
|
|
|
class ConfidantConfirmation(Confirmation):
|
|
email_class = ConfidantConfirmationEmail
|
|
|
|
def has_permission(self, user: User, resource: User):
|
|
return user == resource.confidant_unconfirmed
|
|
|
|
def is_confirmed(self, resource: User):
|
|
return resource.confidant_unconfirmed == resource.confidant
|
|
|
|
def confirm(self, resource: User):
|
|
resource.confidant = resource.confidant_unconfirmed
|
|
resource.save()
|