From 3855fb28d75ab3544058a6783ea06bb3422156e7 Mon Sep 17 00:00:00 2001 From: Commander1024 Date: Thu, 24 Dec 2020 20:25:05 +0100 Subject: [PATCH] Rename ExplorerCreationForm to SignupVoucherForm. --- django_lostplaces/lostplaces/forms.py | 2 +- .../lostplaces/tests/forms/test_explorer_forms.py | 10 +++++----- django_lostplaces/lostplaces/views/views.py | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/django_lostplaces/lostplaces/forms.py b/django_lostplaces/lostplaces/forms.py index fd0e423..9e622b2 100644 --- a/django_lostplaces/lostplaces/forms.py +++ b/django_lostplaces/lostplaces/forms.py @@ -10,7 +10,7 @@ from django.contrib.auth.models import User from django.utils.translation import ugettext_lazy as _ from lostplaces.models import Place, PlaceImage, Voucher -class ExplorerCreationForm(UserCreationForm): +class SignupVoucherForm(UserCreationForm): class Meta: model = User fields = ('username', 'email', 'first_name', 'last_name') diff --git a/django_lostplaces/lostplaces/tests/forms/test_explorer_forms.py b/django_lostplaces/lostplaces/tests/forms/test_explorer_forms.py index 89b6986..a2a0d25 100644 --- a/django_lostplaces/lostplaces/tests/forms/test_explorer_forms.py +++ b/django_lostplaces/lostplaces/tests/forms/test_explorer_forms.py @@ -4,15 +4,15 @@ from django import forms from django.utils import timezone from lostplaces.tests.forms import FormTestCase -from lostplaces.forms import ExplorerCreationForm +from lostplaces.forms import SignupVoucherForm from lostplaces.models.models import Voucher -class ExplorerCreationFormTestCase(FormTestCase): +class SignupVoucherFormTestCase(FormTestCase): """ This test case only tests for the voucher since all other aspects don't realy matter to this project and are already tested by django """ - form = ExplorerCreationForm + form = SignupVoucherForm @classmethod def setUpTestData(cls): @@ -37,7 +37,7 @@ class ExplorerCreationFormTestCase(FormTestCase): ) def test_validation_valid(self): - form = ExplorerCreationForm(self.post_data) + form = SignupVoucherForm(self.post_data) self.assertTrue( form.is_valid(), msg='Expecting the %s to validate' % ( @@ -49,7 +49,7 @@ class ExplorerCreationFormTestCase(FormTestCase): self.post_data = { 'voucher': 'Imanotacode123' } - form = ExplorerCreationForm(self.post_data) + form = SignupVoucherForm(self.post_data) self.assertFalse( form.is_valid(), msg='Expecting the %s to not validate' % ( diff --git a/django_lostplaces/lostplaces/views/views.py b/django_lostplaces/lostplaces/views/views.py index 03982ad..21320b8 100644 --- a/django_lostplaces/lostplaces/views/views.py +++ b/django_lostplaces/lostplaces/views/views.py @@ -11,7 +11,7 @@ from django.shortcuts import render, redirect, get_object_or_404 from django.http import HttpResponseForbidden from django.utils.translation import ugettext_lazy as _ -from lostplaces.forms import ExplorerCreationForm, TagSubmitForm +from lostplaces.forms import SignupVoucherForm, TagSubmitForm from lostplaces.models import Place, PhotoAlbum from lostplaces.views.base_views import IsAuthenticatedMixin @@ -23,7 +23,7 @@ from lostplaces.views.base_views import ( from taggit.models import Tag class SignUpView(SuccessMessageMixin, CreateView): - form_class = ExplorerCreationForm + form_class = SignupVoucherForm success_url = reverse_lazy('login') template_name = 'signup.html' success_message = _('User created')