summaryrefslogtreecommitdiff
path: root/archaeological_operations/models.py
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@peacefrogs.net>2013-02-06 18:24:49 +0100
committerÉtienne Loks <etienne.loks@peacefrogs.net>2013-02-06 18:24:49 +0100
commit9e48ded005a9a974566d5c43521d34f3b78f6956 (patch)
tree828819c4d1cfb9d193339b6b30ae737b745161df /archaeological_operations/models.py
parent8677ef523c12939daacc8a37c493c5c75e68ef2c (diff)
downloadIshtar-9e48ded005a9a974566d5c43521d34f3b78f6956.tar.bz2
Ishtar-9e48ded005a9a974566d5c43521d34f3b78f6956.zip
Work on imports
Diffstat (limited to 'archaeological_operations/models.py')
-rw-r--r--archaeological_operations/models.py17
1 files changed, 10 insertions, 7 deletions
diff --git a/archaeological_operations/models.py b/archaeological_operations/models.py
index 082a0072d..4342db912 100644
--- a/archaeological_operations/models.py
+++ b/archaeological_operations/models.py
@@ -33,18 +33,20 @@ if FILES_AVAILABLE:
from archaeological_files.models import File
class OperationType(GeneralType):
+ preventive = models.BooleanField(_(u"Is preventive"), default=True)
class Meta:
verbose_name = _(u"Operation type")
verbose_name_plural = _(u"Operation types")
@classmethod
def is_preventive(cls, ope_type_id, key=''):
- key = key or 'prev_excavation'
try:
- preventive = OperationType.objects.get(txt_idx=key).pk
- return ope_type_id == preventive
+ op_type = OperationType.objects.get(pk=ope_type_id)
except ObjectDoesNotExist:
return False
+ if not key:
+ return op_type.preventive
+ return key == op_type.txt_idx
class RemainType(GeneralType):
class Meta:
@@ -74,8 +76,9 @@ class Operation(BaseHistorizedItem, OwnPerms):
end_date = models.DateField(_(u"Closing date"), null=True, blank=True)
in_charge = models.ForeignKey(Person, related_name='+', null=True,
blank=True, verbose_name=_(u"In charge"))
- year = models.IntegerField(_(u"Year"))
- operation_code = models.IntegerField(_(u"Operation code"))
+ year = models.IntegerField(_(u"Year"), null=True, blank=True)
+ operation_code = models.IntegerField(_(u"Operation code"), null=True,
+ blank=True)
if FILES_AVAILABLE:
associated_file = models.ForeignKey(File, related_name='operations',
verbose_name=_(u"File"), blank=True, null=True)
@@ -110,8 +113,8 @@ class Operation(BaseHistorizedItem, OwnPerms):
_(u"Prescription on geoarchaeological context"), blank=True, null=True)
operator_reference = models.CharField(_(u"Operator reference"),
max_length=20, null=True, blank=True)
- common_name = models.CharField(_(u"Generic name"), max_length=120, null=True,
- blank=True)
+ common_name = models.CharField(_(u"Generic name"), max_length=120,
+ null=True, blank=True)
comment = models.TextField(_(u"Comment"), null=True, blank=True)
history = HistoricalRecords()