|
|
@ -1,4 +1,10 @@ |
|
|
|
from flask import Blueprint, render_template, redirect, url_for |
|
|
|
from flask import ( |
|
|
|
Blueprint, |
|
|
|
render_template, |
|
|
|
redirect, |
|
|
|
url_for, |
|
|
|
send_from_directory, |
|
|
|
) |
|
|
|
from flask_login import current_user, login_required |
|
|
|
from models.distribusi_model import Distribusis |
|
|
|
from models.distribusi_file_model import DistribusiFiles |
|
|
@ -31,7 +37,9 @@ def show_distribusi_files(distribusiname): |
|
|
|
@login_required |
|
|
|
def describe_file(file_id): |
|
|
|
distribusi_file = DistribusiFiles.query.filter_by(id=file_id).first() |
|
|
|
describe_form = DescribeFilesForm(distribusi_file.id, distribusi_file.path) |
|
|
|
describe_form = DescribeFilesForm( |
|
|
|
distribusi_file.id, distribusi_file.path, distribusi_file.type |
|
|
|
) |
|
|
|
print( |
|
|
|
f"file: {describe_form.file_path} description: {describe_form.description.data}" |
|
|
|
) |
|
|
@ -41,14 +49,20 @@ def describe_file(file_id): |
|
|
|
print( |
|
|
|
f"file: {describe_form.file_path} alttext: {describe_form.alttext.data}" |
|
|
|
) |
|
|
|
distribusi_file_forms = get_distribusi_file_forms( |
|
|
|
distribusi_file.distribusi |
|
|
|
distribusi = Distribusis.query.filter_by( |
|
|
|
id=distribusi_file.distribusi |
|
|
|
).first() |
|
|
|
return redirect( |
|
|
|
url_for( |
|
|
|
"describer.show_distribusi_files", |
|
|
|
distribusiname=distribusi.distribusiname, |
|
|
|
) |
|
|
|
return render_template( |
|
|
|
"describe.html", |
|
|
|
distribusi_file_forms=distribusi_file_forms, |
|
|
|
) |
|
|
|
|
|
|
|
@describer.route("/stash/<path:path>") |
|
|
|
def send_stash_file(path): |
|
|
|
return send_from_directory("stash", path) |
|
|
|
|
|
|
|
|
|
|
|
def get_distribusi_file_forms(distribusi_id): |
|
|
|
distribusi_file_forms = {} |
|
|
@ -57,7 +71,7 @@ def get_distribusi_file_forms(distribusi_id): |
|
|
|
).all() |
|
|
|
for distribusi_file in distribusi_files: |
|
|
|
describe_form = DescribeFilesForm( |
|
|
|
distribusi_file.id, distribusi_file.path |
|
|
|
distribusi_file.id, distribusi_file.path, distribusi_file.type |
|
|
|
) |
|
|
|
describe_form.description.data = distribusi_file.description |
|
|
|
describe_form.alttext.data = distribusi_file.alttext |
|
|
|