Feat(SQL): Location Get Many and Calc Stored Procedures created with logic using Location Link table.
This commit is contained in:
60
models/model_view_dog_location.py
Normal file
60
models/model_view_dog_location.py
Normal file
@@ -0,0 +1,60 @@
|
||||
"""
|
||||
Project: PARTS Website
|
||||
Author: Edward Middleton-Smith
|
||||
Precision And Research Technology Systems Limited
|
||||
|
||||
Technology: View Models
|
||||
Feature: Dog Locations View Model
|
||||
|
||||
Description:
|
||||
Data model for dog locations view
|
||||
"""
|
||||
|
||||
# internal
|
||||
from business_objects.dog.location import Location, Parameters_Location
|
||||
from datastores.datastore_dog import DataStore_Dog
|
||||
from models.model_view_dog_base import Model_View_Dog_Base
|
||||
from forms.dog.location import Filters_Location
|
||||
# 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_Location(Model_View_Dog_Base):
|
||||
FLAG_CAN_HAVE_BUTTON: ClassVar[str] = Location.FLAG_CAN_HAVE_BUTTON
|
||||
FLAG_HAND_SIGNAL_DEFAULT_DESCRIPTION: ClassVar[str] = Location.FLAG_HAND_SIGNAL_DEFAULT_DESCRIPTION
|
||||
filter_location_categories: list = None
|
||||
locations: list = None
|
||||
form_filters: Filters_Location = None
|
||||
form_filters_old: Filters_Location
|
||||
|
||||
@property
|
||||
def title(self):
|
||||
return 'Location'
|
||||
|
||||
def __init__(self, form_filters_old, hash_page_current=Model_View_Dog_Base.HASH_PAGE_DOG_LOCATIONS):
|
||||
_m = 'Model_View_Dog_Location.__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_location = Parameters_Location.get_default()
|
||||
self.filter_location_categories, filter_locations, errors = datastore.get_many_location(parameters_filter_location)
|
||||
self.form_filters.id_location_category.choices += [(str(location_category.id_location_category), location_category.name) for location_category in self.filter_location_categories]
|
||||
|
||||
Helper_App.console_log(f'Form filters: {self.form_filters}')
|
||||
parameters_filter_location = Parameters_Location.from_form_filters_location(self.form_filters)
|
||||
Helper_App.console_log(f'Query args: {parameters_filter_location}')
|
||||
location_categories, self.locations, errors = datastore.get_many_location(parameters_filter_location)
|
||||
|
||||
|
||||
"""
|
||||
@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