diff --git a/flask_soc_site/__init__.py b/flask_soc_site/__init__.py index 075761a..d62addd 100644 --- a/flask_soc_site/__init__.py +++ b/flask_soc_site/__init__.py @@ -3,6 +3,7 @@ from flask import Flask, redirect, url_for, render_template, request, flash from .src import host_lookup from dotenv import load_dotenv from markupsafe import escape +from pprint import pprint # Instead of turning 'lookup' into a Blueprint, maybe I could make a history of previous lookups a Blueprint? @@ -32,6 +33,8 @@ def create_app(test_config=None): def lookup(): hosts = [] results = [] + errors_present = False + results_present = False if request.method == "GET": return render_template("lookup.html") elif request.method == "POST" and any(request.form.get("host")): @@ -41,15 +44,24 @@ def create_app(test_config=None): for host in hosts: result = host_lookup.Lookedup(host) results.append(result) - return render_template("results.html", hosts=results, errors=errors) + if any(results): + results_present = True + if any(errors): + errors_present = True + + return render_template( + "results.html", + hosts=results, + errors=errors, + errors_present=errors_present, + results_present=results_present, + ) else: flash("Nothing entered! Try again?", "error") return render_template("lookup.html") - def lookup(): - hosts = [] - - # from . import lookup - # app.register_blueprint(lookup.bp) + @app.route("/history") + def history(): + return render_template("history.html") return app diff --git a/flask_soc_site/templates/history.html b/flask_soc_site/templates/history.html index a75a351..4b1af3a 100644 --- a/flask_soc_site/templates/history.html +++ b/flask_soc_site/templates/history.html @@ -1,4 +1,8 @@ +{% extends "layout.html" %} +
+ +TESTING diff --git a/flask_soc_site/templates/layout.html b/flask_soc_site/templates/layout.html index 853c9c3..1288849 100644 --- a/flask_soc_site/templates/layout.html +++ b/flask_soc_site/templates/layout.html @@ -21,6 +21,7 @@ + {% include "navbar.html" %} {% block content %} {% endblock %} diff --git a/flask_soc_site/templates/navbar.html b/flask_soc_site/templates/navbar.html index 149b6f3..4c7aa4a 100644 --- a/flask_soc_site/templates/navbar.html +++ b/flask_soc_site/templates/navbar.html @@ -8,11 +8,10 @@ --> - -