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:
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)
|
||||
"""
|
||||
Reference in New Issue
Block a user