Feat: Assessment page complete and new Home page layout for marketing phase 1 of the customer acquisition plan and offering a demo and for trainers to join the alpha trials. Reporting images created for radar diagram of Command mastery by Command Category; line graph of single command progress measured by obedience level, response latency, and compliance duration over time; Calendar Entries page filtered to unpaid bill calendary entries created using dummy data created in web server as database implementation not yet started.
This commit is contained in:
61
forms/dog/calendar_entry.py
Normal file
61
forms/dog/calendar_entry.py
Normal file
@@ -0,0 +1,61 @@
|
||||
"""
|
||||
Project: PARTS Website
|
||||
Author: Edward Middleton-Smith
|
||||
Precision And Research Technology Systems Limited
|
||||
|
||||
Technology: Backend
|
||||
Feature: Calendar Entry Form
|
||||
|
||||
Description:
|
||||
Defines Flask-WTF form for handling user input on Calendar Entries page.
|
||||
"""
|
||||
|
||||
# IMPORTS
|
||||
# internal
|
||||
from business_objects.base import Base
|
||||
from business_objects.dog.calendar_entry_type import Calendar_Entry_Type
|
||||
# from business_objects.dog.calendar_entry import Calendar_Entry # Circular
|
||||
from helpers.helper_app import Helper_App
|
||||
# from models.model_view_store import Model_View_Store # circular
|
||||
# from models.model_view_base import Model_View_Base
|
||||
from forms.base import Form_Base
|
||||
import lib.argument_validation as av
|
||||
# external
|
||||
from flask import Flask, render_template, request, flash, redirect, url_for, current_app
|
||||
from flask_wtf import FlaskForm
|
||||
from wtforms import SelectField, BooleanField, StringField, SubmitField
|
||||
from wtforms.validators import DataRequired, Email, ValidationError
|
||||
import markupsafe
|
||||
from flask_wtf.recaptcha import RecaptchaField
|
||||
from abc import ABCMeta, abstractmethod
|
||||
import json
|
||||
|
||||
class Filters_Calendar_Entry(Form_Base):
|
||||
search = StringField(
|
||||
'Search'
|
||||
)
|
||||
id_calendar_entry_type = SelectField(
|
||||
'Type'
|
||||
, choices = [Form_Base.get_select_option_all()]
|
||||
, default = Form_Base.get_select_option_default_value()
|
||||
)
|
||||
active_only = BooleanField(
|
||||
'Active'
|
||||
, default = True
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json):
|
||||
_m = f'{cls.__qualname__}.from_json'
|
||||
Helper_App.console_log(f'{_m}\njson: {json}')
|
||||
filters = cls()
|
||||
filters.search.data = json[Base.FLAG_SEARCH]
|
||||
filters.id_calendar_entry_type = json[Calendar_Entry_Type.ATTR_ID_CALENDAR_ENTRY_TYPE]
|
||||
filters.active_only.data = av.input_bool(json[Base.FLAG_ACTIVE_ONLY], Base.FLAG_ACTIVE_ONLY, f'{cls.__name__}.from_json')
|
||||
return filters
|
||||
|
||||
def to_json(self):
|
||||
return {
|
||||
Base.FLAG_SEARCH: self.search.data
|
||||
, Base.FLAG_ACTIVE_ONLY: self.active_only.data
|
||||
}
|
||||
Reference in New Issue
Block a user