Exemple #1
0
 def __init__(self, event, user_profile, *args, **kwargs):
     self.event = event
     self.user_profile = user_profile
     show_fields = ["name"]  # Name is always required
     if event.min_age:
         show_fields.append("birth_date")
     UserProfileForm.__init__(
         self, instance=user_profile, show_fields=show_fields, optional_fields=[], *args, **kwargs
     )
     _AgeValidatorFormBase.__init__(self, int(self.event.min_age))
Exemple #2
0
 def __init__(self, event, user_profile, *args, **kwargs):
     self.event = event
     self.user_profile = user_profile
     show_fields = ['name']  # Name is always required
     if event.min_age:
         show_fields.append('birth_date')
     UserProfileForm.__init__(self,
                              instance=user_profile,
                              show_fields=show_fields,
                              optional_fields=[],
                              *args,
                              **kwargs)
     _AgeValidatorFormBase.__init__(self, int(self.event.min_age))
Exemple #3
0
 def __init__(self, campaign, user_profile, *args, **kwargs):
     self.campaign = campaign
     self.user_profile = user_profile
     show_fields = ['name'] # Name is always required
     if campaign.min_age:
         show_fields.append('birth_date')
     if campaign.address_required:
         show_fields.append('address')
     if campaign.phone_required:
         show_fields.append('phone_number')
     UserProfileForm.__init__(self, instance=user_profile, show_fields=show_fields, optional_fields=[], *args, **kwargs)
     _AgeValidatorFormBase.__init__(self, int(self.campaign.min_age))
     if user_profile.user.first_name and user_profile.user.last_name:
         self.fields['first_name'].widget = forms.HiddenInput()
         self.fields['last_name'].widget = forms.HiddenInput()
     try:
         del self.fields['has_opted_in']
     except KeyError:
         pass
Exemple #4
0
 def __init__(self, campaign, user_profile, *args, **kwargs):
     self.campaign = campaign
     self.user_profile = user_profile
     show_fields = ['name']  # Name is always required
     if campaign.min_age:
         show_fields.append('birth_date')
     if campaign.address_required:
         show_fields.append('address')
     if campaign.phone_required:
         show_fields.append('phone_number')
     UserProfileForm.__init__(self,
                              instance=user_profile,
                              show_fields=show_fields,
                              optional_fields=[],
                              *args,
                              **kwargs)
     _AgeValidatorFormBase.__init__(self, int(self.campaign.min_age))
     if user_profile.user.first_name and user_profile.user.last_name:
         self.fields['first_name'].widget = forms.HiddenInput()
         self.fields['last_name'].widget = forms.HiddenInput()
     try:
         del self.fields['has_opted_in']
     except KeyError:
         pass