Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
56 changed files
with
14,195 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
from flask_wtf import Form | ||
from wtforms import StringField, TextAreaField | ||
from wtforms.fields.html5 import EmailField | ||
from wtforms.validators import DataRequired, Email | ||
from api.scripts.add_client import add_client_id | ||
from api.scripts.email_handler import send_id_email | ||
from api.scripts.add_documentation import add_documentation | ||
from api.scripts.add_member import add_member | ||
|
||
class SignupForm(Form): | ||
name = StringField('Name', validators=[DataRequired()]) | ||
email = EmailField('Email', validators=[DataRequired(), Email()]) | ||
|
||
def validate(self): | ||
if Form.validate(self): | ||
client_id = add_client_id(self.email.data, self.name.data) | ||
if client_id: | ||
send_id_email(self.email.data, self.name.data, client_id) | ||
return True | ||
else: | ||
self.email.errors.append("Client ID could not be created. Is your email correct?") | ||
return False | ||
else: | ||
return False | ||
|
||
class DocumentationForm(Form): | ||
name = StringField('Name', validators=[DataRequired()]) | ||
urlname = StringField('URL Name', validators=[DataRequired()]) | ||
imageurl = StringField('Image URL', validators=[DataRequired()]) | ||
contents = TextAreaField('Contents', validators=[DataRequired()]) | ||
|
||
def validate(self): | ||
if Form.validate(self): | ||
documentation = add_documentation(self.contents.data, | ||
self.name.data, self.urlname.data, self.imageurl.data) | ||
if documentation: | ||
return True | ||
else: | ||
self.name.errors.append("Client ID could not be created.") | ||
return False | ||
else: | ||
return False | ||
|
||
class MemberForm(Form): | ||
name = StringField('Name', validators=[DataRequired()]) | ||
imageurl = StringField('Image URL', validators=[DataRequired()]) | ||
about = TextAreaField('Contents', validators=[DataRequired()]) | ||
|
||
def validate(self): | ||
if Form.validate(self): | ||
member = add_member(self.about.data, | ||
self.name.data, self.imageurl.data) | ||
if member: | ||
return True | ||
else: | ||
self.name.errors.append("Member could not be created.") | ||
return False | ||
else: | ||
return False |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
from api import db | ||
|
||
api_documentations = db.api_documentations | ||
|
||
def add_documentation(contents, name, urlname, imageurl): | ||
new_documentation = { | ||
'name': name, | ||
'urlname': urlname, | ||
'contents': contents, | ||
'imageurl': imageurl | ||
} | ||
api_documentations.insert(new_documentation) | ||
return True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
from api import db | ||
|
||
api_members = db.members | ||
|
||
def add_member(about, name, imageurl): | ||
new_member = { | ||
'name': name, | ||
'about': about, | ||
'image_url': imageurl | ||
} | ||
api_members.insert(new_member) | ||
return True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.img-member { | ||
margin: 20px; | ||
} |
Oops, something went wrong.