Burathar
4 years ago
9 changed files with 85 additions and 39 deletions
@ -0,0 +1,7 @@ |
|||||||
|
from flask_wtf import FlaskForm |
||||||
|
from wtforms import StringField, SubmitField |
||||||
|
from wtforms.validators import DataRequired |
||||||
|
|
||||||
|
class NewProjectForm(FlaskForm): |
||||||
|
projectname = StringField('Project Name', validators=[DataRequired()]) |
||||||
|
submit = SubmitField('Add Project') |
@ -1,9 +1,15 @@ |
|||||||
from flask import render_template |
from flask import render_template, flash |
||||||
from biscd import app |
from biscd import app |
||||||
from biscd.models.project import Project |
from .models.project import Project |
||||||
|
from .froms import NewProjectForm |
||||||
|
|
||||||
@app.route('/', methods=['GET']) |
@app.route('/', methods=['GET', 'POST']) |
||||||
@app.route('/index', methods=['GET']) |
@app.route('/index', methods=['GET', 'POST']) |
||||||
def index(): |
def index(): |
||||||
|
form = NewProjectForm() |
||||||
|
if form.validate_on_submit(): |
||||||
|
project = Project(form.projectname.data) |
||||||
|
project.save() |
||||||
|
flash('You added a project!') |
||||||
project_names = Project.list() |
project_names = Project.list() |
||||||
return render_template('index.html', projects=project_names) |
return render_template('index.html', form=form, projects=project_names) |
||||||
|
@ -1,16 +1,15 @@ |
|||||||
projects: |
projects: |
||||||
- The Hunt: |
- The Hunt: |
||||||
url: thehunt |
|
||||||
git_repo: https://git.sciuro.org/Burathar/The-Hunt |
|
||||||
branch: master |
branch: master |
||||||
secret: thisissecret |
git_repo: https://git.sciuro.org/Burathar/The-Hunt |
||||||
requirements-file: requirements.txt |
requirements-file: requirements.txt |
||||||
|
secret: thisissecret |
||||||
tests: tests.py |
tests: tests.py |
||||||
|
url: thehunt |
||||||
- Foo: |
- Foo: |
||||||
url: bar |
|
||||||
git_repo: https://git.sciuro.org/Burathar/The-Hunt |
|
||||||
branch: master |
branch: master |
||||||
secret: thisissecret |
git_repo: https://git.sciuro.org/Burathar/The-Hunt |
||||||
requirements-file: requirements.txt |
requirements-file: requirements.txt |
||||||
|
secret: thisissecret |
||||||
tests: tests.py |
tests: tests.py |
||||||
|
url: bar |
||||||
|
Loading…
Reference in new issue