class RegistrationForm3(forms.ModelForm): layout = Layout(Fieldset('Medical details', 'profession', 'country')) class Meta: model = Doctor fields = ('profession', 'country') widgets = {'country': CountrySelectWidget()}
class VerifyForm(forms.Form): other_name = forms.CharField(max_length=200, label="First Name(s)") surname = forms.CharField(max_length=200) alternative_email = forms.EmailField(required=False, label="Your primary email address") organization = forms.CharField(required=False, label="Organization, Hostpital or Company") layout = Layout(Row('other_name', 'surname'), 'alternative_email', 'organization') def clean(self): cleaned_data = super(VerifyForm, self).clean() other_name = cleaned_data.get("other_name") surname = cleaned_data.get("surname") try: Medic.objects.get(surname__iexact=surname, other_name__iexact=other_name) pass except Medic.DoesNotExist: raise forms.ValidationError( "%s %s does not exist in our database. Please provide your registered name as " "they appear on your medical license" % (other_name, surname)) # except Medic.objects.get(surname__iexact=surname, other_name__iexact=other_name, invitation_status=True, # verification_status=True): # raise forms.ValidationError("%s %s was already invited to join 360MedNet. Please check your email for " # "the invitation." % (other_name, surname)) return self.cleaned_data
class DoctorForm(forms.ModelForm): layout = Layout(Fieldset('Personal details', 'profession', 'country')) class Meta: model = Doctor fields = ('first_name', 'last_name', 'profession', 'country') widgets = {'country': CountrySelectWidget()}
class RegistrationForm3(forms.ModelForm): country = forms.CharField(label="Country of Practice") layout = Layout(Fieldset('Medical details', 'profession', 'country')) class Meta: model = Doctor fields = ('profession', 'country')
def add_node_to_layout(cls, node: Union[LayoutNode, str]): """Add a node to `layout` attribute. :param node: django-material layout node (Fieldset, Row etc.) :type node: LayoutNode """ cls.base_layout.append(node) cls.layout = Layout(*cls.base_layout)
class DoctorForm(forms.ModelForm): layout = Layout( Fieldset('Personal details', Row('first_name', 'last_name'), 'profession', 'specialization', 'country')) class Meta: model = Doctor fields = ('first_name', 'last_name', 'profession', 'specialization', 'country')
class DoctorForm(forms.ModelForm): country = forms.CharField(label="Country of Practice") layout = Layout(Fieldset('Personal details', Row('first_name', 'last_name'), 'profession', 'specialization', 'country' )) class Meta: model = Doctor fields = ('first_name', 'last_name', 'profession', 'specialization', 'country')
class UserForm(forms.ModelForm): password = forms.CharField(widget=forms.PasswordInput()) username = forms.CharField(help_text=False) email = forms.EmailField(label="Email Address") layout = Layout(Row('email', 'username', 'password')) class Meta: model = User fields = ('username', 'email', 'password')
class RegistrationForm1(forms.ModelForm): invitation_code = forms.CharField(max_length=6, validators=[invitation_code_exists]) layout = Layout(Row( 'first_name', 'last_name', ), 'invitation_code') class Meta: model = Doctor fields = ('first_name', 'last_name', 'invitation_code')
class VerifyForm(forms.Form): other_name = forms.CharField(required=False, label="First Name(s)") surname = forms.CharField(required=False) email = forms.EmailField(required=False, label="Email Address") alternative_email = forms.EmailField(required=False, label="Alternative Email Address") layout = Layout( Row('other_name', 'surname'), 'email', 'alternative_email' )
class UserForm(forms.ModelForm): password = forms.CharField(widget=forms.PasswordInput()) email = forms.EmailField(label="Email Address") layout = Layout(Row('email', 'password')) class Meta: model = User fields = ('username', 'email', 'password') def __init__(self, *args, **kwargs): super(UserForm, self).__init__(*args, **kwargs)
def __new__(cls, name, bases, dct): x = super().__new__(cls, name, bases, dct) # Enforce a default for the base layout for forms that o not specify one if hasattr(x, "layout"): base_layout = x.layout.elements else: base_layout = [] x.base_layout = base_layout x.layout = Layout(*base_layout) return x
class UserForm(forms.ModelForm): password = forms.CharField(widget=forms.PasswordInput, label='Hasło') confirm_password = forms.CharField(widget=forms.PasswordInput, label='Powtórz hasło', required=False) layout = Layout('username', 'email', Row('password', 'confirm_password')) class Meta: model = Profile fields = ('username', 'email') def clean_confirm_password(self): cd = self.cleaned_data if cd['password'] != cd['confirm_password']: raise forms.ValidationError('Hasła nie są identyczne') return cd['confirm_password']
class RegistrationForm2(forms.ModelForm): password = forms.CharField(widget=forms.PasswordInput(), label="Create Password") email = forms.EmailField(label="Email Address") layout = Layout(email, password) class Meta: model = User fields = ('email', 'password') def clean_email(self): email = self.cleaned_data['email'] if User.objects.filter(email=email).exists(): raise forms.ValidationError("Email already exists") return email
class BidForm(forms.Form): username = forms.CharField() email = forms.EmailField(label="Email Address") password = forms.CharField(widget=forms.PasswordInput) password_confirm = forms.CharField(widget=forms.PasswordInput, label="Confirm password") first_name = forms.CharField(required=False) last_name = forms.CharField(required=False) gender = forms.ChoiceField(choices=((None, ''), ('F', 'Female'), ('M', 'Male'), ('O', 'Other'))) receive_news = forms.BooleanField(required=False, label='I want to receive news and special offers') agree_toc = forms.BooleanField(required=True, label='I agree with the Terms and Conditions') layout = Layout('username', 'email', Row('password', 'password_confirm'), Fieldset('Pesonal details', Row('first_name', 'last_name'), 'gender', 'receive_news', 'agree_toc'))
class ProjectUpdateView(LayoutMixin, UpdateView): layout = Layout( Row('company'), Row('one_liner'), Row('product_narrative'), Row(Span6('semester'), Span6('tags')), Row('members'), Row('team_photo'), ) model = Project success_url = reverse_lazy('accounts:user-profile') fields = [ "company", "one_liner", "product_narrative", "semester", "tags", "members", "team_photo" ] template_name_suffix = '_update_form'
class ProfileForm(forms.ModelForm): layout = Layout(Fieldset('Personal details', Row('first_name', 'middle_name', 'last_name'), Row('gender', 'date_of_birth'), 'about_me', 'mobile_number', ), Fieldset('Professional details', Row('profession', 'specialization'), Row('year_of_first_medical_certification', 'hospital'), Row('country', 'city'), 'work_number', ), 'avatar' ) class Meta: model = Doctor fields = ('first_name', 'middle_name', 'last_name', 'gender', 'date_of_birth', 'profession', 'specialization', 'country', 'city', 'year_of_first_medical_certification', 'mobile_number', 'about_me', 'hospital', 'work_number', 'avatar')
class MedicalCaseForm(forms.ModelForm): layout = Layout( 'title', 'chief_complaint', Fieldset( 'Patient details', Row('patient_age', 'patient_gender', 'patient_country_of_origin'), 'history_of_present_illness', 'medical_history', 'surgical_history', 'social_history', 'family_history', 'allergies', 'medications', 'review_of_systems', 'physical_examination', 'diagnostic_tests', 'any_other_details', 'medical_case_category'), 'purpose') class Meta: model = MedicalCase fields = ('title', 'chief_complaint', 'patient_age', 'patient_gender', 'patient_country_of_origin', 'history_of_present_illness', 'medical_history', 'surgical_history', 'social_history', 'family_history', 'allergies', 'medications', 'review_of_systems', 'physical_examination', 'diagnostic_tests', 'any_other_details', 'medical_case_category', 'purpose')