diff options
Diffstat (limited to 'archaeological_operations/widgets.py')
-rw-r--r-- | archaeological_operations/widgets.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/archaeological_operations/widgets.py b/archaeological_operations/widgets.py index 6c4ebe79a..e3c0cd2ea 100644 --- a/archaeological_operations/widgets.py +++ b/archaeological_operations/widgets.py @@ -17,15 +17,15 @@ # See the file COPYING for details. -from django import forms from django.forms import widgets from django.utils.safestring import mark_safe from django.utils.translation import ugettext_lazy as _ + class ParcelWidget(widgets.MultiWidget): def __init__(self, attrs=None): if not attrs: - attrs = {'class':'widget-parcel'} + attrs = {'class': 'widget-parcel'} elif 'class' not in attrs: attrs['class'] = 'widget-parcel' else: @@ -33,7 +33,7 @@ class ParcelWidget(widgets.MultiWidget): _widgets = ( widgets.TextInput(attrs=attrs), widgets.TextInput(attrs=attrs), - ) + ) super(ParcelWidget, self).__init__(_widgets, attrs) def decompress(self, value): @@ -44,9 +44,10 @@ class ParcelWidget(widgets.MultiWidget): def format_output(self, rendered_widgets): return u' / '.join(rendered_widgets) + class SelectParcelWidget(widgets.TextInput): def render(self, *args, **kwargs): render = super(SelectParcelWidget, self).render(*args, **kwargs) render += u" <button name='formset_add' value='add'>%s</button>" \ - % _(u"Add") + % _(u"Add") return mark_safe(render) |