Browse Source

describe files start

pull/12/head
crunk 6 months ago
parent
commit
8567af2ed4
  1. 31
      verse/describer/forms/describe_file_form.py
  2. 2
      verse/describer/templates/describe.html
  3. 1
      verse/file_crawler.py
  4. 4
      verse/forms/uploadform.py
  5. 5
      verse/models/distribusi_file_model.py

31
verse/describer/forms/describe_file_form.py

@ -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

@ -0,0 +1,2 @@
{% extends "base/base.html" %}
{% block main %}

1
verse/file_crawler.py

@ -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)

4
verse/forms/uploadform.py

@ -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(

5
verse/models/distribusi_file_model.py

@ -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…
Cancel
Save