auto focus on tags

This commit is contained in:
Maxim Stewart 2020-03-14 17:17:50 -05:00
parent 33ff78943d
commit 26759f5a70
4 changed files with 17 additions and 7 deletions

View File

@ -1,14 +1,24 @@
# Python imports
import secrets
# Lib imports
from flask import Flask
from flask_bcrypt import Bcrypt
from flask_login import current_user, login_user, logout_user, LoginManager
# Apoplication imports
# Configs and 'init'
app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = "sqlite:///static/db/database.db"
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
app.config['TITLE'] = ':::APP TITLE:::'
# For csrf...change!!
app.config['SECRET_KEY'] = '48e80dcf4ed6ea952ca1b7b564be22d665e6e178f7fda84828fdd5e7cdca097a'
# For csrf and some other stuff...
app.config['SECRET_KEY'] = secrets.token_hex(32)
login_manager = LoginManager(app)

View File

@ -14,7 +14,7 @@ class User(db.Model, UserMixin):
username = db.Column(db.String, unique=True, nullable=False)
email = db.Column(db.String, nullable=False)
password = db.Column(db.String, nullable=False)
id = db.Column(db.Integer, nullable=False, primary_key=True, unique=True, autoincrement=True)
id = db.Column(db.Integer, primary_key=True, unique=True, autoincrement=True)
def __repr__(self):
return f"['{self.username}', '{self.email}', '{self.password}', '{self.id}']"

View File

@ -17,14 +17,14 @@
{{ form.username.label(class="form-control-label") }}
{% if form.username.errors %}
{{ form.username(class="form-control form-control-sm is-invalid", autocomplete="off") }}
<div class="invalid-feedback">
{{ form.username(class="form-control form-control-sm is-invalid", autocomplete="off", autofocus=true) }}
{% for error in form.username.errors %}
<span class="">{{ error }}</span>
{% endfor %}
</div>
{% else %}
{{ form.username(class="form-control form-control-sm", autocomplete="off") }}
{{ form.username(class="form-control form-control-sm", autocomplete="off", autofocus=true) }}
{% endif %}
</div>
<div class="form-group">

View File

@ -16,14 +16,14 @@
{{ form.username.label(class="form-control-label") }}
{% if form.username.errors %}
{{ form.username(class="form-control form-control-sm is-invalid", autocomplete="off") }}
{{ form.username(class="form-control form-control-sm is-invalid", autocomplete="off", autofocus=true) }}
<div class="invalid-feedback">
{% for error in form.username.errors %}
<span class="">{{ error }}</span>
{% endfor %}
</div>
{% else %}
{{ form.username(class="form-control form-control-sm", autocomplete="off") }}
{{ form.username(class="form-control form-control-sm", autocomplete="off", autofocus=true) }}
{% endif %}
</div>
<div class="form-group">