|
@ -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 flask_login import current_user, login_required |
|
|
from models.distribusi_model import Distribusis |
|
|
from models.distribusi_model import Distribusis |
|
|
from models.distribusi_file_model import DistribusiFiles |
|
|
from models.distribusi_file_model import DistribusiFiles |
|
@ -31,7 +37,9 @@ def show_distribusi_files(distribusiname): |
|
|
@login_required |
|
|
@login_required |
|
|
def describe_file(file_id): |
|
|
def describe_file(file_id): |
|
|
distribusi_file = DistribusiFiles.query.filter_by(id=file_id).first() |
|
|
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( |
|
|
print( |
|
|
f"file: {describe_form.file_path} description: {describe_form.description.data}" |
|
|
f"file: {describe_form.file_path} description: {describe_form.description.data}" |
|
|
) |
|
|
) |
|
@ -41,14 +49,20 @@ def describe_file(file_id): |
|
|
print( |
|
|
print( |
|
|
f"file: {describe_form.file_path} alttext: {describe_form.alttext.data}" |
|
|
f"file: {describe_form.file_path} alttext: {describe_form.alttext.data}" |
|
|
) |
|
|
) |
|
|
distribusi_file_forms = get_distribusi_file_forms( |
|
|
distribusi = Distribusis.query.filter_by( |
|
|
distribusi_file.distribusi |
|
|
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): |
|
|
def get_distribusi_file_forms(distribusi_id): |
|
|
distribusi_file_forms = {} |
|
|
distribusi_file_forms = {} |
|
@ -57,7 +71,7 @@ def get_distribusi_file_forms(distribusi_id): |
|
|
).all() |
|
|
).all() |
|
|
for distribusi_file in distribusi_files: |
|
|
for distribusi_file in distribusi_files: |
|
|
describe_form = DescribeFilesForm( |
|
|
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.description.data = distribusi_file.description |
|
|
describe_form.alttext.data = distribusi_file.alttext |
|
|
describe_form.alttext.data = distribusi_file.alttext |
|
|