crunk
6 months ago
10 changed files with 89 additions and 54 deletions
@ -0,0 +1,22 @@ |
|||||
|
from flask import Blueprint, render_template |
||||
|
from models.distribusi_model import Distribusis |
||||
|
from models.distribusi_file_model import DistribusiFiles |
||||
|
|
||||
|
describer = Blueprint( |
||||
|
"describer", |
||||
|
__name__, |
||||
|
template_folder="templates/describe_files", |
||||
|
static_folder="static", |
||||
|
) |
||||
|
|
||||
|
|
||||
|
@describer.route("/<string:distribusiname>") |
||||
|
def describe_distribusi_files(distribusiname): |
||||
|
distribusi = Distribusis.query.filter_by( |
||||
|
distribusiname=distribusiname |
||||
|
).first() |
||||
|
distribusi_files = DistribusiFiles.query.filter_by( |
||||
|
distribusi=distribusi.id |
||||
|
).all() |
||||
|
print(distribusi_files) |
||||
|
return render_template("describe.html", distribusi_files=distribusi_files) |
@ -1,2 +0,0 @@ |
|||||
{% extends "base/base.html" %} |
|
||||
{% block main %} |
|
@ -0,0 +1,34 @@ |
|||||
|
{% extends "base/base.html" %} |
||||
|
{% block main %} |
||||
|
<div id="buttons"> |
||||
|
{% if current_user.is_authenticated %} |
||||
|
<div class="distribusi"> |
||||
|
<a href="/distribusi"> |
||||
|
<input type="button" name="button" value="Distribusi"></input> |
||||
|
</a> |
||||
|
</div> |
||||
|
{% if adminuser %} |
||||
|
<div class="admin"> |
||||
|
<a href="/admin"> |
||||
|
<input type="button" name="button" value="Admin"></input> |
||||
|
</a> |
||||
|
</div> |
||||
|
{% endif %} |
||||
|
<div class="logout"> |
||||
|
<a href="/logout"> |
||||
|
<input type="button" name="button" value="Logout"></input> |
||||
|
</a> |
||||
|
</div> |
||||
|
{% endif %} |
||||
|
<div class="help"> |
||||
|
<a href="/help"> |
||||
|
<input type="button" name="button" value="Help"></input> |
||||
|
</a> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="distribusi_files"> |
||||
|
{% for file in distribusi_files %} |
||||
|
<p>{{file}}</p> |
||||
|
{% endfor%} |
||||
|
</div> |
||||
|
{% endblock %} |
@ -1,36 +0,0 @@ |
|||||
"""empty message |
|
||||
|
|
||||
Revision ID: 8ede45e978d9 |
|
||||
Revises: |
|
||||
Create Date: 2024-04-30 22:15:48.023060 |
|
||||
|
|
||||
""" |
|
||||
from alembic import op |
|
||||
import sqlalchemy as sa |
|
||||
|
|
||||
|
|
||||
# revision identifiers, used by Alembic. |
|
||||
revision = '8ede45e978d9' |
|
||||
down_revision = None |
|
||||
branch_labels = None |
|
||||
depends_on = None |
|
||||
|
|
||||
|
|
||||
def upgrade(): |
|
||||
# ### commands auto generated by Alembic - please adjust! ### |
|
||||
with op.batch_alter_table('distribusi_files', schema=None) as batch_op: |
|
||||
batch_op.alter_column('type', |
|
||||
existing_type=sa.VARCHAR(length=300), |
|
||||
nullable=True) |
|
||||
|
|
||||
# ### end Alembic commands ### |
|
||||
|
|
||||
|
|
||||
def downgrade(): |
|
||||
# ### commands auto generated by Alembic - please adjust! ### |
|
||||
with op.batch_alter_table('distribusi_files', schema=None) as batch_op: |
|
||||
batch_op.alter_column('type', |
|
||||
existing_type=sa.VARCHAR(length=300), |
|
||||
nullable=False) |
|
||||
|
|
||||
# ### end Alembic commands ### |
|
Loading…
Reference in new issue