summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@peacefrogs.net>2013-04-30 16:26:37 +0200
committerÉtienne Loks <etienne.loks@peacefrogs.net>2013-04-30 16:26:37 +0200
commit55fda6c9bd1cd304137e38e195e641f6b29116ce (patch)
treeb5e0d804e5ab2f57b6ae71d4553e6c3e16d8cff2
parentdcae60f13e35d2b0298d8e184e32c0c6353bb520 (diff)
downloadIshtar-55fda6c9bd1cd304137e38e195e641f6b29116ce.tar.bz2
Ishtar-55fda6c9bd1cd304137e38e195e641f6b29116ce.zip
Add extra fields to Operation (fr specific) - many display improvment
-rw-r--r--archaeological_operations/forms.py11
-rw-r--r--archaeological_operations/templates/ishtar/sheet_operation.html2
-rw-r--r--archaeological_operations/views.py2
-rw-r--r--ishtar_common/models.py10
4 files changed, 17 insertions, 8 deletions
diff --git a/archaeological_operations/forms.py b/archaeological_operations/forms.py
index 0b2555148..7cd076dec 100644
--- a/archaeological_operations/forms.py
+++ b/archaeological_operations/forms.py
@@ -235,10 +235,21 @@ class OperationFormGeneral(forms.Form):
operator_reference = forms.CharField(label=_(u"Operator reference"),
required=False, max_length=20)
if settings.COUNTRY == 'fr':
+ negative_result = forms.NullBooleanField(required=False,
+ label=u"Résultat considéré comme négatif")
code_patriarche = forms.IntegerField(label=u"Code PATRIARCHE",
required=False)
code_dracar = forms.CharField(label=u"Code DRACAR", required=False,
validators=[validators.MaxLengthValidator(10)])
+ cira_date = forms.DateField(label=u"Date avis CIRA", required=False,
+ widget=widgets.JQueryDate)
+ cira_rapporteur = forms.IntegerField(label=u"Rapporteur CIRA",
+ widget=widgets.JQueryAutoComplete(reverse_lazy('autocomplete-person',
+ args=["_".join(
+ [unicode(PersonType.objects.get(txt_idx='head_scientist').pk),
+ unicode(PersonType.objects.get(txt_idx='sra_agent').pk)])]),
+ associated_model=Person, new=True),
+ validators=[valid_id(Person)], required=False)
comment = forms.CharField(label=_(u"Comment"), widget=forms.Textarea,
required=False)
diff --git a/archaeological_operations/templates/ishtar/sheet_operation.html b/archaeological_operations/templates/ishtar/sheet_operation.html
index 2fab55a39..6fdcfe62d 100644
--- a/archaeological_operations/templates/ishtar/sheet_operation.html
+++ b/archaeological_operations/templates/ishtar/sheet_operation.html
@@ -87,7 +87,7 @@
{% for act in item.administrative_act.all %}
<tr>
<td>{{act.signature_date.year}}</td>
- <td>{{act.ref_sra}}</td>
+ <td>{% if act.ref_sra %}{{act.ref_sra}}{% endif %}</td>
<td class='string'>{{act.act_type}}</td>
<td class="string">{{act.signature_date}}</td>
</tr>
diff --git a/archaeological_operations/views.py b/archaeological_operations/views.py
index e5bf16ce8..c2e0b135c 100644
--- a/archaeological_operations/views.py
+++ b/archaeological_operations/views.py
@@ -48,7 +48,7 @@ def autocomplete_patriarche(request, non_closed=True):
if non_closed:
query = query & Q(end_date__isnull=True)
limit = 15
- operations = models.Operation.objects.filter(query)[:limit]
+ operations = models.Operation.objects.filter(query).order_by('code_patriarche')[:limit]
data = json.dumps([{'id':operation.code_patriarche,
'value':operation.code_patriarche}
for operation in operations])
diff --git a/ishtar_common/models.py b/ishtar_common/models.py
index 61c7de7ff..8fcfacc9a 100644
--- a/ishtar_common/models.py
+++ b/ishtar_common/models.py
@@ -578,12 +578,10 @@ class Person(Address, OwnPerms) :
)
def __unicode__(self):
- lbl = u"%s %s" % (self.name, self.surname)
- if self.attached_to:
- lbl += settings.JOINT + unicode(self.attached_to)
- elif self.email:
- lbl += settings.JOINT + self.email
- return lbl
+ values = [unicode(getattr(self, attr))
+ for attr in ('surname', 'name', 'attached_to')
+ if getattr(self, attr)]
+ return u" ".join(values)
def full_label(self):
values = []