Skip to content

Commit

Permalink
Merge pull request #1111 from xzzy/master2
Browse files Browse the repository at this point in the history
Fix Legacy EmailUser Form
  • Loading branch information
xzzy authored Jan 13, 2025
2 parents 628133a + fb805fc commit 529152b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
15 changes: 15 additions & 0 deletions ledger/accounts/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,21 @@ def __init__(self, *args, **kwargs):
self.fields['email'].initial = initial_email


class EmailUserLegacyForm(forms.ModelForm):
class Meta:
model = EmailUser
fields = ['email', 'first_name', 'last_name', 'title', 'dob', 'phone_number', 'mobile_number', 'fax_number']

def __init__(self, *args, **kwargs):
email_required = kwargs.pop('email_required', True)

super(EmailUserForm, self).__init__(*args, **kwargs)

self.fields['email'].required = email_required

# some form renderers use widget's is_required field to set required attribute for input element
self.fields['email'].widget.is_required = email_required

class EmailUserForm(forms.ModelForm):

identification2 = FileField(label='Upload Identification', required=False, max_length=128, widget=AjaxFileUploader(attrs={'single':'single'}))
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from setuptools import setup

setup(name='ledger',
version='2.5',
version='2.6',
description='Ledger Payments App',
url='https://github.com/dbca-wa/ledger',
author='Department of Parks and Wildlife',
Expand Down

0 comments on commit 529152b

Please sign in to comment.