Rename ExplorerCreationForm to SignupVoucherForm.
This commit is contained in:
parent
3a20a60f05
commit
3855fb28d7
@ -10,7 +10,7 @@ from django.contrib.auth.models import User
|
|||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
from lostplaces.models import Place, PlaceImage, Voucher
|
from lostplaces.models import Place, PlaceImage, Voucher
|
||||||
|
|
||||||
class ExplorerCreationForm(UserCreationForm):
|
class SignupVoucherForm(UserCreationForm):
|
||||||
class Meta:
|
class Meta:
|
||||||
model = User
|
model = User
|
||||||
fields = ('username', 'email', 'first_name', 'last_name')
|
fields = ('username', 'email', 'first_name', 'last_name')
|
||||||
|
@ -4,15 +4,15 @@ from django import forms
|
|||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
|
|
||||||
from lostplaces.tests.forms import FormTestCase
|
from lostplaces.tests.forms import FormTestCase
|
||||||
from lostplaces.forms import ExplorerCreationForm
|
from lostplaces.forms import SignupVoucherForm
|
||||||
from lostplaces.models.models import Voucher
|
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
|
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
|
to this project and are already tested by django
|
||||||
"""
|
"""
|
||||||
form = ExplorerCreationForm
|
form = SignupVoucherForm
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def setUpTestData(cls):
|
def setUpTestData(cls):
|
||||||
@ -37,7 +37,7 @@ class ExplorerCreationFormTestCase(FormTestCase):
|
|||||||
)
|
)
|
||||||
|
|
||||||
def test_validation_valid(self):
|
def test_validation_valid(self):
|
||||||
form = ExplorerCreationForm(self.post_data)
|
form = SignupVoucherForm(self.post_data)
|
||||||
self.assertTrue(
|
self.assertTrue(
|
||||||
form.is_valid(),
|
form.is_valid(),
|
||||||
msg='Expecting the %s to validate' % (
|
msg='Expecting the %s to validate' % (
|
||||||
@ -49,7 +49,7 @@ class ExplorerCreationFormTestCase(FormTestCase):
|
|||||||
self.post_data = {
|
self.post_data = {
|
||||||
'voucher': 'Imanotacode123'
|
'voucher': 'Imanotacode123'
|
||||||
}
|
}
|
||||||
form = ExplorerCreationForm(self.post_data)
|
form = SignupVoucherForm(self.post_data)
|
||||||
self.assertFalse(
|
self.assertFalse(
|
||||||
form.is_valid(),
|
form.is_valid(),
|
||||||
msg='Expecting the %s to not validate' % (
|
msg='Expecting the %s to not validate' % (
|
||||||
|
@ -11,7 +11,7 @@ from django.shortcuts import render, redirect, get_object_or_404
|
|||||||
from django.http import HttpResponseForbidden
|
from django.http import HttpResponseForbidden
|
||||||
from django.utils.translation import ugettext_lazy as _
|
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.models import Place, PhotoAlbum
|
||||||
from lostplaces.views.base_views import IsAuthenticatedMixin
|
from lostplaces.views.base_views import IsAuthenticatedMixin
|
||||||
|
|
||||||
@ -23,7 +23,7 @@ from lostplaces.views.base_views import (
|
|||||||
from taggit.models import Tag
|
from taggit.models import Tag
|
||||||
|
|
||||||
class SignUpView(SuccessMessageMixin, CreateView):
|
class SignUpView(SuccessMessageMixin, CreateView):
|
||||||
form_class = ExplorerCreationForm
|
form_class = SignupVoucherForm
|
||||||
success_url = reverse_lazy('login')
|
success_url = reverse_lazy('login')
|
||||||
template_name = 'signup.html'
|
template_name = 'signup.html'
|
||||||
success_message = _('User created')
|
success_message = _('User created')
|
||||||
|
Loading…
Reference in New Issue
Block a user