summaryrefslogtreecommitdiff
path: root/archaeological_files
diff options
context:
space:
mode:
Diffstat (limited to 'archaeological_files')
-rw-r--r--archaeological_files/forms.py15
-rw-r--r--archaeological_files/locale/fr/LC_MESSAGES/django.po169
-rw-r--r--archaeological_files/models.py43
3 files changed, 103 insertions, 124 deletions
diff --git a/archaeological_files/forms.py b/archaeological_files/forms.py
index 4364829b2..d2e31d80c 100644
--- a/archaeological_files/forms.py
+++ b/archaeological_files/forms.py
@@ -42,7 +42,7 @@ from ishtar_common.forms import FinalForm, FormSet, ClosingDateFormSelection, \
from ishtar_common.forms_common import get_town_field, get_person_field
from archaeological_operations.forms import AdministrativeActOpeForm, \
AdministrativeActOpeFormSelection, FinalAdministrativeActDeleteForm, \
- ParcelField
+ ParcelField, SLICING
from ishtar_common import widgets
GENERAL_CONTRACTOR, created = PersonType.objects.get_or_create(
@@ -122,29 +122,36 @@ class FileFormSelection(forms.Form):
raise forms.ValidationError(_(u"You should select a file."))
return cleaned_data
-SLICING = (('year',_(u"years")), ("month",_(u"months")))
DATE_SOURCE = (('creation',_(u"Creation date")),
("reception",_(u"Reception date")))
class DashboardForm(forms.Form):
slicing = forms.ChoiceField(label=_("Slicing"), choices=SLICING,
required=False)
+ department_detail = forms.BooleanField(label=_("Department detail"),
+ required=False)
date_source = forms.ChoiceField(label=_("Date get from"),
choices=DATE_SOURCE, required=False)
file_type = forms.ChoiceField(label=_("File type"), choices=[],
required=False)
saisine_type = forms.ChoiceField(label=_("Saisine type"), choices=[],
required=False)
- after = forms.DateField(label=_(u"Creation date after"),
+ after = forms.DateField(label=_(u"Date after"),
widget=widgets.JQueryDate, required=False)
- before = forms.DateField(label=_(u"Creation date before"),
+ before = forms.DateField(label=_(u"Date before"),
widget=widgets.JQueryDate, required=False)
def __init__(self, *args, **kwargs):
+ if 'prefix' not in kwargs:
+ kwargs['prefix'] = 'files'
super(DashboardForm, self).__init__(*args, **kwargs)
self.fields['saisine_type'].choices = models.SaisineType.get_types()
self.fields['file_type'].choices = models.FileType.get_types()
+ def get_show_detail(self):
+ return hasattr(self, 'cleaned_data') and \
+ self.cleaned_data.get('department_detail')
+
def get_date_source(self):
date_source = 'creation'
if hasattr(self, 'cleaned_data') and \
diff --git a/archaeological_files/locale/fr/LC_MESSAGES/django.po b/archaeological_files/locale/fr/LC_MESSAGES/django.po
index f2951cc68..fd733daa3 100644
--- a/archaeological_files/locale/fr/LC_MESSAGES/django.po
+++ b/archaeological_files/locale/fr/LC_MESSAGES/django.po
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: alpha\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2014-10-15 01:32+0200\n"
+"POT-Creation-Date: 2014-10-21 00:45+0200\n"
"PO-Revision-Date: 2010-12-09\n"
"Last-Translator: Étienne Loks <etienne.loks at peacefrogs net>\n"
"Language-Team: \n"
@@ -18,29 +18,29 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=n>1;\n"
-#: forms.py:55 forms.py:169 forms.py:209 forms.py:320 forms.py:360
-#: models.py:67 templates/ishtar/sheet_file.html:98
+#: forms.py:55 forms.py:188 forms.py:228 forms.py:339 forms.py:379
+#: models.py:68 templates/ishtar/sheet_file.html:98
#: templates/ishtar/sheet_file.html:126
msgid "Year"
msgstr "Année"
-#: forms.py:56 forms.py:173 forms.py:211 forms.py:359 models.py:69
+#: forms.py:56 forms.py:192 forms.py:230 forms.py:378 models.py:70
msgid "Numeric reference"
msgstr "Référence numérique"
-#: forms.py:58 forms.py:175 forms.py:362
+#: forms.py:58 forms.py:194 forms.py:381
msgid "Other reference"
msgstr "Autre référence"
-#: forms.py:60 forms.py:342
+#: forms.py:60 forms.py:361
msgid "File name"
msgstr "Nom du dossier"
-#: forms.py:61 forms.py:130 forms.py:180 models.py:74
+#: forms.py:61 forms.py:135 forms.py:199 models.py:75
msgid "File type"
msgstr "Type de dossier"
-#: forms.py:62 forms.py:132 forms.py:248
+#: forms.py:62 forms.py:137 forms.py:267
msgid "Saisine type"
msgstr "Type de saisine"
@@ -52,23 +52,23 @@ msgstr "Parcelle (section/numéro)"
msgid "Is active?"
msgstr "Est actif ?"
-#: forms.py:66 forms.py:222 forms.py:345 models.py:81
+#: forms.py:66 forms.py:241 forms.py:364 models.py:82
msgid "General contractor"
msgstr "Aménageur"
-#: forms.py:73 forms.py:352
+#: forms.py:73 forms.py:371
msgid "Organization of general contractor"
msgstr "Organisation de l'aménageur"
-#: forms.py:80 forms.py:364 templates/ishtar/sheet_file.html:102
+#: forms.py:80 forms.py:383 templates/ishtar/sheet_file.html:102
msgid "In charge"
msgstr "Responsable"
-#: forms.py:87 forms.py:373
+#: forms.py:87 forms.py:392
msgid "Created by"
msgstr "Créé par"
-#: forms.py:94 forms.py:241 forms.py:371 models.py:90
+#: forms.py:94 forms.py:260 forms.py:390 models.py:91
msgid "Permit reference"
msgstr "Référence du permis"
@@ -80,141 +80,141 @@ msgstr "Recherche de dossiers archéologiques"
msgid "You should select a file."
msgstr "Vous devez sélectionner un dossier archéologique."
-#: forms.py:125
-msgid "years"
-msgstr "années"
+#: forms.py:125 forms.py:197 models.py:96
+msgid "Creation date"
+msgstr "Date de création"
-#: forms.py:125
-msgid "months"
-msgstr "mois"
+#: forms.py:126 forms.py:269 models.py:98
+msgid "Reception date"
+msgstr "Date de réception"
-#: forms.py:128
+#: forms.py:129
msgid "Slicing"
msgstr "Découpage"
-#: forms.py:134
-msgid "Creation date after"
-msgstr "Date de création après"
+#: forms.py:131
+msgid "Department detail"
+msgstr "Détail par département"
-#: forms.py:136
-msgid "Creation date before"
-msgstr "Date de création avant"
+#: forms.py:133
+msgid "Date get from"
+msgstr "Date utilisée"
-#: forms.py:159 templates/ishtar/sheet_file.html:24
+#: forms.py:139
+msgid "Date after"
+msgstr "Date après"
+
+#: forms.py:141
+msgid "Date before"
+msgstr "Date avant"
+
+#: forms.py:178 templates/ishtar/sheet_file.html:24
msgid "General"
msgstr "Général"
-#: forms.py:163 models.py:76
+#: forms.py:182 models.py:77
msgid "Person in charge"
msgstr "Responsable"
-#: forms.py:177 models.py:73
+#: forms.py:196 models.py:74
msgid "Name"
msgstr "Nom"
-#: forms.py:178 models.py:95
-msgid "Creation date"
-msgstr "Date de création"
-
-#: forms.py:181 models.py:99
+#: forms.py:200 models.py:100
msgid "Related file"
msgstr "Dossier en relation avec"
-#: forms.py:185 forms.py:291 models.py:115 templates/ishtar/sheet_file.html:85
+#: forms.py:204 forms.py:310 models.py:116 templates/ishtar/sheet_file.html:85
msgid "Comment"
msgstr "Commentaire"
-#: forms.py:189 models.py:106
+#: forms.py:208 models.py:107
msgid "Total surface (m²)"
msgstr "Surface totale des terrains (m²)"
-#: forms.py:192 models.py:110
+#: forms.py:211 models.py:111
msgid "Main address"
msgstr "Adresse des terrains"
-#: forms.py:193 models.py:111
+#: forms.py:212 models.py:112
msgid "Main address - complement"
msgstr "Adresse des terrains - complément"
-#: forms.py:204
+#: forms.py:223
#, python-format
msgid "<br/>(last recorded: %s)"
msgstr "<br/>(dernier enregistrement : %s)"
-#: forms.py:217
+#: forms.py:236
msgid "Preventive informations"
msgstr "Information archéologie préventive"
-#: forms.py:231 models.py:86
+#: forms.py:250 models.py:87
msgid "Responsible for town planning service"
msgstr "Responsable au service instructeur"
-#: forms.py:239 models.py:52 models.py:88
+#: forms.py:258 models.py:52 models.py:89
msgid "Permit type"
msgstr "Type de permis"
-#: forms.py:244 models.py:109
+#: forms.py:263 models.py:110
msgid "Total developed surface (m²)"
msgstr "Surface totale aménagée (m²)"
-#: forms.py:250 models.py:97
-msgid "Reception date"
-msgstr "Date de réception"
-
-#: forms.py:261 templates/ishtar/sheet_file.html:75
+#: forms.py:280 templates/ishtar/sheet_file.html:75
#: templates/ishtar/dashboards/dashboard_file.html:42
msgid "Research archaeology"
msgstr "Archéologie programmée"
-#: forms.py:269 models.py:118 templates/ishtar/sheet_file.html:76
+#: forms.py:288 models.py:119 templates/ishtar/sheet_file.html:76
msgid "Departments"
msgstr "Départements"
-#: forms.py:279 models.py:130
+#: forms.py:298 models.py:131
msgid "Scientist in charge"
msgstr "Responsable scientifique"
-#: forms.py:281 models.py:123 templates/ishtar/sheet_file.html:78
+#: forms.py:300 models.py:124 templates/ishtar/sheet_file.html:78
msgid "Requested operation type"
msgstr "Type d'opération demandée"
-#: forms.py:283
+#: forms.py:302
msgid "Lead organization"
msgstr "Organisation porteuse du projet"
-#: forms.py:300 models.py:134 templates/ishtar/sheet_file.html:83
+#: forms.py:319 models.py:135 templates/ishtar/sheet_file.html:83
msgid "Classified area"
msgstr "Au sein d'un site classé"
-#: forms.py:302 models.py:136 templates/ishtar/sheet_file.html:84
+#: forms.py:321 models.py:137 templates/ishtar/sheet_file.html:84
msgid "Protected area"
msgstr "Au sein d'un secteur sauvegardé"
-#: forms.py:313
+#: forms.py:332
msgid "Would you like to close this archaeological file?"
msgstr "Voulez vous clore ce dossier archéologique ?"
-#: forms.py:317
+#: forms.py:336
msgid "Would you like to delete this archaelogical file ?"
msgstr "Voulez vous supprimer ce dossier archéologique ?"
-#: forms.py:321
+#: forms.py:340
msgid "Index"
msgstr "Index"
-#: forms.py:325 forms.py:337 forms.py:402
+#: forms.py:344 forms.py:356 forms.py:421
msgid "Act type"
msgstr "Type d'acte"
-#: forms.py:338
+#: forms.py:357
msgid "Signature date after"
msgstr "Date de signature après"
-#: forms.py:340
+#: forms.py:359
msgid "Signature date before"
msgstr "Date de signature avant"
-#: ishtar_menu.py:30 models.py:150 templates/ishtar/sheet_file.html:6
+#: ishtar_menu.py:30 models.py:151 templates/ishtar/sheet_file.html:6
msgid "Archaeological file"
msgstr "Dossier"
@@ -258,7 +258,7 @@ msgstr "Tableau de bord"
msgid "General informations"
msgstr "Informations générales"
-#: ishtar_menu.py:73 models.py:151
+#: ishtar_menu.py:73 models.py:152
#: templates/ishtar/dashboards/dashboard_file.html:8
msgid "Archaeological files"
msgstr "Dossiers archéologiques"
@@ -279,75 +279,75 @@ msgstr "Types de permis"
msgid "Delay (in days)"
msgstr "Delai (en jours)"
-#: models.py:71
+#: models.py:72
msgid "Internal reference"
msgstr "Référence interne"
-#: models.py:92
+#: models.py:93
msgid "Closing date"
msgstr "Date de clotûre"
-#: models.py:93
+#: models.py:94
msgid "Towns"
msgstr "Communes"
-#: models.py:104
+#: models.py:105
msgid "Ref. number"
msgstr "Réf. numérique"
-#: models.py:113
+#: models.py:114
msgid "Main address - postal code"
msgstr "Adresse des terrains - code postal"
-#: models.py:125 templates/ishtar/sheet_file.html:79
+#: models.py:126 templates/ishtar/sheet_file.html:79
msgid "Organization"
msgstr "Organisation"
-#: models.py:131
+#: models.py:132
msgid "Research archaeology comment"
msgstr "Commentaire archéologie programmée"
-#: models.py:145
+#: models.py:146
msgid "Cached name"
msgstr "Nom en cache"
-#: models.py:153
+#: models.py:154
msgid "Can view all Archaelogical file"
msgstr "Peut voir tous les dossier archéologique"
-#: models.py:154
+#: models.py:155
msgid "Can view own Archaelogical file"
msgstr "Peut voir son propre Dossier"
-#: models.py:155
+#: models.py:156
msgid "Can add own Archaelogical file"
msgstr "Peut ajouter son propre Dossier"
-#: models.py:156
+#: models.py:157
msgid "Can change own Archaelogical file"
msgstr "Peut changer son propre Dossier"
-#: models.py:157
+#: models.py:158
msgid "Can delete own Archaelogical file"
msgstr "Peut supprimer son propre Dossier"
-#: models.py:158
+#: models.py:159
msgid "Can close File"
msgstr "Peut fermer un dossier"
-#: models.py:164
+#: models.py:165
msgid "FILE"
msgstr "DOSSIER"
-#: models.py:312
+#: models.py:278
msgid "Intercommunal"
msgstr "Intercommunal"
-#: models.py:376
+#: models.py:342
msgid "File"
msgstr "Dossier"
-#: models.py:377
+#: models.py:343
msgid "Department"
msgstr "Département"
@@ -679,6 +679,15 @@ msgstr "Principales communes en nombre"
msgid "Main towns by surface (ha)"
msgstr "Principales communes en surface (ha)"
+#~ msgid "years"
+#~ msgstr "années"
+
+#~ msgid "months"
+#~ msgstr "mois"
+
+#~ msgid "Creation date before"
+#~ msgstr "Date de création avant"
+
#~ msgid "Town"
#~ msgstr "Commune"
diff --git a/archaeological_files/models.py b/archaeological_files/models.py
index 70570e145..4483e6401 100644
--- a/archaeological_files/models.py
+++ b/archaeological_files/models.py
@@ -30,7 +30,7 @@ from ishtar_common.utils import cached_label_changed, get_cache
from ishtar_common.models import GeneralType, BaseHistorizedItem, \
HistoricalRecords, OwnPerms, Person, Organization, Department, Town, \
- Dashboard, IshtarUser, ValueGetter, ShortMenuItem
+ Dashboard, DashboardFormItem, IshtarUser, ValueGetter, ShortMenuItem
class FileType(GeneralType):
class Meta:
@@ -61,7 +61,8 @@ if settings.COUNTRY == 'fr':
verbose_name_plural = u"Types Saisine"
ordering = ('label',)
-class File(BaseHistorizedItem, OwnPerms, ValueGetter, ShortMenuItem):
+class File(BaseHistorizedItem, OwnPerms, ValueGetter, ShortMenuItem,
+ DashboardFormItem):
TABLE_COLS = ['numeric_reference', 'year', 'internal_reference',
'file_type', 'saisine_type', 'towns', ]
year = models.IntegerField(_(u"Year"),
@@ -229,44 +230,6 @@ class File(BaseHistorizedItem, OwnPerms, ValueGetter, ShortMenuItem):
owns = super(File, cls).get_owns(user)
return sorted(owns.all(), key=lambda x:x.cached_label)
- @classmethod
- def get_periods(cls, slice='year', fltr={}, date_source='creation'):
- date_var = date_source + '_date'
- q = cls.objects.filter(**{date_var+'__isnull':False})
- if fltr:
- q = q.filter(**fltr)
- if slice == 'year':
- return [res[date_var].year for res in list(q.values(date_var
- ).annotate(Count("id")).order_by())]
- elif slice == 'month':
- return [(res[date_var].year, res[date_var].month)
- for res in list(q.values(date_var
- ).annotate(Count("id")).order_by())]
- return []
-
- @classmethod
- def get_by_year(cls, year, fltr={}, date_source='creation'):
- date_var = date_source + '_date'
- q = cls.objects.filter(**{date_var+'__isnull':False})
- if fltr:
- q = q.filter(**fltr)
- return q.filter(**{date_var+'__year':year})
-
- @classmethod
- def get_by_month(cls, year, month, fltr={}, date_source='creation'):
- date_var = date_source + '_date'
- q = cls.objects.filter(**{date_var+'__isnull':False})
- if fltr:
- q = q.filter(**fltr)
- return q.filter(**{date_var+'__year':year, date_var+'__month':month})
-
- @classmethod
- def get_total_number(cls, fltr={}):
- q = cls.objects
- if fltr:
- q = q.filter(**fltr)
- return q.count()
-
def get_values(self, prefix=''):
values = super(File, self).get_values(prefix=prefix)
values['adminact_associated_file_towns_count'] = unicode(