Commit ee395fe0 authored by Sébastiaan Versteeg's avatar Sébastiaan Versteeg
Browse files

Merge branch 'fix/registrations-form-entry-missing' into 'master'

Fix/registrations form entry missing

Closes #664

See merge request !868
parents ab10c4ca 39eb96db
...@@ -23,7 +23,8 @@ class MemberRegistrationForm(forms.ModelForm): ...@@ -23,7 +23,8 @@ class MemberRegistrationForm(forms.ModelForm):
class Meta: class Meta:
model = Registration model = Registration
fields = '__all__' fields = '__all__'
exclude = ['created_at', 'updated_at', 'status', 'username', 'remarks'] exclude = ['created_at', 'updated_at', 'status', 'username', 'remarks',
'payment', 'membership']
class MemberRenewalForm(forms.ModelForm): class MemberRenewalForm(forms.ModelForm):
......
...@@ -271,7 +271,7 @@ class Registration(Entry): ...@@ -271,7 +271,7 @@ class Registration(Entry):
if (self.starting_year is None and if (self.starting_year is None and
self.membership_type is not Membership.SUPPORTER): self.membership_type is not Membership.SUPPORTER):
errors.update({ errors.update({
'username': _('This field is required.')}) 'starting_year': _('This field is required.')})
if (self.programme is None and if (self.programme is None and
self.membership_type is not Membership.SUPPORTER): self.membership_type is not Membership.SUPPORTER):
......
...@@ -129,14 +129,20 @@ class RegistrationTest(TestCase): ...@@ -129,14 +129,20 @@ class RegistrationTest(TestCase):
def test_require_programme_members(self): def test_require_programme_members(self):
self.registration.programme = None self.registration.programme = None
with self.assertRaises(ValidationError): with self.assertRaisesMessage(
ValidationError,
"{'programme': ['Dit veld is vereist.']}"
):
self.registration.clean() self.registration.clean()
self.registration.membership_type = Membership.SUPPORTER self.registration.membership_type = Membership.SUPPORTER
self.registration.clean() self.registration.clean()
def test_require_starting_year_members(self): def test_require_starting_year_members(self):
self.registration.starting_year = None self.registration.starting_year = None
with self.assertRaises(ValidationError): with self.assertRaisesMessage(
ValidationError,
"{'starting_year': ['Dit veld is vereist.']}"
):
self.registration.clean() self.registration.clean()
self.registration.membership_type = Membership.SUPPORTER self.registration.membership_type = Membership.SUPPORTER
self.registration.clean() self.registration.clean()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment