# Path: farmsList/user/models.py
# class User(UserMixin, SurrogatePK, Model):
#     __tablename__ = 'users'
#     username = Column(db.String(80), unique=True, nullable=False)
#     email = Column(db.String(80), unique=True, nullable=False)
#     #: The hashed password
#     password = Column(db.String(128), nullable=True)
#     created_at = Column(db.DateTime, nullable=False, default=dt.datetime.utcnow)
#     first_name = Column(db.String(30), nullable=True)
#     last_name = Column(db.String(30), nullable=True)
#     active = Column(db.Boolean(), default=False)
#     is_admin = Column(db.Boolean(), default=False)
# 
#     def __init__(self, username, email, password=None, **kwargs):
#         db.Model.__init__(self, username=username, email=email, **kwargs)
#         if password:
#             self.set_password(password)
#         else:
#             self.password = None
# 
#     def set_password(self, password):
#         self.password = bcrypt.generate_password_hash(password)
# 
#     def check_password(self, value):
#         return bcrypt.check_password_hash(self.password, value)
# 
#     @property
#     def full_name(self):
#         return "{0} {1}".format(self.first_name, self.last_name)
# 
#     def __repr__(self):
#         return '<User({username!r})>'.format(username=self.username)


from flask_wtf import Form
from wtforms import TextField, PasswordField, BooleanField, DecimalField, IntegerField, TextAreaField
from wtforms.validators import DataRequired
from farmsList.user.models import User
        if not self.user:
            self.username.errors.append('Unknown username')
            return False

        if not self.user.check_password(self.password.data):
            self.password.errors.append('Invalid password')
            return False

        if not self.user.active:
            self.username.errors.append('User not activated')
            return False
        return True

class ContactLandOwnerForm(Form):
    name = TextField('Name', validators=[DataRequired()])
    email = TextField('Email', validators=[DataRequired()])
    phone = TextField('Phone', validators=[DataRequired()])
    experience = TextAreaField('Please describe your past experience farming:', validators=[DataRequired()])

    def __init__(self, *args, **kwargs):
        super(ContactLandOwnerForm, self).__init__(*args, **kwargs)

    def validate(self):
        initial_validation = super(ContactLandOwnerForm, self).validate()
        if not initial_validation:
            return False
        return True

class NewParcel1Form(Form):
    address = TextField('Address', validators=[DataRequired()])

# Path: farmsList/user/models.py
# class User(UserMixin, SurrogatePK, Model):
#     __tablename__ = 'users'
#     username = Column(db.String(80), unique=True, nullable=False)
#     email = Column(db.String(80), unique=True, nullable=False)
#     #: The hashed password
#     password = Column(db.String(128), nullable=True)
#     created_at = Column(db.DateTime, nullable=False, default=dt.datetime.utcnow)
#     first_name = Column(db.String(30), nullable=True)
#     last_name = Column(db.String(30), nullable=True)
#     active = Column(db.Boolean(), default=False)
#     is_admin = Column(db.Boolean(), default=False)
# 
#     def __init__(self, username, email, password=None, **kwargs):
#         db.Model.__init__(self, username=username, email=email, **kwargs)
#         if password:
#             self.set_password(password)
#         else:
#             self.password = None
# 
#     def set_password(self, password):
#         self.password = bcrypt.generate_password_hash(password)
# 
#     def check_password(self, value):
#         return bcrypt.check_password_hash(self.password, value)
# 
#     @property
#     def full_name(self):
#         return "{0} {1}".format(self.first_name, self.last_name)
# 
#     def __repr__(self):
#         return '<User({username!r})>'.format(username=self.username)


# Path: farmsList/public/forms.py
from flask_wtf import Form
from wtforms import TextField, PasswordField, BooleanField, DecimalField, IntegerField, TextAreaField
from wtforms.validators import DataRequired
from farmsList.user.models import User

        if not self.user:
            self.username.errors.append('Unknown username')
            return False

        if not self.user.check_password(self.password.data):
            self.password.errors.append('Invalid password')
            return False

        if not self.user.active:
            self.username.errors.append('User not activated')
            return False
        return True

class ContactLandOwnerForm(Form):
    name = TextField('Name', validators=[DataRequired()])
    email = TextField('Email', validators=[DataRequired()])
    phone = TextField('Phone', validators=[DataRequired()])
    experience = TextAreaField('Please describe your past experience farming:', validators=[DataRequired()])

    def __init__(self, *args, **kwargs):
        super(ContactLandOwnerForm, self).__init__(*args, **kwargs)

    def validate(self):
        initial_validation = super(ContactLandOwnerForm, self).validate()
        if not initial_validation:
            return False
        return True

class NewParcel1Form(Form):
    address = TextField('Address', validators=[DataRequired()])

    hasWater = BooleanField('The property has a water meter installed.')