From ab66e177c787f4982790b20079e0d00d78829058 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Sat, 24 Oct 2015 03:50:36 +0200 Subject: Imports: manage soft import (update) with unicity keys - script to initialize SRA file import --- archaeological_files_pdl/forms.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'archaeological_files_pdl/forms.py') diff --git a/archaeological_files_pdl/forms.py b/archaeological_files_pdl/forms.py index 0adfa087a..84931996a 100644 --- a/archaeological_files_pdl/forms.py +++ b/archaeological_files_pdl/forms.py @@ -309,8 +309,12 @@ class FileFormInstruction(forms.Form): c_year = datetime.date.today().year if 'year' in kwargs: c_year = kwargs.pop('year') + if 'data' in kwargs: + kwargs['data'][kwargs.get('prefix', '') + '-year'] = c_year + super(FileFormInstruction, self).__init__(*args, **kwargs) self.fields['year'].initial = c_year + self.fields['year'].widget.attrs.update({'readonly': 'readonly'}) c_num, lasts = 0, "" q = models.File.objects.filter(numeric_reference__isnull=False, -- cgit v1.2.3