web/formfields.py
branchstable
changeset 2091 a7ea618e5478
parent 2086 be76ce00a05e
child 2095 897732d3ee5a
equal deleted inserted replaced
2090:089d1705c89c 2091:a7ea618e5478
    99 
    99 
   100     def __repr__(self):
   100     def __repr__(self):
   101         return self.__unicode__().encode('utf-8')
   101         return self.__unicode__().encode('utf-8')
   102 
   102 
   103     def init_widget(self, widget):
   103     def init_widget(self, widget):
   104         if widget is None and self.choices:
       
   105             widget = Select()
       
   106         if widget is not None:
   104         if widget is not None:
   107             self.widget = widget
   105             self.widget = widget
       
   106         elif self.choices and not self.widget.vocabulary_widget:
       
   107             self.widget = Select()
   108         if isinstance(self.widget, type):
   108         if isinstance(self.widget, type):
   109             self.widget = self.widget()
   109             self.widget = self.widget()
   110 
   110 
   111     def set_name(self, name):
   111     def set_name(self, name):
   112         """automatically set .id and .label when name is set"""
   112         """automatically set .id and .label when name is set"""