Ejemplo n.º 1
0
 def clean(self, value):
     value = super(StatusField, self).clean(value)
     try:
         values = parse_tags(value)
         if not values:
             return values
         objs = []
         names = i18n_fieldnames('name')
         for value in values:
             try:
                 filters = [Q(**{name: value}) for name in names]
                 objs.append(EntryTag.objects.get(
                     reduce(operator.or_, filters)))
             except EntryTag.DoesNotExist:
                 raise forms.ValidationError(
                     _("EntryTag does not exist: ") + value)
         return objs
     except ValueError:
         raise forms.ValidationError(
             _("Please provide a comma-separated list of tags."))
Ejemplo n.º 2
0
 def formfield_for_dbfield(self, db_field, **kwargs):
     field = super(ChecklistAdmin, self)\
         .formfield_for_dbfield(db_field, **kwargs)
     if db_field.name in i18n_fieldnames('comment'):
         field.widget = Textarea(attrs={'rows': 2, 'cols': 80})
     return field
Ejemplo n.º 3
0
 def formfield_for_dbfield(self, db_field, **kwargs):
     field = super(EntryInline, self)\
         .formfield_for_dbfield(db_field, **kwargs)
     if db_field.name in i18n_fieldnames('description'):
         field.widget.attrs['class'] = ''
     return field