Commit 760acb74 authored by fred.perso's avatar fred.perso

First push

Django settings for dbchiro project.
Generated by 'django-admin startproject' using Django 1.11.
For more information on this file, see
For the full list of settings and their values, see
import os
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# Quick-start development settings - unsuitable for production
# See
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'f0q1uri4bg8a4h!!@rcw6cktb-x%fh!q23x&-upn95#v547z(f'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
ALLOWED_HOSTS = ['localhost', '', '[::1]', '']
# Application definition
# 'sortedm2m',
ROOT_URLCONF = 'dbchiro.urls'
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [
os.path.join(BASE_DIR, 'sights/template')
'APP_DIRS': True,
'context_processors': [
WSGI_APPLICATION = 'dbchiro.wsgi.application'
# Database
'default': {
'ENGINE': 'django.contrib.gis.db.backends.postgis',
'NAME': 'dbchiroweb',
'USER': 'dbadmin',
'PASSWORD': 'dbadminpasswd',
'HOST': '',
'PORT': '5432',
# Password validation
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
# Internationalization
TIME_ZONE = 'Europe/Paris'
USE_I18N = True
USE_L10N = True
USE_TZ = True
# Static files (CSS, JavaScript, Images)
STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'static')
'DEFAULT_CENTER': (5, 45.0),
'MIN_ZOOM': 3,
'MAX_ZOOM': 18,
'TILES': [
('OpenStreetMap Mapnik', 'http://{s}{z}/{x}/{y}.png',
'&copy; <a href="">OpenStreetMap</a>'),
('OpenTopoMap', 'https://{s}{z}/{x}/{y}.png',
'&copy; <a href="">OpenStreetMap</a>, <a href="">SRTM</a> | Map style: &copy; <a href="">OpenTopoMap</a> (<a href="">CC-BY-SA</a>'),
'SCALE': 'both',
"""dbchiro URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-based views
1. Add an import: from other_app.views import Home
2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home')
Including another URLconf
1. Import the include() function: from django.conf.urls import url, include
2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls'))
from django.conf.urls import url, include
from django.contrib.gis import admin
from django.contrib.auth import views
from django.conf import settings
urlpatterns = [
url(r'^grappelli/', include('grappelli.urls')),
url(r'^nested_admin/', include('nested_admin.urls')),
# url(r'^accounts/login/', views.login),
url(r'', include('sights.urls')),
if settings.DEBUG:
import debug_toolbar
urlpatterns = [
url(r'^__debug__/', include(debug_toolbar.urls)),
] + urlpatterns
WSGI config for dbchiro project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "dbchiro.settings")
application = get_wsgi_application()
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "dbchiro.settings")
from import execute_from_command_line
except ImportError:
# The above import may fail for some other reason. Ensure that the
# issue is really that Django is missing to avoid masking other
# exceptions on Python 2.
import django
except ImportError:
raise ImportError(
"Couldn't import Django. Are you sure it's installed and "
"available on your PYTHONPATH environment variable? Did you "
"forget to activate a virtual environment?"
from django.contrib import admin
from django.contrib.gis import admin
from django.contrib.auth.admin import UserAdmin as BaseUserAdmin
from django.contrib.auth.models import User
from .models import Place, Observer, Sighting, Session, Capture, PlaceDetail, UserDetail, CatchAuth, CountDetail
from leaflet.admin import LeafletGeoAdmin
# from nested_inline.admin import NestedModelAdmin, NestedStackedInline, NestedTabularInline
# from olwidget.admin import GeoModelAdmin
import nested_admin
class UserDetailInline(nested_admin.NestedStackedInline):
model = UserDetail
can_delete = False
verbose_name_plural = 'Details de utilisateur'
class UserAdmin(LeafletGeoAdmin):
inlines = (UserDetailInline, )
class CountDetailInLine(nested_admin.NestedTabularInline):
model = CountDetail
extra = 0
fk_name = 'sighting'
# class CaptureInLine(admin.StackedInline):
class CaptureInLine(nested_admin.NestedTabularInline):
model = Capture
extra = 0
# fk_name = 'sighting'
class SightingInLine(nested_admin.NestedTabularInline):
model = Sighting
extra = 0
# fk_name = 'session'
inlines = [CaptureInLine, CountDetailInLine, ]
class SessionInLine(nested_admin.NestedTabularInline):
model = Session
extra = 0
# fk_name = 'place'
inlines = [SightingInLine, ]
class SightingAdmin(admin.ModelAdmin):
inlines = [
CountDetailInLine, CaptureInLine
# class PlaceAdmin(nested_admin.NestedModelAdmin):
# class PlaceAdmin(nested_admin.NestedModelAdmin):
class PlaceAdmin(LeafletGeoAdmin):
model = Place
inlines = [SessionInLine, ]
list_display = ['name', 'municipality', ]
search_fields = ['name', 'municipality']
sortable_field_name = "municipality"
autocomplete_lookup_fields = {
'name': ['name', 'municipality'],
# class CaptureAdmin(admin.ModelAdmin):
# list_display = ['sighting', 'age', 'sex', 'ab']
# list_filter = ['sex', 'age', 'sighting']
# search_fields = ['sighting']
# sortable_field_name = "sighting"
# autocomplete_lookup_fields = {
# 'sighting': ['sighting'],
# }
# def related_sighting(self, obj):
# return obj.id_sighting.codesp
# related_sighting.short_description = 'Sighting', PlaceAdmin)
#, SightingAdmin), UserAdmin)
# Register your models here.
from django.apps import AppConfig
class SightsConfig(AppConfig):
name = 'sights'
from django import forms
from .models import Place
class PlaceForm(forms.ModelForm):
class Meta:
model = Place
This diff is collapsed.
# -*- coding: utf-8 -*-
# Generated by Django 1.10.7 on 2017-05-09 22:45
from __future__ import unicode_literals
import django.contrib.gis.db.models.fields
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('sights', '0001_initial'),
operations = [
field=models.CharField(blank=True, max_length=100, null=True, verbose_name='bdd source'),
field=models.CharField(choices=[('rhifer', 'Grand rhinolophe'), ('rhihip', 'Petit rhinolophe'), ('rhieur', 'Rhinolophe euryale'), ('rhimeh', 'Rhinolophe de Mehely'), ('myomys', 'Murin à moustaches'), ('myobra', 'Murin de Brandt'), ('myoalc', 'Murin dAlcathoé'), ('myoema', 'Murin à oreilles échancrées'), ('myonat', 'Murin de Natterer'), ('myobec', 'Murin de Bechstein'), ('myomyo', 'Grand Murin'), ('myobly', 'Petit Murin'), ('myopun', 'Murin du Magrheb'), ('myodau', 'Murin de Daubenton'), ('myocap', 'Murin de Capaccini'), ('myodas', 'Murin des marais'), ('nyclas', 'Grande Noctule'), ('nyclei', 'Noctule de Leisler'), ('nycnoc', 'Noctule commune'), ('eptser', 'Sérotine commune'), ('eptnil', 'Sérotine de Nilsson'), ('vesmur', 'Sérotine bicolore'), ('pippip', 'Pipistrelle commune'), ('pippyg', 'Pipistrelle pygmée'), ('pipnat', 'Pipistrelle de Nathusius'), ('pipkuh', 'Pipistrelle de Kuhl'), ('hypsav', 'Vespère de Savi'), ('pleaur', 'Oreillard roux'), ('pleaus', 'Oreillard gris'), ('plemac', 'Oreillard montagnard'), ('barbar', 'Barbastelle dEurope'), ('minsch', 'Minioptère de Schreibers'), ('tadten', 'Molosse de Cestoni'), ('rhieurfer', 'Grand rhinolophe / Rhinolophe euryale'), ('rhiind', 'Rhinolophe indéterminé'), ('petmur', 'Murin de "petite taille"'), ('murmur', 'Murin de "grande taille"'), ('nycind', 'Noctule indéterminée'), ('nyctad', 'Noctule / Molosse'), ('eptind', 'Sérotine indéterminée'), ('eptnyc', 'Sérotine / Noctule'), ('eptvesnyc', 'Sérotine / Noctule'), ('eptmur', 'Sérotine / Murin de "grande taille"'), ('pipind', 'Pipistrelle indéterminée'), ('pleind', 'Oreillard indéterminé'), ('myobecdaumys', 'Murin de Bechstein / Daubenton / moustaches'), ('myodauemamys', 'Murin de Daubenton / moustaches / emarginé'), ('myobecdau', 'Murin de Bechstein / Daubenton'), ('myobecbradau', 'Murin de Bechstein / Brandt / Daubenton'), ('myobecbra', 'Murin de Bechstein / Brandt'), ('myobecema', 'Murin de Bechstein / émarginé'), ('myoalcmys', 'Murin dAlcathoé / moustaches'), ('myoalcbramys', 'Murin dAlcathoé / Brandt / moustaches'), ('myodaumys', 'Murin de Daubenton / moustaches'), ('myoemamys', 'Murin émarginé / moustaches'), ('myoalcemamys', 'Murin dAlcathoé / émarginé / moustaches'), ('myoalcema', 'Murin dAlcathoé / émarginé'), ('nycnoclas', 'Noctule commune / Grande noctule'), ('pipkuhnat', 'Pipistrelle de Kuhl / Nathusius'), ('pippipnat', 'Pipistrelle commune / Nathusius'), ('pippipminsch', 'Pipistrelle commune / Minioptère'), ('pippygminsch', 'Pipistrelle pygmée / Minioptère'), ('chiind', 'Chiroptère indéterminé'), ('0cfil', 'Aucune capture filet'), ('0obs', 'Aucune chauve-souris ou trace'), ('0du', 'Aucun contact acoustique'), ('minfos', 'Miniopterus fossilis'), ('myoalccapmys', 'Murin dAlcathoé / Capaccini / moustaches'), ('myoalcdau', 'Murin dAlcathoe / de Daubenton'), ('myobecbraema', 'Murin de Bechstein / Brandt / émarginé'), ('myobecbramur', 'Murin de Bechstein / Brandt / "grande taille"'), ('myobecbramys', 'Murin de Bechstein / Brandt / moustaches'), ('myobecdaumur', 'Murin de Bechstein /Daubenton/"grande taille"'), ('myobecmur', 'Murin de Bechstein / murin de "grande taille"'), ('myoboy', 'Myotis boyeri'), ('myobradau', 'Murin de Brandt / Daubenton'), ('myobradaumys', 'Murin de Brandt / Daubenton / moustaches'), ('myobraema', 'Murin de Brandt / échancré'), ('myobraemamys', 'Murin de Brandt / émarginé / moustaches'), ('myobramys', 'Murin de Brandt / moustaches'), ('myocapdau', 'Murin de Capaccini / de Daubenton'), ('myocapdauema', 'Murin de Capaccini / Daubenton / émarginé'), ('myodauema', 'Murin de Daubenton / émarginé'), ('myoesc', 'Murin dEscalera'), ('myonatbly', 'Murin de Natterer / Petit murin'), ('myosan', 'Myotis sanctialbani'), ('myotis', 'Murin indét. (PETMUR/MURMUR)'), ('nycleivesmur', 'Noctule de Leisler / Sérotine bicolore'), ('palaeind', 'Palaeophyllophora sp.'), ('pippippyg', 'Pipistrelle commune / pygmée'), ('pleaurmac', 'Oreillard roux / montagnard'), ('pleausmac', 'Oreillard gris / montagnard'), ('rhidel', 'Rhinolophus delphinensis'), ('rhieurhip', 'Petit rhinolophe / euryale'), ('rhigri', 'Rhinolophus grivensis'), ('rhilis', 'Rhinolophus lissiensis'), ('rousse', 'Roussette sp.'), ('tadind', 'Tadarida sp.'), ('vesant', 'Vespertilio antiqus'), ('vesgri', 'Vespertilio grivensis')], max_length=25, verbose_name='Espèce'),
field=models.CharField(blank=True, max_length=100, null=True, verbose_name='id unique de la bdd source'),
field=models.AutoField(primary_key=True, serialize=False, verbose_name='id unique'),
field=models.IntegerField(blank=True, null=True, verbose_name='Nombre total'),
field=django.contrib.gis.db.models.fields.PointField(blank=True, null=True, srid=2154, verbose_name='Localisation géographique'),
This diff is collapsed.
<p>Hi there!</p>
<p>It works!</p>
from django.test import TestCase
# Create your tests here.
from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^$', views.place_list, name='place_list'),
\ No newline at end of file
from django.shortcuts import render
def place_list(request):
return render(request, 'place_list.html', {})
# Create your views here.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment