Tweak fields for product view

This commit is contained in:
Lance Edgar 2016-11-29 15:30:05 -06:00
parent ee6d3195c5
commit 4498bc001f

View file

@ -263,24 +263,24 @@ class ProductsView(MasterView):
return price.product
raise httpexceptions.HTTPNotFound()
def configure_fieldset(self, fs):
fs.upc.set(renderer=forms.renderers.GPCFieldRenderer)
fs.brand.set(options=[])
fs.unit_of_measure.set(renderer=forms.renderers.EnumFieldRenderer(enum.UNIT_OF_MEASURE))
def _preconfigure_fieldset(self, fs):
fs.upc.set(label="UPC", renderer=forms.renderers.GPCFieldRenderer)
fs.brand.set(renderer=forms.renderers.BrandFieldRenderer, options=[])
fs.unit_of_measure.set(label="Unit of Measure",
renderer=forms.renderers.EnumFieldRenderer(self.enum.UNIT_OF_MEASURE))
fs.regular_price.set(renderer=forms.renderers.PriceFieldRenderer)
fs.current_price.set(renderer=forms.renderers.PriceFieldRenderer)
fs.append(fa.Field('current_price_ends', type=fa.types.DateTime,
value=lambda p: p.current_price.ends if p.current_price else None))
def configure_fieldset(self, fs):
fs.configure(
include=[
fs.upc.label("UPC"),
fs.brand.with_renderer(forms.renderers.BrandFieldRenderer),
fs.upc,
fs.brand,
fs.description,
fs.unit_size,
fs.unit_of_measure.label("Unit of Measure"),
fs.unit_of_measure,
fs.size,
fs.weighed,
fs.case_pack,
@ -300,7 +300,7 @@ class ProductsView(MasterView):
fs.not_for_sale,
fs.deleted,
fs.last_sold,
])
])
if not self.viewing:
del fs.regular_price
del fs.current_price