summaryrefslogtreecommitdiff
path: root/archaeological_finds/forms.py
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@peacefrogs.net>2012-10-21 21:11:48 +0200
committerÉtienne Loks <etienne.loks@peacefrogs.net>2012-10-21 21:11:48 +0200
commitaf719ae697e5b03582b28f8a59eae39524cb8f7f (patch)
treee106614f06c452a4b879104d6b745b7e710928c1 /archaeological_finds/forms.py
parent7ccc29e5c41fe8a4a33c803adc4bbbd94d6ad1d7 (diff)
downloadIshtar-af719ae697e5b03582b28f8a59eae39524cb8f7f.tar.bz2
Ishtar-af719ae697e5b03582b28f8a59eae39524cb8f7f.zip
Djangoization - Major refactoring (step 13)
* Fix finds wizards * Clean-up an unecessary file
Diffstat (limited to 'archaeological_finds/forms.py')
-rw-r--r--archaeological_finds/forms.py31
1 files changed, 2 insertions, 29 deletions
diff --git a/archaeological_finds/forms.py b/archaeological_finds/forms.py
index 9c682b25a..c5480d8a8 100644
--- a/archaeological_finds/forms.py
+++ b/archaeological_finds/forms.py
@@ -34,13 +34,13 @@ from django.utils.translation import ugettext_lazy as _
from ishtar_common.models import Person, valid_id, valid_ids
from archaeological_operations.models import Period, OperationType
from archaeological_context_records.models import DatingType, DatingQuality
-from archaeological_warehouse.models import Warehouse, ContainerType, Container
+from archaeological_warehouse.models import Warehouse
import models
from ishtar_common import widgets
from ishtar_common.forms import FinalForm, FormSet, FloatField, \
formset_factory, get_now, get_form_selection, reverse_lazy
-from ishtar_common.forms_common import get_town_field, get_warehouse_field, \
+from ishtar_common.forms_common import get_town_field, \
SourceForm, SourceSelect, SourceDeletionForm, AuthorFormset
from archaeological_context_records.forms import RecordFormSelection
@@ -155,33 +155,6 @@ class FindMultipleFormSelection(forms.Form):
u"archaeological find."))
return self.cleaned_data
-class ContainerForm(forms.Form):
- form_label = _(u"Container")
- reference = forms.CharField(label=_(u"Reference"))
- container_type = forms.ChoiceField(label=_(u"Container type"), choices=[])
- location = forms.IntegerField(label=_(u"Warehouse"),
- widget=widgets.JQueryAutoComplete(
- reverse_lazy('autocomplete-warehouse'), associated_model=Warehouse,
- new=True),
- validators=[valid_id(Warehouse)])
- comment = forms.CharField(label=_(u"Comment"),
- widget=forms.Textarea, required=False)
-
- def __init__(self, *args, **kwargs):
- super(ContainerForm, self).__init__(*args, **kwargs)
- self.fields['container_type'].choices = ContainerType.get_types()
- self.fields['container_type'].help_text = ContainerType.get_help()
-
- def save(self, user):
- dct = self.cleaned_data
- dct['history_modifier'] = user
- dct['container_type'] = ContainerType.objects.get(
- pk=dct['container_type'])
- dct['location'] = Warehouse.objects.get(pk=dct['location'])
- new_item = Container(**dct)
- new_item.save()
- return new_item
-
def check_treatment(form_name, type_key, type_list=[], not_type_list=[]):
type_list = [models.TreatmentType.objects.get(txt_idx=tpe).pk
for tpe in type_list]