Feat(SQL, UI): 1. Dog Command Links page completed with get + set functionality. \n 2. Commands page and Command Categories page completed with get + set functionality.
This commit is contained in:
@@ -130,6 +130,7 @@ class Model_View_Base(BaseModel, ABC):
|
||||
# FLAG_NAME_SINGULAR: ClassVar[str] = Base.FLAG_NAME_SINGULAR
|
||||
FLAG_NAV_ADMIN_HOME: ClassVar[str] = 'navAdminHome'
|
||||
FLAG_NAV_CONTACT: ClassVar[str] = 'navContact'
|
||||
FLAG_NAV_DOG_COMMAND_CATEGORIES: ClassVar[str] = 'navDogCommandCategories'
|
||||
FLAG_NAV_DOG_COMMANDS: ClassVar[str] = 'navDogCommands'
|
||||
FLAG_NAV_DOG_DOGS: ClassVar[str] = 'navDogDogs'
|
||||
FLAG_NAV_DOG_DOG_COMMAND_LINKS: ClassVar[str] = 'navDogDogCommandLinks'
|
||||
@@ -157,15 +158,16 @@ class Model_View_Base(BaseModel, ABC):
|
||||
FLAG_USER: ClassVar[str] = User.FLAG_USER
|
||||
FLAG_WEBSITE: ClassVar[str] = Base.FLAG_WEBSITE
|
||||
HASH_GET_ALTCHA_CHALLENGE: ClassVar[str] = '/altcha/create-challenge'
|
||||
HASH_GET_DOG_SCRIPTS_SHARED: ClassVar[str] = '/dog/scripts_shared'
|
||||
HASH_GET_DOG_SCRIPTS_SHARED: ClassVar[str] = '/dog/scripts-shared'
|
||||
HASH_PAGE_ACCESSIBILITY_REPORT: ClassVar[str] = '/accessibility-report'
|
||||
HASH_PAGE_ACCESSIBILITY_STATEMENT: ClassVar[str] = '/accessibility-statement'
|
||||
HASH_PAGE_ADMIN_HOME: ClassVar[str] = '/admin'
|
||||
HASH_PAGE_CONTACT: ClassVar[str] = '/contact'
|
||||
HASH_PAGE_CONTACT_SUCCESS: ClassVar[str] = '/contact-success'
|
||||
HASH_PAGE_DATA_RETENTION_SCHEDULE: ClassVar[str] = '/retention-schedule'
|
||||
HASH_PAGE_DOG_COMMAND_CATEGORIES: ClassVar[str] = '/dog/command-categories'
|
||||
HASH_PAGE_DOG_COMMANDS: ClassVar[str] = '/dog/commands'
|
||||
HASH_PAGE_DOG_DOG_COMMAND_LINKS: ClassVar[str] = '/dog/dog_command_links'
|
||||
HASH_PAGE_DOG_DOG_COMMAND_LINKS: ClassVar[str] = '/dog/dog-command-links'
|
||||
HASH_PAGE_DOG_DOGS: ClassVar[str] = '/dog/dogs'
|
||||
HASH_PAGE_DOG_HOME: ClassVar[str] = '/dog/home'
|
||||
HASH_PAGE_ERROR_NO_PERMISSION: ClassVar[str] = '/error'
|
||||
@@ -175,6 +177,9 @@ class Model_View_Base(BaseModel, ABC):
|
||||
HASH_PAGE_USER_ACCOUNT: ClassVar[str] = '/user'
|
||||
HASH_PAGE_USER_LOGIN: ClassVar[str] = '/login'
|
||||
HASH_PAGE_USER_LOGOUT: ClassVar[str] = '/logout'
|
||||
HASH_SAVE_DOG_COMMAND: ClassVar[str] = '/dog/save-command'
|
||||
HASH_SAVE_DOG_COMMAND_CATEGORY: ClassVar[str] = '/dog/save-command-category'
|
||||
HASH_SAVE_DOG_DOG_COMMAND_LINK: ClassVar[str] = '/dog/save-dog-command-link'
|
||||
ID_BUTTON_ADD: ClassVar[str] = 'buttonAdd'
|
||||
ID_BUTTON_APPLY_FILTERS: ClassVar[str] = 'buttonApplyFilters'
|
||||
ID_BUTTON_CANCEL: ClassVar[str] = 'buttonCancel'
|
||||
@@ -304,4 +309,7 @@ class Model_View_Base(BaseModel, ABC):
|
||||
def jsonify(data):
|
||||
return jsonify(data)
|
||||
def get_mail_contact_public(self):
|
||||
return self.app.config['MAIL_CONTACT_PUBLIC']
|
||||
return self.app.config['MAIL_CONTACT_PUBLIC']
|
||||
@staticmethod
|
||||
def format_null_string_as_blank(string):
|
||||
return '' if string is None else string
|
||||
60
models/model_view_dog_command.py
Normal file
60
models/model_view_dog_command.py
Normal file
@@ -0,0 +1,60 @@
|
||||
"""
|
||||
Project: PARTS Website
|
||||
Author: Edward Middleton-Smith
|
||||
Precision And Research Technology Systems Limited
|
||||
|
||||
Technology: View Models
|
||||
Feature: Store Permutations View Model
|
||||
|
||||
Description:
|
||||
Data model for store permutations view
|
||||
"""
|
||||
|
||||
# internal
|
||||
from dog_training.business_objects.dog.command import Command, Parameters_Command
|
||||
from dog_training.datastores.datastore_dog import DataStore_Dog
|
||||
from dog_training.models.model_view_dog_base import Model_View_Dog_Base
|
||||
from dog_training.forms.dog.command import Filters_Command
|
||||
# from routes import bp_home
|
||||
from dog_training.helpers.helper_app import Helper_App
|
||||
import dog_training.lib.argument_validation as av
|
||||
|
||||
# external
|
||||
from pydantic import BaseModel
|
||||
from typing import ClassVar
|
||||
|
||||
class Model_View_Dog_Command(Model_View_Dog_Base):
|
||||
FLAG_CAN_HAVE_BUTTON: ClassVar[str] = Command.FLAG_CAN_HAVE_BUTTON
|
||||
FLAG_HAND_SIGNAL_DEFAULT_DESCRIPTION: ClassVar[str] = Command.FLAG_HAND_SIGNAL_DEFAULT_DESCRIPTION
|
||||
filter_command_categories: list = None
|
||||
commands: list = None
|
||||
form_filters: Filters_Command = None
|
||||
form_filters_old: Filters_Command
|
||||
|
||||
@property
|
||||
def title(self):
|
||||
return 'Command'
|
||||
|
||||
def __init__(self, form_filters_old, hash_page_current=Model_View_Dog_Base.HASH_PAGE_DOG_COMMANDS):
|
||||
_m = 'Model_View_Dog_Command.__init__'
|
||||
Helper_App.console_log(f'{_m}\nstarting...')
|
||||
super().__init__(hash_page_current=hash_page_current, form_filters_old=form_filters_old)
|
||||
self.form_filters = form_filters_old
|
||||
datastore = DataStore_Dog()
|
||||
|
||||
parameters_filter_command = Parameters_Command.get_default()
|
||||
self.filter_command_categories, filter_commands, errors = datastore.get_many_command(parameters_filter_command)
|
||||
self.form_filters.id_command_category.choices += [(str(command_category.id_command_category), command_category.name) for command_category in self.filter_command_categories]
|
||||
|
||||
Helper_App.console_log(f'Form filters: {self.form_filters}')
|
||||
parameters_filter_command = Parameters_Command.from_form_filters_command(self.form_filters)
|
||||
Helper_App.console_log(f'Query args: {parameters_filter_command}')
|
||||
command_categories, self.commands, errors = datastore.get_many_command(parameters_filter_command)
|
||||
|
||||
|
||||
"""
|
||||
@classmethod
|
||||
def save_categories(cls, comment, list_categories):
|
||||
_m = f'{cls.__name__}.save_categories'
|
||||
return DataStore_Store_Product_Category().save_categories(comment, list_categories)
|
||||
"""
|
||||
54
models/model_view_dog_command_category.py
Normal file
54
models/model_view_dog_command_category.py
Normal file
@@ -0,0 +1,54 @@
|
||||
"""
|
||||
Project: PARTS Website
|
||||
Author: Edward Middleton-Smith
|
||||
Precision And Research Technology Systems Limited
|
||||
|
||||
Technology: View Models
|
||||
Feature: Store Permutations View Model
|
||||
|
||||
Description:
|
||||
Data model for store permutations view
|
||||
"""
|
||||
|
||||
# internal
|
||||
from dog_training.business_objects.dog.command import Parameters_Command
|
||||
from dog_training.business_objects.dog.command_category import Command_Category
|
||||
from dog_training.datastores.datastore_dog import DataStore_Dog
|
||||
from dog_training.models.model_view_dog_base import Model_View_Dog_Base
|
||||
from dog_training.forms.dog.command_category import Filters_Command_Category
|
||||
# from routes import bp_home
|
||||
from dog_training.helpers.helper_app import Helper_App
|
||||
import dog_training.lib.argument_validation as av
|
||||
|
||||
# external
|
||||
from pydantic import BaseModel
|
||||
from typing import ClassVar
|
||||
|
||||
class Model_View_Dog_Command_Category(Model_View_Dog_Base):
|
||||
command_categories: list = None
|
||||
form_filters: Filters_Command_Category = None
|
||||
form_filters_old: Filters_Command_Category
|
||||
|
||||
@property
|
||||
def title(self):
|
||||
return 'Command Category'
|
||||
|
||||
def __init__(self, form_filters_old, hash_page_current=Model_View_Dog_Base.HASH_PAGE_DOG_COMMAND_CATEGORIES):
|
||||
_m = 'Model_View_Dog_Command_Category.__init__'
|
||||
Helper_App.console_log(f'{_m}\nstarting...')
|
||||
super().__init__(hash_page_current=hash_page_current, form_filters_old=form_filters_old)
|
||||
self.form_filters = form_filters_old
|
||||
datastore = DataStore_Dog()
|
||||
|
||||
Helper_App.console_log(f'Form filters: {self.form_filters}')
|
||||
parameters_filter_command = Parameters_Command.from_form_filters_command_category(self.form_filters)
|
||||
Helper_App.console_log(f'Query args: {parameters_filter_command}')
|
||||
self.command_categories, commands, errors = datastore.get_many_command(parameters_filter_command)
|
||||
|
||||
|
||||
"""
|
||||
@classmethod
|
||||
def save_categories(cls, comment, list_categories):
|
||||
_m = f'{cls.__name__}.save_categories'
|
||||
return DataStore_Store_Product_Category().save_categories(comment, list_categories)
|
||||
"""
|
||||
@@ -47,26 +47,14 @@ class Model_View_Dog_Dog_Command_Link(Model_View_Dog_Base):
|
||||
datastore = DataStore_Dog()
|
||||
parameters_filter_dog = Parameters_Dog.get_default()
|
||||
self.filter_dogs, errors = datastore.get_many_dog(parameters_filter_dog)
|
||||
self.form_filters.id_dog.choices += [(str(dog.id_dog), dog.name) for dog in self.filter_dogs]
|
||||
|
||||
parameters_filter_command = Parameters_Command.get_default()
|
||||
self.filter_command_categories, self.filter_commands, errors = datastore.get_many_command(parameters_filter_command)
|
||||
self.form_filters.id_command_category.choices += [(str(command_category.id_command_category), command_category.name) for command_category in self.filter_command_categories]
|
||||
self.form_filters.id_command.choices += [(str(command.id_command), command.name) for command in self.filter_commands]
|
||||
|
||||
Helper_App.console_log(f'Form filters: {self.form_filters}')
|
||||
parameters_filter_dog_command_link = Parameters_Dog_Command_Link.from_form_filters_dog_command_link(self.form_filters)
|
||||
Helper_App.console_log(f'Query args: {parameters_filter_dog_command_link}')
|
||||
self.dog_command_links, errors = datastore.get_many_dog_command_link(parameters_filter_dog_command_link)
|
||||
|
||||
# Helper_App.console_log(f'dogs: {self.filter_dogs}')
|
||||
# Helper_App.console_log(f'commands: {self.filter_commands}')
|
||||
# Helper_App.console_log(f'links: {self.dog_command_links}')
|
||||
|
||||
self.form_filters.id_dog.choices += [(str(dog.id_dog), dog.name) for dog in self.filter_dogs]
|
||||
self.form_filters.id_command_category.choices += [(str(command_category.id_command_category), command_category.name) for command_category in self.filter_command_categories]
|
||||
self.form_filters.id_command.choices += [(str(command.id_command), command.name) for command in self.filter_commands]
|
||||
|
||||
"""
|
||||
@classmethod
|
||||
def save_categories(cls, comment, list_categories):
|
||||
_m = f'{cls.__name__}.save_categories'
|
||||
return DataStore_Store_Product_Category().save_categories(comment, list_categories)
|
||||
"""
|
||||
self.dog_command_links, errors = datastore.get_many_dog_command_link(parameters_filter_dog_command_link)
|
||||
Reference in New Issue
Block a user