diff options
Diffstat (limited to 'archaeological_warehouse')
-rw-r--r-- | archaeological_warehouse/forms.py | 5 | ||||
-rw-r--r-- | archaeological_warehouse/wizards.py | 9 |
2 files changed, 13 insertions, 1 deletions
diff --git a/archaeological_warehouse/forms.py b/archaeological_warehouse/forms.py index 954c01918..2dc963ca0 100644 --- a/archaeological_warehouse/forms.py +++ b/archaeological_warehouse/forms.py @@ -18,6 +18,7 @@ # See the file COPYING for details. from collections import OrderedDict +import datetime from django import forms from django.conf import settings @@ -294,7 +295,9 @@ class BasePackagingForm(SelectFindBasketForm): associated_model=Person, new=True), validators=[valid_id(Person)]) start_date = forms.DateField( - label=_(u"Date"), required=False, widget=DatePicker) + label=_(u"Date"), required=False, widget=DatePicker, + initial=datetime.date.today + ) class FindPackagingFormSelection(FindMultipleFormSelection): diff --git a/archaeological_warehouse/wizards.py b/archaeological_warehouse/wizards.py index 41c5c5945..8ee2c2972 100644 --- a/archaeological_warehouse/wizards.py +++ b/archaeological_warehouse/wizards.py @@ -38,6 +38,15 @@ class ContainerSearch(SearchWizard): class PackagingWizard(TreatmentWizard): basket_step = 'base-packaging' + def get_form_initial(self, step, data=None): + initial = super(PackagingWizard, self).get_form_initial(step) + user = self.request.user + if step != 'base-packaging' or not getattr(user, 'ishtaruser', None) \ + or not user.ishtaruser.person: + return initial + initial['person'] = user.ishtaruser.person.pk + return initial + def save_model(self, dct, m2m, whole_associated_models, form_list, return_object): dct = self.get_extra_model(dct, form_list) |