pip8 or black told me to remove some code thats necessary for database deployment

This commit is contained in:
crunk 2022-01-05 19:36:18 +01:00
parent 61c8a74e84
commit 41402e688d
6 changed files with 47 additions and 35 deletions

View File

@ -31,7 +31,7 @@ $ python deploydb.py
## Distribusi
This is currently added as a git submodule but I have no clue how that actually works
to install a local git repository into your virtual env pip you can try.
* to install a local git repository into your virtual env pip you can try.
```
$ pip install git+file:///home/full/path/to/distribusi#egg=distribusi

View File

@ -1,5 +1,5 @@
#notes
pip install git+file:///distribusi#egg=distribusi
# Shit! We need entire CRUD functionality.

View File

@ -2,6 +2,7 @@ def deploy():
"""Run deployment of database."""
from app import create_app, db
from flask_migrate import upgrade, migrate, init, stamp
from usermodel import User
app = create_app()
app.app_context().push()

View File

@ -36,7 +36,8 @@ from registerform import RegisterForm
from uploadform import UploadForm
# Tada!
import distribusi
from distribusi.cli import build_argparser
from distribusi.distribusi import distribusify
APP = create_app()
@ -58,7 +59,7 @@ def login():
if loginform.validate_on_submit():
try:
user = User.query.filter_by(email=loginform.email.data).first()
if check_password_hash(user.pwd, loginform.password.data):
if check_password_hash(user.password, loginform.password.data):
login_user(user)
flash("Logged in successfully.", "success")
next = request.args.get("next")
@ -78,17 +79,17 @@ def register():
if registerform.validate_on_submit():
try:
email = registerform.email.data
pwd = registerform.confirmpassword.data
password = registerform.confirmpassword.data
newuser = User(
email=email,
pwd=generate_password_hash(pwd),
password=generate_password_hash(password),
)
db.session.add(newuser)
db.session.commit()
flash("Account Succesfully created", "success")
return redirect(url_for("login"))
return redirect(url_for("index"))
except InvalidRequestError:
db.session.rollback()

View File

@ -1,29 +1,38 @@
{% extends "base.html" %}
{% block main %}
<h3>Upload</h3>
<p>Upload button</p>
<form method="POST" enctype="multipart/form-data" action="{{ url_for('upload') }}">
{{ uploadform.csrf_token }}
<fieldset class="required">
{{ uploadform.sitename.label }}
{{ uploadform.sitename }}
{% for message in uploadform.sitename.errors %}
<div class="error">{{ message }}</div>
{% endfor %}
</fieldset>
<fieldset class="required">
{{ uploadform.zipfile.label }}
{{ uploadform.zipfile }}
{% for message in uploadform.zipfile.errors %}
<div class="error">{{ message }}</div>
{% endfor %}
</fieldset>
{{ uploadform.submit }}
</form>
<h3>Theme</h3>
<p>dropdown css file selector</p>
<h3>Edit</h3>
<p>go to CSS editor</p>
<h3>Distribusi</h3>
<p>run distribusi on your files</p>
<section id="upload">
<h3>Upload</h3>
<p>Upload button</p>
<form method="POST" enctype="multipart/form-data" action="{{ url_for('upload') }}">
{{ uploadform.csrf_token }}
<fieldset class="required">
{{ uploadform.sitename.label }}
{{ uploadform.sitename }}
{% for message in uploadform.sitename.errors %}
<div class="error">{{ message }}</div>
{% endfor %}
</fieldset>
<fieldset class="required">
{{ uploadform.zipfile.label }}
{{ uploadform.zipfile }}
{% for message in uploadform.zipfile.errors %}
<div class="error">{{ message }}</div>
{% endfor %}
</fieldset>
{{ uploadform.submit }}
</form>
</section>
<section id="theme">
<h3>Theme</h3>
<p>dropdown css file selector</p>
</section>
<section id="edit">
<h3>Edit</h3>
<p>go to CSS editor</p>
</section>
<section id="distribusi">
<h3>Distribusi</h3>
<p>run distribusi on your files</p>
</section>
{% endblock main %}

View File

@ -8,9 +8,10 @@ class User(UserMixin, db.Model):
__tablename__ = "users"
id = db.Column(db.Integer, primary_key=True)
distribusiname = db.Column(db.String(100), unique=True, nullable=True)
distribusiname = db.Column(db.String(300), unique=True, nullable=True)
email = db.Column(db.String(150), unique=True, nullable=False)
pwd = db.Column(db.String(300), nullable=False, unique=False)
password = db.Column(db.String(300), nullable=False, unique=False)
visible = db.Column(db.Boolean, server_default=u'false')
def __repr__(self):
return "<User %r>" % self.username