describe files start
This commit is contained in:
parent
8f960a1a3b
commit
8567af2ed4
31
verse/describer/forms/describe_file_form.py
Normal file
31
verse/describer/forms/describe_file_form.py
Normal file
@ -0,0 +1,31 @@
|
||||
"""Describe File Form to describe files in the distribusi archive"""
|
||||
|
||||
from flask_wtf import FlaskForm
|
||||
from wtforms import StringField, SubmitField
|
||||
|
||||
|
||||
class DescribeFileForm(FlaskForm):
|
||||
"""DescribeFileForm selection form."""
|
||||
|
||||
alttext = StringField(
|
||||
"Alt-text for this file:",
|
||||
validators=[
|
||||
validators.InputRequired(),
|
||||
Length(3, 255),
|
||||
],
|
||||
)
|
||||
searchtags = StringField(
|
||||
"Add search tags, seperated by commas. No need for the '#' sign:",
|
||||
validators=[
|
||||
validators.InputRequired(),
|
||||
Length(3, 500),
|
||||
],
|
||||
)
|
||||
description = StringField(
|
||||
"Description of this file:",
|
||||
validators=[
|
||||
validators.InputRequired(),
|
||||
Length(3, 4096),
|
||||
],
|
||||
)
|
||||
save = SubmitField("Save")
|
2
verse/describer/templates/describe.html
Normal file
2
verse/describer/templates/describe.html
Normal file
@ -0,0 +1,2 @@
|
||||
{% extends "base/base.html" %}
|
||||
{% block main %}
|
@ -17,6 +17,7 @@ def distribusi_file_with_type(full_path):
|
||||
|
||||
for root, dirs, files in os.walk("stash", topdown=True):
|
||||
files = list(filter(lambda f: not f.startswith("."), files))
|
||||
files = list(filter(lambda f: not f.endswith(".html"), files))
|
||||
for file in files:
|
||||
full_path = os.path.join(root, file)
|
||||
distribusi_file_with_type(full_path)
|
||||
|
@ -68,8 +68,8 @@ class UploadForm(FlaskForm):
|
||||
)
|
||||
|
||||
tags = StringField(
|
||||
"Add tags, seperated by commas. No need for the '#' sign:",
|
||||
validators=[validators.InputRequired(), Length(2, 500)],
|
||||
"Add search tags, seperated by commas. No need for the '#' sign:",
|
||||
validators=[validators.InputRequired(), Length(3, 500)],
|
||||
)
|
||||
|
||||
zipfile = FileField(
|
||||
|
@ -7,11 +7,12 @@ class DistribusiFiles(db.Model):
|
||||
__tablename__ = "distribusi_files"
|
||||
|
||||
id = db.Column(db.Integer, primary_key=True)
|
||||
type = db.Column(db.String(300), nullable=True, unique=False)
|
||||
type = db.Column(db.String(100), nullable=True, unique=False)
|
||||
distribusi = db.Column(db.Integer, db.ForeignKey("distribusis.id"))
|
||||
path = db.Column(db.String(4096), nullable=True, unique=False)
|
||||
description = db.Column(db.String(9), nullable=True, unique=False)
|
||||
alttext = db.Column(db.String(255), nullable=True, unique=False)
|
||||
tags = db.Column(db.String(500), nullable=True, unique=False)
|
||||
description = db.Column(db.String(9), nullable=True, unique=False)
|
||||
|
||||
def __repr__(self):
|
||||
return "<Distribusi_File %r>" % self.distribusiname
|
||||
|
Loading…
Reference in New Issue
Block a user