Files
dog_training/models/model_view_dog_command.py

60 lines
2.4 KiB
Python

"""
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 business_objects.dog.command import Command, Parameters_Command
from datastores.datastore_dog import DataStore_Dog
from models.model_view_dog_base import Model_View_Dog_Base
from forms.dog.command import Filters_Command
# from routes import bp_home
from helpers.helper_app import Helper_App
import 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)
"""