Добавил капчу на форму регистрации

This commit is contained in:
NikDizell 2026-04-08 00:02:08 +03:00
parent f22849878b
commit 443d547f9d
3 changed files with 7 additions and 0 deletions

View File

@ -78,6 +78,7 @@ class ProfileForm(forms.ModelForm):
class RegistrationForm(UserCreationForm): class RegistrationForm(UserCreationForm):
captcha = TurnstileField(label='', theme='light', size='normal')
# Поля пользователя # Поля пользователя
first_name = forms.CharField( first_name = forms.CharField(
max_length=30, max_length=30,

View File

@ -30,6 +30,8 @@
{% bootstrap_field form.specialization %} {% bootstrap_field form.specialization %}
<button type="submit" class="btn btn-primary" style="width: 100%;">Зарегистрироваться</button> <button type="submit" class="btn btn-primary" style="width: 100%;">Зарегистрироваться</button>
<!-- {{ form.as_p }} -->
{{ form.captcha }}
</form> </form>
<hr> <hr>
<p class="text-center"> <p class="text-center">

View File

@ -228,6 +228,10 @@ class RegisterView(PageViewTrackingMixin, MenuContextMixin, SuccessMessageMixin,
}) })
return context return context
def __init__(self, *args, **kwargs):
self.request = kwargs.pop('request', None)
super().__init__(*args, **kwargs)
class ProfileEditView(LoginRequiredMixin, PageViewTrackingMixin, MenuContextMixin, BreadcrumbMixin, UpdateView): class ProfileEditView(LoginRequiredMixin, PageViewTrackingMixin, MenuContextMixin, BreadcrumbMixin, UpdateView):