Browse Source

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

current_wdka_release
crunk 3 years ago
parent
commit
41402e688d
  1. 2
      README.md
  2. 2
      notes.md
  3. 1
      verse/deploydb.py
  4. 11
      verse/start.py
  5. 9
      verse/templates/distribusi.html
  6. 5
      verse/usermodel.py

2
README.md

@ -31,7 +31,7 @@ $ python deploydb.py
## Distribusi ## Distribusi
This is currently added as a git submodule but I have no clue how that actually works 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 $ pip install git+file:///home/full/path/to/distribusi#egg=distribusi

2
notes.md

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

1
verse/deploydb.py

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

11
verse/start.py

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

9
verse/templates/distribusi.html

@ -1,5 +1,6 @@
{% extends "base.html" %} {% extends "base.html" %}
{% block main %} {% block main %}
<section id="upload">
<h3>Upload</h3> <h3>Upload</h3>
<p>Upload button</p> <p>Upload button</p>
<form method="POST" enctype="multipart/form-data" action="{{ url_for('upload') }}"> <form method="POST" enctype="multipart/form-data" action="{{ url_for('upload') }}">
@ -20,10 +21,18 @@
</fieldset> </fieldset>
{{ uploadform.submit }} {{ uploadform.submit }}
</form> </form>
</section>
<section id="theme">
<h3>Theme</h3> <h3>Theme</h3>
<p>dropdown css file selector</p> <p>dropdown css file selector</p>
</section>
<section id="edit">
<h3>Edit</h3> <h3>Edit</h3>
<p>go to CSS editor</p> <p>go to CSS editor</p>
</section>
<section id="distribusi">
<h3>Distribusi</h3> <h3>Distribusi</h3>
<p>run distribusi on your files</p> <p>run distribusi on your files</p>
</section>
{% endblock main %} {% endblock main %}

5
verse/usermodel.py

@ -8,9 +8,10 @@ class User(UserMixin, db.Model):
__tablename__ = "users" __tablename__ = "users"
id = db.Column(db.Integer, primary_key=True) 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) 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): def __repr__(self):
return "<User %r>" % self.username return "<User %r>" % self.username

Loading…
Cancel
Save