diff options
author | Étienne Loks <etienne.loks@peacefrogs.net> | 2013-12-23 13:13:40 +0100 |
---|---|---|
committer | Étienne Loks <etienne.loks@peacefrogs.net> | 2013-12-23 13:13:40 +0100 |
commit | b4dd6850d5bbe0e75bdcdfdd7d06ff28d3ebfc99 (patch) | |
tree | 30aba2cf351641d5fe1effb49c82a60612e5c742 /archaeological_files/forms.py | |
parent | 7f9d0d320f905d22a60089b9d19919f9d30bcd81 (diff) | |
download | Ishtar-b4dd6850d5bbe0e75bdcdfdd7d06ff28d3ebfc99.tar.bz2 Ishtar-b4dd6850d5bbe0e75bdcdfdd7d06ff28d3ebfc99.zip |
Work on operation document generation
Diffstat (limited to 'archaeological_files/forms.py')
-rw-r--r-- | archaeological_files/forms.py | 24 |
1 files changed, 1 insertions, 23 deletions
diff --git a/archaeological_files/forms.py b/archaeological_files/forms.py index b97ca9f15..755c565f2 100644 --- a/archaeological_files/forms.py +++ b/archaeological_files/forms.py @@ -33,7 +33,7 @@ from django.utils.translation import ugettext_lazy as _ from django.utils.safestring import mark_safe from ishtar_common.models import Person, PersonType, Town, Organization, \ - OrganizationType, valid_id, is_unique, DocumentTemplate + OrganizationType, valid_id, is_unique from archaeological_operations.models import ActType, AdministrativeAct import models from ishtar_common.forms import FinalForm, FormSet, ClosingDateFormSelection, \ @@ -224,28 +224,6 @@ class FinalFileDeleteForm(FinalForm): confirm_msg = " " confirm_end_msg = _(u"Would you like to delete this archaelogical file ?") -class DocumentGenerationAdminActForm(forms.Form): - _associated_model = AdministrativeAct - document_template = forms.ChoiceField(label=_("Template"), choices=[]) - - def __init__(self, *args, **kwargs): - super(DocumentGenerationAdminActForm, self).__init__(*args, **kwargs) - self.fields['document_template'].choices = DocumentTemplate.get_tuples( - dct={'associated_object_name': - 'archaeological_operations.models.AdministrativeAct'}) - - def save(self, object_pk): - try: - c_object = self._associated_model.objects.get(pk=object_pk) - except self._associated_model.DoesNotExist: - return - try: - template = DocumentTemplate.objects.get( - pk=self.cleaned_data.get('document_template')) - except DocumentTemplate.DoesNotExist: - return - return template.publish(c_object) - class AdministrativeActFileSelect(TableSelect): associated_file__towns = get_town_field() act_type = forms.ChoiceField(label=_("Act type"), choices=[]) |