Esempio n. 1
0
 def get_namespace(self, datatype, value):
     namespace = Widget.get_namespace(self, datatype, value)
     # Get nb products in table
     context = get_context()
     resource = context.resource
     namespace['nb_products'] = resource.handler.get_n_records()
     namespace['href'] = '%s/;view_table' % context.get_link(resource)
     return namespace
Esempio n. 2
0
 def get_namespace(self, datatype, value):
     namespace = Widget.get_namespace(self, datatype, value)
     # Get nb products in table
     context = get_context()
     resource = context.resource
     namespace['nb_products'] =  resource.handler.get_n_records()
     namespace['href'] = '%s/;view_table' % context.get_link(resource)
     return namespace
Esempio n. 3
0
 def get_namespace(self, datatype, value):
     context = get_context()
     product = context.resource
     shop = get_shop(product)
     return merge_dicts(
         Widget.get_namespace(self, datatype, value),
         shop_uri=product.get_pathto(shop),
         show_barcode=shop.get_property('barcode_format') != None,
         reference=product.get_property('reference'))
Esempio n. 4
0
 def get_namespace(self, datatype, value):
     context = get_context()
     product = context.resource
     shop = get_shop(product)
     return merge_dicts(
         Widget.get_namespace(self, datatype, value),
         shop_uri=product.get_pathto(shop),
         show_barcode=shop.get_property('barcode_format') != None,
         reference=product.get_property('reference'))
Esempio n. 5
0
 def get_namespace(self, datatype, value):
     namespace = Widget.get_namespace(self, datatype, value)
     context = get_context()
     if value and value != '1':
         try:
             day, month, year = value.split('/')
             day = int(day)
             month = int(month)
             year = int(year)
         except:
             day = month = year = None
     else:
         day = context.get_form_value('day', type=Integer)
         month = context.get_form_value('month', type=Integer)
         year = context.get_form_value('year', type=Integer)
     namespace['day'] = SelectWidget('day').to_html(Days, day)
     namespace['month'] = SelectWidget('month').to_html(Months, month)
     namespace['year'] = SelectWidget('year').to_html(Years, year)
     return namespace
Esempio n. 6
0
 def get_namespace(self, datatype, value):
     namespace = Widget.get_namespace(self, datatype, value)
     context = get_context()
     if value and value != '1':
         try:
             day, month, year = value.split('/')
             day = int(day)
             month = int(month)
             year = int(year)
         except:
             day = month = year = None
     else:
         day = context.get_form_value('day', type=Integer)
         month = context.get_form_value('month', type=Integer)
         year = context.get_form_value('year', type=Integer)
     namespace['day'] = SelectWidget('day').to_html(Days, day)
     namespace['month'] = SelectWidget('month').to_html(Months, month)
     namespace['year'] = SelectWidget('year').to_html(Years, year)
     return namespace
Esempio n. 7
0
 def get_namespace(self, datatype, value):
     namespace = Widget.get_namespace(self, datatype, value)
     namespace['title'] = self.title
     return namespace
Esempio n. 8
0
 def get_namespace(self, datatype, value):
     namespace = Widget.get_namespace(self, datatype, value)
     namespace['value1'], namespace['value2'] = datatype.default
     return namespace
Esempio n. 9
0
 def get_namespace(self, datatype, value):
     namespace = Widget.get_namespace(self, datatype, value)
     namespace['title'] = self.title
     return namespace
Esempio n. 10
0
 def get_namespace(self, datatype, value):
     namespace = Widget.get_namespace(self, datatype, value)
     namespace['value1'], namespace['value2'] = datatype.default
     return namespace