forked from crunk/distribusi-verse
crunk
3 years ago
7 changed files with 132 additions and 2 deletions
@ -0,0 +1,35 @@ |
|||
import os |
|||
import bleach |
|||
import shutil |
|||
from flask import render_template |
|||
|
|||
from werkzeug.utils import secure_filename |
|||
from sqlalchemy.exc import ( |
|||
DataError, |
|||
DatabaseError, |
|||
InterfaceError, |
|||
InvalidRequestError, |
|||
) |
|||
from app import db |
|||
|
|||
from statuspengguna.helper import ( |
|||
IsZipUploaded, |
|||
CurrentDistribusi, |
|||
IsDistribusiLive, |
|||
) |
|||
from distribusimodel import Distribusis |
|||
from distribusisinfo import DistribusisInfo |
|||
|
|||
from forms.adminuserform import AdminUserForm |
|||
from forms.admindistribusiform import AdminDistribusiForm |
|||
|
|||
|
|||
def AdminPage(): |
|||
adminuserform = AdminUserForm() |
|||
admindistribusiform = AdminDistribusiForm() |
|||
template = render_template( |
|||
"admin.html", |
|||
adminuserform=adminuserform, |
|||
admindistribusiform=admindistribusiform, |
|||
) |
|||
return template |
@ -0,0 +1,12 @@ |
|||
"""Form object declaration.""" |
|||
from flask_wtf import FlaskForm |
|||
from wtforms import ( |
|||
RadioField, |
|||
SubmitField, |
|||
) |
|||
|
|||
|
|||
class AdminDistribusiForm(FlaskForm): |
|||
"""Admin Distribusi form.""" |
|||
|
|||
delete = SubmitField("Delete") |
@ -0,0 +1,13 @@ |
|||
"""Form object declaration.""" |
|||
from flask_wtf import FlaskForm |
|||
from wtforms import ( |
|||
RadioField, |
|||
SubmitField, |
|||
) |
|||
|
|||
|
|||
class AdminUserForm(FlaskForm): |
|||
"""Admin Userform form.""" |
|||
update = SubmitField("update") |
|||
|
|||
delete = SubmitField("Delete") |
@ -0,0 +1,53 @@ |
|||
{% extends "base.html" %} |
|||
{% block main %} |
|||
<div id="buttons"> |
|||
{% if not current_user.is_authenticated %} |
|||
<div class="signin"> |
|||
<a href="/login"> |
|||
<input type="button" name="button" value="Sign in"></input> |
|||
</a> |
|||
</div> |
|||
<div class="signin"> |
|||
<a href="/register"> |
|||
<input type="button" name="button" value="Register"></input> |
|||
</a> |
|||
</div> |
|||
{% else %} |
|||
<div class="distribusi"> |
|||
<a href="/distribusi"> |
|||
<input type="button" name="button" value="Distribusi"></input> |
|||
</a> |
|||
</div> |
|||
<div class="logout"> |
|||
<a href="/logout"> |
|||
<input type="button" name="button" value="Logout"></input> |
|||
</a> |
|||
</div> |
|||
{% endif %} |
|||
</div> |
|||
<div class="maincontent"> |
|||
<!-- a div with all the distribusis listed in the distribusiverse --> |
|||
<div id="distribusiverse" class="maincontent"> |
|||
<h2>List of distribusis</h2> |
|||
<form method="POST" enctype="multipart/form-data" action="{{ url_for('theme') }}"> |
|||
{{ admindistribusiform.csrf_token }} |
|||
<fieldset class="button required multiselect delete"> |
|||
{{ admindistribusiform.delete }} |
|||
</fieldset> |
|||
</form> |
|||
</div> |
|||
|
|||
<div id="distribusiverse" class="maincontent"> |
|||
<h2>List of users</h2> |
|||
<form method="POST" enctype="multipart/form-data" action="{{ url_for('theme') }}"> |
|||
{{ adminuserform.csrf_token }} |
|||
<fieldset class="button required multiselect update"> |
|||
{{ adminuserform.update }} |
|||
</fieldset> |
|||
<fieldset class="button required multiselect delete"> |
|||
{{ adminuserform.delete }} |
|||
</fieldset> |
|||
</form> |
|||
</div> |
|||
|
|||
{% endblock %} |
Loading…
Reference in new issue