Start work on editor

This commit is contained in:
Michał Gdula 2023-05-22 15:51:23 +01:00
parent e362fb7797
commit 4d9bb3de39
3 changed files with 17 additions and 7 deletions

View file

@ -1,9 +1,9 @@
from flask import Blueprint, render_template, redirect, flash, abort from flask import Blueprint, render_template, redirect, flash, abort
from flask_login import login_user, logout_user, login_required from flask_login import login_user, logout_user, login_required, current_user
from flask_wtf import FlaskForm from flask_wtf import FlaskForm
from wtforms import StringField from wtforms import StringField
from wtforms.validators import DataRequired from wtforms.validators import DataRequired
from website.models import Users, Games, Images, Authors, Tags from website.models import Users, Games
blueprint = Blueprint("website", __name__) blueprint = Blueprint("website", __name__)
@ -35,14 +35,16 @@ def g(game_id):
if not game: if not game:
abort(404) abort(404)
# TODO: Add images, authors, and tags to the game page
# images = Images.query.filter_by(game_id=game_id).all()
# authors = Authors.query.filter_id(game_id=game_id).all()
# tags = Tags.query.filter_by(game_id=game_id).all()
return render_template("game.html", game=game) return render_template("game.html", game=game)
@blueprint.route("/editor")
@login_required
def editor():
game = Users.query.filter_by(id=current_user.id).first().game
return render_template("editor.html", game=game)
@blueprint.route("/login", methods=["GET", "POST"]) @blueprint.route("/login", methods=["GET", "POST"])
def login(): def login():
form = LoginForm() form = LoginForm()

View file

View file

@ -0,0 +1,8 @@
{% extends "base.html" %}
{% block background %}{{ url_for('static', filename='images/default.jpg') }}{% endblock %}
{% block content %}
<header>
<h1>{{ game.name }}</h1>
<p>Editor</p>
</header>
{% endblock %}