from flask.ext.wtf import Form
from wtforms import TextField, TextAreaField, validators
from wtforms.validators import InputRequired, Length, URL, Email

class RequestNewFoodResourceForm(Form):
    # Information about the person submitting the food resource for evaluation. 
    first_name = TextField(
        label = 'Your First Name', 
        validators = [
            InputRequired("Please provide your first name."),
            Length(0, 35)
        ])
    last_name = TextField(
        label = 'Your Last Name', 
        validators = [
            InputRequired("Please provide your last name."),
            Length(0, 35)
        ])
    email_address = TextField(
        label = 'Your Email Address', 
        validators = [
            InputRequired("Please provide an email address at which we can contact you."), 
            Email("Invalid email address."),
            Length(1, 35)
        ])
    phone_number = TextField(
        label = 'Your Phone Number', 
        validators = [
            InputRequired("Please provide a phone number at which we can contact you.")
        ])

    # Information about the food resource itself. 
    website = TextField(
        label = 'Food Resource Website', 
        validators = [
            URL(True, "Invalid website URL.")
        ])
    name = TextField(
        label = 'Food Resource Name',
        validators = [
            InputRequired("Please provide the food resource's name.")
        ])
    address_line1 = TextField(
        label = 'Address Line #1', 
        validators = [
            InputRequired("Please provide the food resource's address."),
            Length(1, 100) # same max length as in Address model.
        ])
    address_line2 = TextField(
        label = 'Address Line #1', 
        validators = [
            Length(1, 100) # Same max length as in Address model.
        ])
    address_city = TextField(
        label = 'City', 
        validators = [
            InputRequired("Please provide the food resource's city."),
            Length(1, 35) # Same max length as in Address model.
        ])
    address_state = TextField(
        label = 'State', 
        validators = [
            InputRequired("Please provide the food resource's state."),
            Length(1, 2) # Same max length as in Address model.
        ])
    address_zip_code = TextField(
        label = 'State', 
        validators = [
            InputRequired("Please provide the food resource's zip code."),
            Length(1, 5) # Same max length as in Address model.
        ])
    additional_information = TextAreaField(
        label = 'Any additional information?', 
        validators = [
            InputRequired("Please provide the food resource's zip code."),
            Length(1, 5) # Same max length as in Address model.
        ])

#class AddNewFoodResourceForm(Form):



# class LoginForm(Form):
#   openid = TextField('openid', validators = [Required()])
#   remember_me = BooleanField('remember_me', default = False)

# class EditForm(Form):
#     nickname = TextField('nickname', validators = [Required()])
#     about_me = TextAreaField('about_me', validators = [Length(min = 0, max = 140)])

#     def __init__(self, original_nickname, *args, **kwargs):
#         Form.__init__(self, *args, **kwargs)
#         self.original_nickname = original_nickname

#     def validate(self):
#         if not Form.validate(self):
#             return False
#         if self.nickname.data == self.original_nickname:
#             return True
#         user = User.query.filter_by(nickname = self.nickname.data).first()
#         if user != None:
#             self.nickname.errors.append('This nickname is already in use. Please choose another one.')
#             return False
#         return True

# class PostForm(Form):
#     post = TextField('post', validators = [Required()])

@@ -151,1006 +151,85 @@
 il%0A%0A
-class RequestNewFoodResourceForm(Form):%0A    # Information about the person submitting the food resource for evaluation. %0A    first_name = TextField(%0A        label = 'Your First Name', %0A        validators = %5B%0A            InputRequired(%22Please provide your first name.%22),%0A            Length(0, 35)%0A        %5D)%0A    last_name = TextField(%0A        label = 'Your Last Name', %0A        validators = %5B%0A            InputRequired(%22Please provide your last name.%22),%0A            Length(0, 35)%0A        %5D)%0A    email_address = TextField(%0A        label = 'Your Email Address', %0A        validators = %5B%0A            InputRequired(%22Please provide an email address at which we can contact you.%22), %0A            Email(%22Invalid email address.%22),%0A            Length(1, 35)%0A        %5D)%0A    phone_number = TextField(%0A        label = 'Your Phone Number', %0A        validators = %5B%0A            InputRequired(%22Please provide a phone number at which we can contact you.%22)%0A        %5D)%0A%0A    # Information about the food resource itself. 
+# Information about a new food resource. %0Aclass AddNewFoodResourceForm(Form):
 %0A   
@@ -1900,230 +1900,195 @@
 )%0A%0A#
-class AddNewFoodR
+ Information about the person submitting the food r
 esource
-Form(Form):%0A%0A%0A%0A# class LoginForm(Form):%0A#   openid = TextField('openid', validators = %5BRequired()%5D)%0A#   remember_me = BooleanField('remember_me', default = False)%0A%0A# class EditForm(
+ for evaluation. %0A# Subclassed from 'AddNewFoodResourceForm'%0Aclass RequestNewFoodResourceForm(AddNewFoodResource
 Form):%0A
-#
     
- nick
+first_
 name
@@ -2104,252 +2104,164 @@
 eld(
-'nickname', validators = %5BRequired()%5D)%0A#
+%0A   
      
+l
 ab
-out_me = TextAreaField('about_me', validators = %5BLength(min = 0, max = 140)%5D)%0A%0A#     def __init__(self, original_nickname, *args, **kwargs):%0A#         Form.__init__(self, *args, **kwargs
+el = 'Your First Name', %0A        validators = %5B%0A            InputRequired(%22Please provide your first name.%22),%0A            Length(0, 35
 )%0A
-#
         
  sel
@@ -2260,566 +2260,647 @@
     
- self.original_nickname = original_nickname%0A%0A#     def validate(self):%0A#         if not Form.validate(self):%0A#             return False%0A#         if self.nickname.data == self.original_nickname:%0A#             return True%0A#         user = User.query.filter_by(nickname = self.nickname.data).first()%0A#         if user != None:%0A#             self.nickname.errors.append('This nickname is already in use. Please choos
+%5D)%0A    last_name = TextField(%0A        label = 'Your Last Name', %0A        validators = %5B%0A            InputRequired(%22Please provide your last name.%22),%0A            Length(0, 35)%0A        %5D)%0A    email_address = TextField(%0A        label = 'Your Email Address', %0A        validators = %5B%0A            InputRequired(%22Please provide an email address at which w
 e 
+c
 an
-other one.')%0A#             return False%0A#         return True%0A%0A# class PostForm(Form):%0A#     post = TextField('post', validators = %5BRequired()
+ contact you.%22), %0A            Email(%22Invalid email address.%22),%0A            Length(1, 35)%0A        %5D)%0A    phone_number = TextField(%0A        label = 'Your Phone Number', %0A        validators = %5B%0A            InputRequired(%22Please provide a phone number at which we can contact you.%22)%0A        
 %5D)%0A

Add form inheritance for RequestNewFoodResourceForm. Removed old forms code.