# Path: web/Model/database.py
# class Activities(db.Model):
#     __bind_key__ = 'activity'
#     activity_name = db.Column(db.VARCHAR(10), primary_key=True, unique=True)
#     title = db.Column(db.Text)
#     reg_enable = db.Column(db.Boolean, default=True)
#     team_enable = db.Column(db.Boolean, default=False)
#     upload_enable = db.Column(db.Boolean, default=False)
#     note = db.Column(db.Text, default="")
#     rank = db.Column(db.Integer, default=0)
#     hide = db.Column(db.Boolean, default=False)
# 
#     def __init__(self, activity_name, title, reg_enable, team_enable, upload_enable, note, rank):
#         self.activity_name = activity_name
#         self.title = title
#         self.team_enable = team_enable
#         self.upload_enable = upload_enable
#         self.reg_enable = reg_enable
#         self.note = note
#         self.rank = rank
#         self.hide = False
# 
#     def __repr__(self):
#         return "{0} {1} {2}".format(self.activity_name, self.team_enable, self.upload_enable)


from flask_wtf import Form
from flask_wtf.file import FileField, FileAllowed, FileRequired
from wtforms import SubmitField, StringField, validators, TextAreaField, BooleanField, SelectField, IntegerField, PasswordField
from .database import Activities


class Reg(Form):
    name = StringField('姓名', [validators.required()], description="你的姓名")
    stucode = StringField('学号', [validators.required()], description="你的学号")
    qq = StringField('QQ', [validators.required()], description="留下QQ便于我们联系")
    phone = StringField('手机', [validators.required()], description="我们将用短信通知您最新信息!")
    button = SubmitField('提交')


class RegWithTeam(Form):
    name = StringField('组长姓名', [validators.required()], description="你的姓名")
    stucode = StringField('组长学号', [validators.required()], description="你的学号")
    qq = StringField('组长QQ', [validators.required()], description="留下QQ便于我们联系")
    phone = StringField('组长手机', [validators.required()], description="我们将用短信通知您最新信息!")
    team = TextAreaField('队员信息', description="组队参加请按照\"姓名 学号\"一人一行填写在文本框内 如: 王尼玛 22150xxxx")
    button = SubmitField('提交')


class UploadFile(Form):
    works = FileField('你的作品', validators=[
        FileRequired(message='请选择文件'),
        FileAllowed(['zip', 'rar'], '请使用zip或rar压缩格式提交'),

# Path: web/Model/database.py
# class Activities(db.Model):
#     __bind_key__ = 'activity'
#     activity_name = db.Column(db.VARCHAR(10), primary_key=True, unique=True)
#     title = db.Column(db.Text)
#     reg_enable = db.Column(db.Boolean, default=True)
#     team_enable = db.Column(db.Boolean, default=False)
#     upload_enable = db.Column(db.Boolean, default=False)
#     note = db.Column(db.Text, default="")
#     rank = db.Column(db.Integer, default=0)
#     hide = db.Column(db.Boolean, default=False)
# 
#     def __init__(self, activity_name, title, reg_enable, team_enable, upload_enable, note, rank):
#         self.activity_name = activity_name
#         self.title = title
#         self.team_enable = team_enable
#         self.upload_enable = upload_enable
#         self.reg_enable = reg_enable
#         self.note = note
#         self.rank = rank
#         self.hide = False
# 
#     def __repr__(self):
#         return "{0} {1} {2}".format(self.activity_name, self.team_enable, self.upload_enable)


# Path: web/Model/Forms.py
from flask_wtf import Form
from flask_wtf.file import FileField, FileAllowed, FileRequired
from wtforms import SubmitField, StringField, validators, TextAreaField, BooleanField, SelectField, IntegerField, PasswordField
from .database import Activities



class Reg(Form):
    name = StringField('姓名', [validators.required()], description="你的姓名")
    stucode = StringField('学号', [validators.required()], description="你的学号")
    qq = StringField('QQ', [validators.required()], description="留下QQ便于我们联系")
    phone = StringField('手机', [validators.required()], description="我们将用短信通知您最新信息!")
    button = SubmitField('提交')


class RegWithTeam(Form):
    name = StringField('组长姓名', [validators.required()], description="你的姓名")
    stucode = StringField('组长学号', [validators.required()], description="你的学号")
    qq = StringField('组长QQ', [validators.required()], description="留下QQ便于我们联系")
    phone = StringField('组长手机', [validators.required()], description="我们将用短信通知您最新信息!")
    team = TextAreaField('队员信息', description="组队参加请按照\"姓名 学号\"一人一行填写在文本框内 如: 王尼玛 22150xxxx")
    button = SubmitField('提交')


class UploadFile(Form):
    works = FileField('你的作品', validators=[
        FileRequired(message='请选择文件'),
        FileAllowed(['zip', 'rar'], '请使用zip或rar压缩格式提交'),

    ],        