diff options
| author | Étienne Loks <etienne.loks@peacefrogs.net> | 2011-06-29 13:27:09 +0200 | 
|---|---|---|
| committer | Étienne Loks <etienne.loks@peacefrogs.net> | 2011-06-29 13:27:09 +0200 | 
| commit | 529828b89b27da8f76e96fdede46bd16fec4468d (patch) | |
| tree | 7c483f9b207ccfa5b5391731f5ff5f03693fb42a /ishtar/ishtar_base/forms_common.py | |
| parent | 05c6d94c9547377c9979e9d860c6618ee898ef6e (diff) | |
| download | Ishtar-529828b89b27da8f76e96fdede46bd16fec4468d.tar.bz2 Ishtar-529828b89b27da8f76e96fdede46bd16fec4468d.zip | |
Sources modification and deletion for Operations (refs #497)
Diffstat (limited to 'ishtar/ishtar_base/forms_common.py')
| -rw-r--r-- | ishtar/ishtar_base/forms_common.py | 30 | 
1 files changed, 27 insertions, 3 deletions
| diff --git a/ishtar/ishtar_base/forms_common.py b/ishtar/ishtar_base/forms_common.py index aff263a3b..dae692b05 100644 --- a/ishtar/ishtar_base/forms_common.py +++ b/ishtar/ishtar_base/forms_common.py @@ -40,7 +40,7 @@ import models  import widgets  from forms import Wizard, FinalForm, FormSet, reverse_lazy, name_validator -def get_town_field(required=True): +def get_town_field(label=_(u"Town"), required=True):      help_text = _(u"<p>Type name, department code and/or postal code of the "      u"town you would like to select. The search is insensitive to case.</p>\n"      u"<p>Only the first twenty results are displayed but specifying the " @@ -51,7 +51,7 @@ def get_town_field(required=True):      return forms.IntegerField(           widget=widgets.JQueryAutoComplete("/" + settings.URL_PATH + \                       'autocomplete-town', associated_model=models.Town), -         validators=[models.valid_id(models.Town)], label=_(u"Town"), +         validators=[models.valid_id(models.Town)], label=label,           help_text=mark_safe(help_text), required=required)  class WarehouseForm(forms.Form): @@ -401,7 +401,9 @@ ParcelFormSet = formset_factory(ParcelForm, can_delete=True,                                  formset=ParcelFormSet)  ParcelFormSet.form_label = _(u"Parcels") -# sources management +###################### +# Sources management # +######################  class SourceWizard(Wizard):      model = None @@ -423,6 +425,28 @@ class SourceForm(forms.Form):          super(SourceForm, self).__init__(*args, **kwargs)          self.fields['source_type'].choices = models.SourceType.get_types() +class SourceSelect(forms.Form): +    authors = forms.IntegerField( +         widget=widgets.JQueryAutoComplete("/" + settings.URL_PATH + \ +                     'autocomplete-author', associated_model=models.Author), +         validators=[models.valid_id(models.Author)], label=_(u"Author"), +         required=False) + +    source_type = forms.ChoiceField(label=_("Source type"), choices=[]) + +    def __init__(self, *args, **kwargs): +        super(SourceSelect, self).__init__(*args, **kwargs) +        self.fields['source_type'].choices = models.SourceType.get_types() +        self.fields['source_type'].help_text = models.SourceType.get_help() + +class SourceDeletionForm(FinalForm): +    confirm_msg = " " +    confirm_end_msg = _(u"Would you like to delete this documentation?") + +###################### +# Authors management # +###################### +  class AuthorForm(forms.Form):      form_label = _(u"Author")      associated_models = {'person':models.Person, | 
