Coverage for .tox / coverage / lib / python3.11 / site-packages / sideshow / web / views / shared.py: 100%
18 statements
« prev ^ index » next coverage.py v7.13.0, created at 2025-12-15 17:10 -0600
« prev ^ index » next coverage.py v7.13.0, created at 2025-12-15 17:10 -0600
1# -*- coding: utf-8; -*-
2################################################################################
3#
4# Sideshow -- Case/Special Order Tracker
5# Copyright © 2024-2025 Lance Edgar
6#
7# This file is part of Sideshow.
8#
9# Sideshow is free software: you can redistribute it and/or modify it
10# under the terms of the GNU General Public License as published by
11# the Free Software Foundation, either version 3 of the License, or
12# (at your option) any later version.
13#
14# Sideshow is distributed in the hope that it will be useful, but
15# WITHOUT ANY WARRANTY; without even the implied warranty of
16# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17# General Public License for more details.
18#
19# You should have received a copy of the GNU General Public License
20# along with Sideshow. If not, see <http://www.gnu.org/licenses/>.
21#
22################################################################################
23"""
24Shared View Logic
25"""
27from wuttaweb.forms.schema import UserRef
30class PendingMixin: # pylint: disable=too-few-public-methods
31 """
32 Mixin class with logic shared by Pending Customer and Pending
33 Product views.
34 """
36 def configure_form_pending(self, form): # pylint: disable=empty-docstring
37 """ """
38 f = form
39 obj = f.model_instance
41 # created
42 if self.creating:
43 f.remove("created")
44 else:
45 f.set_readonly("created")
47 # created_by
48 if self.creating:
49 f.remove("created_by")
50 else:
51 f.set_node("created_by", UserRef(self.request))
52 f.set_readonly("created_by")
54 # orders
55 if self.creating or self.editing:
56 f.remove("orders")
57 else:
58 f.set_grid("orders", self.make_orders_grid(obj))
60 # new_order_batches
61 if self.creating or self.editing:
62 f.remove("new_order_batches")
63 else:
64 f.set_grid("new_order_batches", self.make_new_order_batches_grid(obj))