Skip to content

Commit d5df6a0

Browse files
authored
Rename BaseLoginForm.get_context to avoid clash with Django internals (#40)
In Django 4.0 `forms.Form.get_context` was introduced for passing form context in templates. https://docs.djangoproject.com/en/4.0/ref/forms/api/#django.forms.Form.get_context Due to this we have a clash, as django-mail-auth uses function with the same name, but for different purpose: ```python BaseLoginForm.get_context() missing 2 required positional arguments: 'request' and 'user' ```
1 parent 1d4c869 commit d5df6a0

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

mailauth/forms.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def get_token(self, user):
4242
"""Return the access token."""
4343
return MailAuthBackend.get_token(user=user)
4444

45-
def get_context(self, request, user):
45+
def get_mail_context(self, request, user):
4646
"""
4747
Return the context for a message template render.
4848
@@ -118,7 +118,7 @@ def save(self):
118118
"""
119119
email = self.cleaned_data[self.field_name]
120120
for user in self.get_users(email):
121-
context = self.get_context(self.request, user)
121+
context = self.get_mail_context(self.request, user)
122122
self.send_mail(email, context)
123123

124124
def send_mail(self, to_email, context):

0 commit comments

Comments
 (0)