Make vendor field renderer show ID in readonly mode.

This commit is contained in:
Lance Edgar 2015-04-10 20:25:45 -05:00
parent e43ceda6bc
commit d8ee09916a

View file

@ -117,9 +117,14 @@ class VendorFieldRenderer(AutocompleteFieldRenderer):
""" """
Renderer for :class:`rattail.db.model.Vendor` instance fields. Renderer for :class:`rattail.db.model.Vendor` instance fields.
""" """
service_route = 'vendors.autocomplete' service_route = 'vendors.autocomplete'
def render_readonly(self, **kwargs):
vendor = self.raw_value
if not vendor:
return ''
return "{0} - {1}".format(vendor.id, vendor.name)
class PriceFieldRenderer(TextFieldRenderer): class PriceFieldRenderer(TextFieldRenderer):
""" """