Exemplo n.º 1
0
class ProfileForm(Form):
    first_name = f.CharField(max_length=100,
                             widget=w.TextInput(),
                             label='First Name')
    last_name = f.CharField(max_length=100,
                            widget=w.TextInput(),
                            label='Last Name')
    avatar = f.CharField(label='Profile Picture')
    phone_number = f.IntegerField(
        label='contact number',
        help_text='please enter your phone number here')
    email = f.CharField(
        max_length=100,
        widget=w.EmailInput(),
        label='Email Address',
        error_messages={
            'invalid_edu':
            'Please use an email address from one of the supported universities.'
        })

    def clean_email(self):
        valid_email = False
        email = self.cleaned_data['email']
        for edu in ActiveEdu.objects.all():
            if email.endswith(edu.domain):
                valid_email = True
        if not valid_email:
            raise ValidationError(
                self.fields['email'].error_messages['invalid_edu'])
        return email
Exemplo n.º 2
0
class NewTripForm(Form):
    name = f.CharField(max_length=100,
                       widget=w.TextInput(),
                       label='Trip Name',
                       help_text='Example: TCU vs Oklahoma State to Oklahoma')
    descr = f.CharField(max_length=700,
                        widget=w.Textarea(),
                        label='Describe Your Trip',
                        help_text='')
    members = f.IntegerField(
        label='Current Travelers',
        help_text='Number of people currently going with you')
    members_requested = f.IntegerField(
        label='Requested Travelers',
        help_text=
        'Additional number of people you would like to go with on your trip',
        error_messages={
            'invalid_members':
            'You must request at least one additional member to join your trip.'
        })

    def clean_members_requested(self):
        members = int(self.cleaned_data['members_requested'])
        if members <= 0:
            raise ValidationError(self.fields['members_requested'].
                                  error_messages['invalid_members'])
        return self.cleaned_data['members_requested']
Exemplo n.º 3
0
class ProfileEditStatusForm(Form):
    trip_id = f.CharField(widget=w.HiddenInput())
    trip_status = f.CharField(widget=w.HiddenInput())
    trip_question = f.BooleanField(
        label='Update Trip Status',
        help_text=
        'Confirm that you would like to make this change to your trip.')
Exemplo n.º 4
0
class JoinTripApprovalForm(Form):
    trip_id = f.CharField(max_length=100, widget=w.HiddenInput())
    user_id = f.CharField(max_length=100, widget=w.HiddenInput())
    user_approved = f.BooleanField(
        required=False,
        label='Approve User',
        help_text='Would you like to approve this user to join your trip?')
Exemplo n.º 5
0
class EditTripForm(Form):
    name = f.CharField(max_length=100,
                       widget=w.TextInput(),
                       label='Trip Name',
                       help_text='Example: New Years Eve Trip to New York')
    descr = f.CharField(max_length=1000,
                        widget=w.Textarea(),
                        label='Trip Description',
                        help_text='')
    members_requested = f.IntegerField(
        label='Requested Travelers',
        help_text='Number of people you would like to have in your party.')
Exemplo n.º 6
0
class JoinTripForm(Form):
    trip_id = f.CharField(max_length=100, widget=w.HiddenInput())
    trip_car = f.BooleanField(
        required=False,
        label='Car',
        help_text=
        'Do you have a car that could be used for this trip? You must have a valid driver license and insurance.'
    )
    trip_gas = f.BooleanField(required=False,
                              label='Gas',
                              help_text='Can you help pay for gas?')
Exemplo n.º 7
0
class NewTripStartForm(Form):
    start_dt = f.DateField(widget=w.DateInput(),
                           label='Departure Date',
                           help_text='Date of your trip')
    start_tm = f.TimeField(widget=w.TimeInput(),
                           label='Departure Time',
                           help_text='Expected time of departure')
    start_address_name = f.CharField(required=True,
                                     max_length=50,
                                     label='Departing Place',
                                     help_text='Where are you leaving from?')
    start_address_1 = f.CharField(required=True,
                                  max_length=50,
                                  label='Departure Address',
                                  help_text='Address of the departure place')
    start_address_2 = f.CharField(required=False,
                                  max_length=50,
                                  label='Departure Address Continued',
                                  help_text='Additional address information')
    start_address_city = f.CharField(
        required=True,
        max_length=50,
        label='Departing City',
        help_text='Enter the city from which your trip will begin')
    start_address_state = f.CharField(
        required=True,
        max_length=50,
        widget=USStateSelect(),
        label='Departing State',
        help_text='Enter the state where your trip will begin')
    start_address_postal = f.CharField(
        required=True,
        max_length=50,
        label='Departing Postal Code',
        help_text='Enter the postal code where your trip will begin')
Exemplo n.º 8
0
class NewTripReturnAddressForm(Form):
    return_address_name = f.CharField(
        required=True,
        max_length=50,
        label='Returning Name',
        help_text='Enter the name where your trip will be returning to')
    return_address_1 = f.CharField(
        required=True,
        max_length=50,
        label='Returning Address',
        help_text='Enter the address you will be returning to')
    return_address_2 = f.CharField(
        required=False,
        max_length=50,
        label='Returning Address Continued',
        help_text='Enter additional address information')
    return_address_city = f.CharField(
        required=True,
        max_length=50,
        label='Returning City',
        help_text='Enter the city you will be returning to')
    return_address_state = f.CharField(
        required=True,
        max_length=50,
        widget=USStateSelect(),
        label='Returning State',
        help_text='Enter the state you will be returning to')
    return_address_postal = f.CharField(
        required=True,
        max_length=50,
        label='Returning Postal Code',
        help_text='Enter the postal code you will be returning to')
Exemplo n.º 9
0
class EmailSignUpForm(Form):
    email = f.CharField(
        label='@tcu.edu',
        widget=w.EmailInput(),
        max_length=75,
        error_messages={'invalid_edu': 'Please use your TCU email address'})

    def clean_email(self):
        valid_email = False
        email = self.cleaned_data['email']
        for edu in ActiveEdu.objects.all():
            if email.endswith(edu.domain):
                valid_email = True
        if not valid_email:
            raise ValidationError(
                self.fields['email'].error_messages['invalid_edu'])
        return email
Exemplo n.º 10
0
class NewAccountForm(Form):
    first_name = f.CharField(max_length=30)
    last_name = f.CharField(max_length=30)
    username = f.CharField(
        max_length=30,
        error_messages={
            'username_taken':
            'This username is already used by another account'
        })
    email = f.CharField(
        label='Email Address',
        help_text="Enter your TCU email address",
        widget=w.EmailInput(),
        max_length=75,
        error_messages={'invalid_edu': 'Please use your TCU email address'})
    password = f.CharField(label='Password',
                           widget=w.PasswordInput(),
                           max_length=30)
    password_2 = f.CharField(
        label='Confirm Password',
        widget=w.PasswordInput(),
        max_length=30,
        error_messages={'pwd_mismatch': 'Please confirm your password'})

    def clean_email(self):
        valid_email = False
        email = self.cleaned_data['email']
        for edu in ActiveEdu.objects.all():
            if email.endswith(edu.domain):
                valid_email = True
        if not valid_email:
            raise ValidationError(
                self.fields['email'].error_messages['invalid_edu'])
        return email

    def clean_password_2(self):
        pwd_1 = self.cleaned_data['password']
        pwd_2 = self.cleaned_data['password_2']
        if pwd_1 != pwd_2:
            raise ValidationError(
                self.fields['password_2'].error_messages['pwd_mismatch'])
        return pwd_1

    def clean_username(self):
        username = self.cleaned_data['username']
        res = UserModel().objects.all().filter(username=username)
        if len(res) != 0:
            raise ValidationError(
                self.fields['username'].error_messages['username_taken'])
        return username
Exemplo n.º 11
0
class EditTripArriveForm(Form):
    arrive_dt = f.DateField(
        widget=w.DateInput(),
        label='Arrival Date',
        help_text='Enter the date you will arrive at your destination')
    arrive_tm = f.TimeField(
        widget=w.TimeInput(),
        label='Arrival Time',
        help_text='Enter the time you will arrive at your destination')
    arrive_address_name = f.CharField(
        required=True,
        max_length=50,
        label='Arrive To',
        help_text='Enter the name where your trip will arrive at.')
    arrive_address_1 = f.CharField(
        required=True,
        max_length=50,
        label='Arrival Address',
        help_text='Enter the address you will arrive at.')
    arrive_address_2 = f.CharField(
        required=False,
        max_length=50,
        label='Arrival Address Continued',
        help_text='Enter additional address information.')
    arrive_address_city = f.CharField(
        required=True,
        max_length=50,
        label='Arriving City',
        help_text='Enter the city you will arrive at.')
    arrive_address_state = f.CharField(
        required=True,
        max_length=50,
        widget=USStateSelect(),
        label='Arriving State',
        help_text='Enter the state you will arrive at.')
    arrive_address_postal = f.CharField(
        required=True,
        max_length=50,
        label='Arriving Postal Code',
        help_text='Enter the postal code for the arriving area.')
Exemplo n.º 12
0
class EditTripReturnAddressForm(Form):
    return_dt = f.DateField(
        widget=w.DateInput(),
        label='Returning Date',
        help_text='Enter the date you will leave your destination.')
    return_tm = f.TimeField(
        widget=w.TimeInput(),
        label='Returning Time',
        help_text='Enter the time you will leave your destination')
    return_address_name = f.CharField(
        required=True,
        max_length=50,
        label='Returning Name',
        help_text='Enter the name where your trip will be returning to.')
    return_address_1 = f.CharField(
        required=True,
        max_length=50,
        label='Returning Address',
        help_text='Enter the address you will be returning to.')
    return_address_2 = f.CharField(
        required=False,
        max_length=50,
        label='Returning Address Continued',
        help_text='Enter additional address information.')
    return_address_city = f.CharField(
        required=True,
        max_length=50,
        label='Returning City',
        help_text='Enter the city you will be returning to.')
    return_address_state = f.CharField(
        required=True,
        max_length=50,
        widget=USStateSelect(),
        label='Returning State',
        help_text='Enter the state you will be returning to.')
    return_address_postal = f.CharField(
        required=True,
        max_length=50,
        label='Returning Postal Code',
        help_text='Enter the postal code you will be returning to.')
Exemplo n.º 13
0
class EditTripStartForm(Form):
    start_dt = f.DateField(widget=w.DateInput(),
                           label='Departure Date',
                           help_text='Enter the date your trip will begin.')
    start_tm = f.TimeField(widget=w.TimeInput(),
                           label='Departure Time',
                           help_text='Enter the time your trip will begin.')
    start_address_name = f.CharField(
        required=True,
        max_length=50,
        label='Departure From',
        help_text='Enter the name where your trip will begin from.')
    start_address_1 = f.CharField(
        required=True,
        max_length=50,
        label='Departure Address',
        help_text='Enter the address where your trip will begin from.')
    start_address_2 = f.CharField(
        required=False,
        max_length=50,
        label='Departure Address Continued',
        help_text='Enter additional address information.')
    start_address_city = f.CharField(
        required=True,
        max_length=50,
        label='Departing City',
        help_text='Enter the city from which your trip will begin.')
    start_address_state = f.CharField(
        required=True,
        max_length=50,
        widget=USStateSelect(),
        label='Departing State',
        help_text='Enter the state where your trip will begin.')
    start_address_postal = f.CharField(
        required=True,
        max_length=50,
        label='Departing Postal Code',
        help_text='Enter the postal code where your trip will begin.')
Exemplo n.º 14
0
class NewTripArriveForm(Form):
    arrive_dt = f.DateField(widget=w.DateInput(),
                            label='Arrival Date',
                            help_text='Arrival date at the destination')
    arrive_tm = f.TimeField(widget=w.TimeInput(),
                            label='Arrival Time',
                            help_text='Expected time of arrival')
    arrive_address_name = f.CharField(required=True,
                                      max_length=50,
                                      label='Arrive To',
                                      help_text='Where are you arriving at?')
    arrive_address_1 = f.CharField(
        required=True,
        max_length=50,
        label='Arrival Address',
        help_text='Address of the place you will arrive at')
    arrive_address_2 = f.CharField(required=False,
                                   max_length=50,
                                   label='Arrival Address Continued',
                                   help_text='Additional address information.')
    arrive_address_city = f.CharField(
        required=True,
        max_length=50,
        label='Arriving City',
        help_text='Enter the city you will arrive at')
    arrive_address_state = f.CharField(
        required=True,
        max_length=50,
        widget=USStateSelect(),
        label='Arriving State',
        help_text='Enter the state you will arrive at')
    arrive_address_postal = f.CharField(
        required=True,
        max_length=50,
        label='Arriving Postal Code',
        help_text='Enter the postal code for the arriving area')
Exemplo n.º 15
0
class SearchTripsForm(Form):
    name = f.CharField(required=True,
                       max_length=50,
                       label='Trip Name',
                       help_text='Search for trips names containing this.')
Exemplo n.º 16
0
class ContactUsForm(Form):
    fname = f.CharField(label='First Name:', help_text='Enter your first name', required=True)
    lname = f.CharField(label='Last Name:', help_text='Enter your last name', required=True)
    email = f.CharField(max_length=50, widget=w.EmailInput(), label='Email Address:', help_text='Enter an email address we can contact you at.', required=True)
    phone = f.CharField(max_length=20, widget=w.PhoneNumberInput(), label='Phone Number', help_text='Enter a phone number we can reach you at.')
    question = f.CharField(max_length=200, widget=w.Textarea(), label='Question:', required=True)