diff --git a/base/admin.py b/base/admin.py index c25ab9b..21d5107 100644 --- a/base/admin.py +++ b/base/admin.py @@ -24,10 +24,13 @@ class CommuneAdmin(admin.ModelAdmin): class SectionCommunaleAdmin(admin.ModelAdmin): #Called my form in the admin and set a column for each fields list_display = ("commune", "sectionCommunale", "nomOfficiel", "id_code", "description") + + search_fields = ["sectionCommunale"] form = SectionCommunaleForm + class SiteSentinelleAdmin(admin.ModelAdmin): #Called my form in the admin and set a column for each fields list_display = ("sectionCommunale", "localite", "latitude", "longitude", "hauteur") diff --git a/scripts/load_stations.py b/scripts/load_stations.py index 44fbf93..6a05bc7 100644 --- a/scripts/load_stations.py +++ b/scripts/load_stations.py @@ -11,40 +11,40 @@ import csv #ts = TypeStationPluviometrique.objects.all()[0] -with open('scripts/depFakeDatas.csv', 'r+') as csvfile: - reader = csv.reader(csvfile) - va = 0 - for row in reader: - va+=1 - if va == 1: - continue - print(row[2]) - #dep = Departement(departement=row[2], description="Le departement du/de : "+row[2], id_code=row[1]) - #dep.scave() - dep = Departement() - dep.departement = row[2] - dep.description = row[2]+"Je pense donc je suis" - dep.id_code = row[1] - Departement.save(dep) +# with open('scripts/depFakeDatas.csv', 'r+') as csvfile: +# reader = csv.reader(csvfile) +# va = 0 +# for row in reader: +# va+=1 +# if va == 1: +# continue +# print(row[2]) +# #dep = Departement(departement=row[2], description="Le departement du/de : "+row[2], id_code=row[1]) +# #dep.scave() +# dep = Departement() +# dep.departement = row[2] +# dep.description = row[2]+"Je pense donc je suis" +# dep.id_code = row[1] +# Departement.save(dep) -with open('scripts/comFakeDatas.csv', 'r+') as csvfile: - reader = csv.reader(csvfile) - va = 0 - for com in reader: - va+=1 - if va == 1: - continue - departe = Departement.objects.get(id_code = com[3]) - commun = com[2] - descc = "Cogito ergo sum" - id_code = com[1] - print(departe,commun,descc,id_code) - laCom = Commune() - laCom.departement=departe - laCom.description=descc - laCom.id_code=id_code - laCom.commune=commun - laCom.save() +# with open('scripts/comFakeDatas.csv', 'r+') as csvfile: +# reader = csv.reader(csvfile) +# va = 0 +# for com in reader: +# va+=1 +# if va == 1: +# continue +# departe = Departement.objects.get(id_code = com[3]) +# commun = com[2] +# descc = "Cogito ergo sum" +# id_code = com[1] +# print(departe,commun,descc,id_code) +# laCom = Commune() +# laCom.departement=departe +# laCom.description=descc +# laCom.id_code=id_code +# laCom.commune=commun +# laCom.save() with open('scripts/sctComFakeDatas2.csv', 'r+') as csvfile: reader = csv.reader(csvfile) diff --git a/sms_gateway/app.py b/sms_gateway/app.py index fc59403..2f1cf48 100644 --- a/sms_gateway/app.py +++ b/sms_gateway/app.py @@ -27,7 +27,7 @@ class SmsGateway(AppBase): tel = msg.peer.strip("+") if tel not in valid_numbers: # msg.respond('TEst') - msg.respond('Not in '+msg.peer) + # msg.respond('Not in '+msg.peer) return True # Return false because we don't want to answer an unknow number else: # If this number is in the list, will work with the text message @@ -92,8 +92,9 @@ class SmsGateway(AppBase): person = PersonneContact.objects.get(telephonePersonnel=tel) station = StationObservers.objects.get(observer=person).station - id_station = StationObservers.objects.get(observer=person).station.id - formule = UniteDeMesure.objects.get(id = id_station).formule + id_station = station.id + formule = station.uniteMesure.formule + # formule = UniteDeMesure.objects.get(id = id_station).formule val_float = float(msg.text) * float(formule) diff --git a/smslapli/settings.py b/smslapli/settings.py index 3cfac63..565163a 100644 --- a/smslapli/settings.py +++ b/smslapli/settings.py @@ -125,7 +125,7 @@ TEMPLATE_CONTEXT_PROCESSORS = ( 'django.core.context_processors.request', 'django.contrib.messages.context_processors.messages', 'smslapli.context_processors.get_infos', - 'smslapli.context_processors.app_list', + #'smslapli.context_processors.app_list', ) MIDDLEWARE_CLASSES = ( diff --git a/smslapli/templates/admin/index.html b/smslapli/templates/admin/index.html index f607ee3..bd73b33 100755 --- a/smslapli/templates/admin/index.html +++ b/smslapli/templates/admin/index.html @@ -190,6 +190,48 @@ {% endfor %} + {% else %} +
  • Structure de base + +
  • +
  • Collecte Pluviometrique + +
  • +
  • Autorisation + +
  • {% endif %} @@ -303,7 +345,7 @@

    Observation pluviometrique

    -
    +