Skip to content
Snippets Groups Projects
Commit 34f70ff8 authored by leo's avatar leo
Browse files

~soo wenig zeit argragr

parent 37f86cf9
No related branches found
No related tags found
1 merge request!1V2
*.pyc
lib/python3.7/site-packages/werkzeug/wrappers/__pycache__/__init__.cpython-37.pyc
lib/python3.7/__pycache__/site.cpython-37.pyc
lib/python3.7/site-packages/__pycache__/peewee.cpython-37.pyc
lib/python3.7/site-packages/click/__pycache__/__init__.cpython-37.pyc
lib/python3.7/site-packages/click/__pycache__/_compat.cpython-37.pyc
lib/python3.7/site-packages/click/__pycache__/_unicodefun.cpython-37.pyc
lib/python3.7/site-packages/click/__pycache__/core.cpython-37.pyc
lib/python3.7/site-packages/click/__pycache__/decorators.cpython-37.pyc
lib/python3.7/site-packages/click/__pycache__/exceptions.cpython-37.pyc
lib/python3.7/site-packages/click/__pycache__/formatting.cpython-37.pyc
lib/python3.7/site-packages/click/__pycache__/globals.cpython-37.pyc
lib/python3.7/site-packages/click/__pycache__/parser.cpython-37.pyc
lib/python3.7/site-packages/click/__pycache__/termui.cpython-37.pyc
lib/python3.7/site-packages/click/__pycache__/types.cpython-37.pyc
lib/python3.7/site-packages/click/__pycache__/utils.cpython-37.pyc
lib/python3.7/site-packages/flask/__pycache__/__init__.cpython-37.pyc
lib/python3.7/site-packages/flask/__pycache__/_compat.cpython-37.pyc
lib/python3.7/site-packages/flask/__pycache__/app.cpython-37.pyc
lib/python3.7/site-packages/flask/__pycache__/blueprints.cpython-37.pyc
lib/python3.7/site-packages/flask/__pycache__/cli.cpython-37.pyc
lib/python3.7/site-packages/flask/__pycache__/config.cpython-37.pyc
lib/python3.7/site-packages/flask/__pycache__/ctx.cpython-37.pyc
lib/python3.7/site-packages/flask/__pycache__/debughelpers.cpython-37.pyc
lib/python3.7/site-packages/flask/__pycache__/globals.cpython-37.pyc
lib/python3.7/site-packages/flask/__pycache__/helpers.cpython-37.pyc
lib/python3.7/site-packages/flask/__pycache__/logging.cpython-37.pyc
lib/python3.7/site-packages/flask/__pycache__/sessions.cpython-37.pyc
lib/python3.7/site-packages/flask/__pycache__/signals.cpython-37.pyc
lib/python3.7/site-packages/flask/__pycache__/templating.cpython-37.pyc
lib/python3.7/site-packages/flask/__pycache__/wrappers.cpython-37.pyc
lib/python3.7/site-packages/flask/json/__pycache__/__init__.cpython-37.pyc
lib/python3.7/site-packages/flask/json/__pycache__/tag.cpython-37.pyc
lib/python3.7/site-packages/itsdangerous/__pycache__/__init__.cpython-37.pyc
lib/python3.7/site-packages/itsdangerous/__pycache__/_compat.cpython-37.pyc
lib/python3.7/site-packages/itsdangerous/__pycache__/_json.cpython-37.pyc
lib/python3.7/site-packages/itsdangerous/__pycache__/encoding.cpython-37.pyc
lib/python3.7/site-packages/itsdangerous/__pycache__/exc.cpython-37.pyc
lib/python3.7/site-packages/itsdangerous/__pycache__/jws.cpython-37.pyc
lib/python3.7/site-packages/itsdangerous/__pycache__/serializer.cpython-37.pyc
lib/python3.7/site-packages/itsdangerous/__pycache__/signer.cpython-37.pyc
lib/python3.7/site-packages/itsdangerous/__pycache__/timed.cpython-37.pyc
lib/python3.7/site-packages/itsdangerous/__pycache__/url_safe.cpython-37.pyc
lib/python3.7/site-packages/jinja2/__pycache__/__init__.cpython-37.pyc
lib/python3.7/site-packages/jinja2/__pycache__/_compat.cpython-37.pyc
lib/python3.7/site-packages/jinja2/__pycache__/_identifier.cpython-37.pyc
lib/python3.7/site-packages/jinja2/__pycache__/asyncfilters.cpython-37.pyc
lib/python3.7/site-packages/jinja2/__pycache__/asyncsupport.cpython-37.pyc
lib/python3.7/site-packages/jinja2/__pycache__/bccache.cpython-37.pyc
lib/python3.7/site-packages/jinja2/__pycache__/compiler.cpython-37.pyc
lib/python3.7/site-packages/jinja2/__pycache__/debug.cpython-37.pyc
lib/python3.7/site-packages/jinja2/__pycache__/defaults.cpython-37.pyc
lib/python3.7/site-packages/jinja2/__pycache__/environment.cpython-37.pyc
lib/python3.7/site-packages/jinja2/__pycache__/exceptions.cpython-37.pyc
lib/python3.7/site-packages/jinja2/__pycache__/ext.cpython-37.pyc
lib/python3.7/site-packages/jinja2/__pycache__/filters.cpython-37.pyc
lib/python3.7/site-packages/jinja2/__pycache__/idtracking.cpython-37.pyc
lib/python3.7/site-packages/jinja2/__pycache__/lexer.cpython-37.pyc
lib/python3.7/site-packages/jinja2/__pycache__/loaders.cpython-37.pyc
lib/python3.7/site-packages/jinja2/__pycache__/nodes.cpython-37.pyc
lib/python3.7/site-packages/jinja2/__pycache__/optimizer.cpython-37.pyc
lib/python3.7/site-packages/jinja2/__pycache__/parser.cpython-37.pyc
lib/python3.7/site-packages/jinja2/__pycache__/runtime.cpython-37.pyc
lib/python3.7/site-packages/jinja2/__pycache__/tests.cpython-37.pyc
lib/python3.7/site-packages/jinja2/__pycache__/utils.cpython-37.pyc
lib/python3.7/site-packages/jinja2/__pycache__/visitor.cpython-37.pyc
lib/python3.7/site-packages/markupsafe/__pycache__/__init__.cpython-37.pyc
lib/python3.7/site-packages/markupsafe/__pycache__/_compat.cpython-37.pyc
lib/python3.7/site-packages/werkzeug/__pycache__/__init__.cpython-37.pyc
lib/python3.7/site-packages/werkzeug/__pycache__/_compat.cpython-37.pyc
lib/python3.7/site-packages/werkzeug/__pycache__/_internal.cpython-37.pyc
lib/python3.7/site-packages/werkzeug/__pycache__/_reloader.cpython-37.pyc
lib/python3.7/site-packages/werkzeug/__pycache__/datastructures.cpython-37.pyc
lib/python3.7/site-packages/werkzeug/__pycache__/exceptions.cpython-37.pyc
lib/python3.7/site-packages/werkzeug/__pycache__/filesystem.cpython-37.pyc
lib/python3.7/site-packages/werkzeug/__pycache__/formparser.cpython-37.pyc
lib/python3.7/site-packages/werkzeug/__pycache__/http.cpython-37.pyc
lib/python3.7/site-packages/werkzeug/__pycache__/local.cpython-37.pyc
lib/python3.7/site-packages/werkzeug/__pycache__/routing.cpython-37.pyc
lib/python3.7/site-packages/werkzeug/__pycache__/security.cpython-37.pyc
lib/python3.7/site-packages/werkzeug/__pycache__/serving.cpython-37.pyc
lib/python3.7/site-packages/werkzeug/__pycache__/urls.cpython-37.pyc
lib/python3.7/site-packages/werkzeug/__pycache__/utils.cpython-37.pyc
lib/python3.7/site-packages/werkzeug/__pycache__/wsgi.cpython-37.pyc
lib/python3.7/site-packages/werkzeug/debug/__pycache__/__init__.cpython-37.pyc
lib/python3.7/site-packages/werkzeug/debug/__pycache__/console.cpython-37.pyc
lib/python3.7/site-packages/werkzeug/debug/__pycache__/repr.cpython-37.pyc
lib/python3.7/site-packages/werkzeug/debug/__pycache__/tbtools.cpython-37.pyc
lib/python3.7/site-packages/werkzeug/middleware/__pycache__/__init__.cpython-37.pyc
lib/python3.7/site-packages/werkzeug/middleware/__pycache__/dispatcher.cpython-37.pyc
lib/python3.7/site-packages/werkzeug/middleware/__pycache__/http_proxy.cpython-37.pyc
lib/python3.7/site-packages/werkzeug/middleware/__pycache__/shared_data.cpython-37.pyc
lib/python3.7/site-packages/werkzeug/wrappers/__pycache__/accept.cpython-37.pyc
lib/python3.7/site-packages/werkzeug/wrappers/__pycache__/auth.cpython-37.pyc
lib/python3.7/site-packages/werkzeug/wrappers/__pycache__/base_request.cpython-37.pyc
lib/python3.7/site-packages/werkzeug/wrappers/__pycache__/base_response.cpython-37.pyc
lib/python3.7/site-packages/werkzeug/wrappers/__pycache__/common_descriptors.cpython-37.pyc
lib/python3.7/site-packages/werkzeug/wrappers/__pycache__/etag.cpython-37.pyc
lib/python3.7/site-packages/werkzeug/wrappers/__pycache__/request.cpython-37.pyc
lib/python3.7/site-packages/werkzeug/wrappers/__pycache__/response.cpython-37.pyc
lib/python3.7/site-packages/werkzeug/wrappers/__pycache__/user_agent.cpython-37.pyc
from flask import Flask
from flask import render_template
import random
from flask import request
from peewee import *
db = SqliteDatabase('cfd.db')
class Answer(Model):
q1 = CharField()
q2 = CharField()
q3 = CharField()
q4 = CharField()
q5 = CharField()
q6 = CharField()
q7 = CharField()
q8 = CharField()
q9 = CharField()
q10 = CharField()
class Meta:
database = db
questions = [["wie heisst du?",0],
["wo wohnst du?",1],
["brot?",2],
["was ist das beste hackaspace",3],
["lol",4],
["lel",5],
["lul",6],
["lal",7],
["loel",8],
["lil",9]]
from view.questions import questions
app = Flask(__name__)
@app.route("/")
def start():
return render_template("index.html",questions=questions)
@app.route("/submit", methods=["POST"])
def submit():
answers = []
for x in range(len(questions)):
answers.append(request.form.get(str(x)))
print(questions[x][0],request.form.get(str(x)))
entr = Answer(q1=answers[0],
q2=answers[1],
q3=answers[2],
q4=answers[3],
q5=answers[4],
q6=answers[5],
q7=answers[6],
q8=answers[7],
q9=answers[8],
q10=answers[9])
entr.save()
return "danki"
if __name__ == "__main__":
db.connect()
db.create_tables([q1,q2,q3,q4,q5,q6,q7,q8,q9,10])
app.run()
\ No newline at end of file
app.config['SECRET_KEY'] = 'blubb'
app.register_blueprint(questions)
app.run(debug=True)
......@@ -9,5 +9,6 @@ class BaseModel(Model):
class Meta():
database = sqlite
from model.base import Question, Answer
sqlite.create_tables([Team, Game, Round, Question, Answer])
\ No newline at end of file
sqlite.create_tables([Question, Answer])
\ No newline at end of file
......@@ -5,10 +5,13 @@ from model import BaseModel
class Question(BaseModel):
text = CharField()
id = CharField()
class Answer(BaseModel):
text = CharField()
Question = ForeignKeyField(Quesiton, backref="answers")
question = ForeignKeyField(Question, backref="answers")
class Submit(BaseModel):
\ No newline at end of file
File added
......@@ -3,10 +3,11 @@
<body>
<form action="/submit" method="POST">
{% for quest in questions %}
{% set questid = quest[1] %}
{% set questtext = quest[0] %}
{% set questid = quest.id %}
{% set questtext = quest.text %}
{{ questtext }}
<br>
<input type="hidden" name="question_ids[]" value="{{questid}}"/>
<input type="text" name="{{questid}}" value="">
<br><br>
{% endfor %}
......
import uuid
from flask import Flask, render_template, redirect, request, Blueprint, session
from model import Question, Answer
questions = Blueprint("questions", "questions")
@questions.route("/")
def index():
return render_template("index.html", questions=Question.select())
@questions.route("/debug")
def debug():
Question.create(text="Guten Morgen Linus!")
Question.create(text="Wer hat den Keks aus der Dose geklaut")
return "nice"
@questions.route("/submit", methods=["POST"])
def submit_answers():
if "token" in session:
return "nanan, du hast schon!"
session["token"] = uuid.uuid4()
question_ids = request.form.getlist("question_ids[]")
if question_ids is None:
return "No answers submitted!"
for question_id in question_ids:
question = Question.get_or_none(id=question_id)
if question is None:
return "No question found by that id %s" % question_id
answer = request.form.get(question_id)
answer = Answer.create(text=answer, question=question)
answer.save()
return "Vielen Dankeschön"
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment