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