Make our DateTimeFieldRenderer the default for datetime fields.

This commit is contained in:
Lance Edgar 2016-02-14 16:34:39 -06:00
parent e10b956bf7
commit a341acb4f0
8 changed files with 9 additions and 28 deletions

View file

@ -38,7 +38,7 @@ from rattail.gpc import GPC
from rattail.threads import Thread
from rattail.exceptions import LabelPrintingError
import formalchemy
import formalchemy as fa
from pyramid import httpexceptions
from pyramid.renderers import render_to_response
from webhelpers.html import tags
@ -227,11 +227,9 @@ class ProductsView(MasterView):
fs.unit_of_measure.set(renderer=forms.renderers.EnumFieldRenderer(enum.UNIT_OF_MEASURE))
fs.regular_price.set(renderer=forms.renderers.PriceFieldRenderer)
fs.current_price.set(renderer=forms.renderers.PriceFieldRenderer)
fs.last_sold.set(renderer=forms.renderers.DateTimeFieldRenderer(self.rattail_config))
fs.append(formalchemy.Field('current_price_ends',
value=lambda p: p.current_price.ends if p.current_price else None,
renderer=forms.renderers.DateTimeFieldRenderer(self.rattail_config)))
fs.append(fa.Field('current_price_ends', type=fa.types.DateTime,
value=lambda p: p.current_price.ends if p.current_price else None))
fs.configure(
include=[