diff options
author | Étienne Loks <etienne.loks@peacefrogs.net> | 2013-12-03 17:59:35 +0100 |
---|---|---|
committer | Étienne Loks <etienne.loks@peacefrogs.net> | 2013-12-03 17:59:35 +0100 |
commit | dfc53677e6fec7269e5383c410ac1cc7f259b7ea (patch) | |
tree | db74975f02072b2ecd98acc6c27004117e63adb0 /archaeological_files/forms.py | |
parent | 586031c40bdc132b8069f3d644cb03ce22d16043 (diff) | |
download | Ishtar-dfc53677e6fec7269e5383c410ac1cc7f259b7ea.tar.bz2 Ishtar-dfc53677e6fec7269e5383c410ac1cc7f259b7ea.zip |
Associate template to AdministrativActType - automatically associate the relevant template on administrativeact document generation (refs #1524)
Diffstat (limited to 'archaeological_files/forms.py')
-rw-r--r-- | archaeological_files/forms.py | 22 |
1 files changed, 0 insertions, 22 deletions
diff --git a/archaeological_files/forms.py b/archaeological_files/forms.py index 9affc0901..6bf2318bb 100644 --- a/archaeological_files/forms.py +++ b/archaeological_files/forms.py @@ -193,28 +193,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=[]) |