Commit e15ff62a authored by fred.perso's avatar fred.perso

cutting the main application sights into several modules

parent d583f442
from django.contrib import admin
from leaflet.admin import LeafletGeoAdmin
# from django.contrib.auth.admin import UserAdmin
from .models import User
admin.site.register(User, LeafletGeoAdmin)
from django.apps import AppConfig
class AccountsConfig(AppConfig):
name = 'accounts'
# -*- coding: utf-8 -*-
# Generated by Django 1.11.3 on 2017-11-16 01:17
from __future__ import unicode_literals
import django.contrib.auth.models
import django.contrib.auth.validators
import django.contrib.gis.db.models.fields
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='User',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('password', models.CharField(max_length=128, verbose_name='password')),
('last_login', models.DateTimeField(blank=True, null=True, verbose_name='last login')),
('is_superuser', models.BooleanField(default=False, help_text='Designates that this user has all permissions without explicitly assigning them.', verbose_name='superuser status')),
('username', models.CharField(error_messages={'unique': 'A user with that username already exists.'}, help_text='Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only.', max_length=150, unique=True, validators=[django.contrib.auth.validators.UnicodeUsernameValidator()], verbose_name='username')),
('first_name', models.CharField(blank=True, max_length=30, verbose_name='first name')),
('last_name', models.CharField(blank=True, max_length=30, verbose_name='last name')),
('email', models.EmailField(blank=True, max_length=254, verbose_name='email address')),
('is_staff', models.BooleanField(default=False, help_text='Designates whether the user can log into this admin site.', verbose_name='staff status')),
('is_active', models.BooleanField(default=True, help_text='Designates whether this user should be treated as active. Unselect this instead of deleting accounts.', verbose_name='active')),
('date_joined', models.DateTimeField(default=django.utils.timezone.now, verbose_name='date joined')),
('status', models.CharField(choices=[('resp', 'Responsable'), ('obs', 'Observateur')], default='obs', max_length=10, verbose_name="Statut de l'utilisateur")),
('auth_access_alldata', models.NullBooleanField()),
('auth_edit_alldata', models.NullBooleanField()),
('organism', models.CharField(blank=True, max_length=255, null=True, verbose_name='Organisme')),
('home_phone', models.CharField(blank=True, max_length=50, null=True, verbose_name='Numéro de téléphone fixe')),
('mobile_phone', models.CharField(blank=True, max_length=50, null=True, verbose_name='Numéro de téléphone portable')),
('addr_appt', models.CharField(blank=True, max_length=50, null=True, verbose_name='Appartement')),
('addr_building', models.CharField(blank=True, max_length=255, null=True, verbose_name='Immeuble')),
('addr_street', models.CharField(blank=True, max_length=255, null=True, verbose_name='Rue')),
('addr_city', models.CharField(blank=True, max_length=255, null=True, verbose_name='Commune')),
('addr_city_code', models.CharField(blank=True, max_length=10, null=True, verbose_name='Code postal')),
('addr_dept', models.CharField(blank=True, max_length=255, null=True, verbose_name='Département')),
('addr_country', models.CharField(blank=True, max_length=255, null=True, verbose_name='Pays')),
('comment', models.TextField(blank=True, null=True, verbose_name='Commentaire')),
('id_bdsource', models.CharField(blank=True, max_length=100, null=True)),
('bdsource', models.CharField(blank=True, max_length=100, null=True)),
('geom', django.contrib.gis.db.models.fields.PointField(blank=True, null=True, srid=2154, verbose_name='Localisation géographique')),
('timestamp_create', models.DateTimeField(auto_now_add=True)),
('timestamp_update', models.DateTimeField(auto_now=True)),
],
options={
'verbose_name_plural': 'Détails des utilisateurs',
},
managers=[
('objects', django.contrib.auth.models.UserManager()),
],
),
]
# -*- coding: utf-8 -*-
# Generated by Django 1.11.3 on 2017-11-16 01:17
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
('management', '0001_initial'),
('accounts', '0001_initial'),
('geodata', '0001_initial'),
('auth', '0008_alter_user_username_max_length'),
]
operations = [
migrations.AddField(
model_name='user',
name='catchauth',
field=models.ManyToManyField(blank=True, to='management.CatchAuth', verbose_name='Authorisations de capture'),
),
migrations.AddField(
model_name='user',
name='coord_territory',
field=models.ManyToManyField(blank=True, to='geodata.Territory', verbose_name='Territoires du rôle de coordinateur'),
),
migrations.AddField(
model_name='user',
name='groups',
field=models.ManyToManyField(blank=True, help_text='The groups this user belongs to. A user will get all permissions granted to each of their groups.', related_name='user_set', related_query_name='user', to='auth.Group', verbose_name='groups'),
),
migrations.AddField(
model_name='user',
name='user_permissions',
field=models.ManyToManyField(blank=True, help_text='Specific permissions for this user.', related_name='user_set', related_query_name='user', to='auth.Permission', verbose_name='user permissions'),
),
]
from django.contrib.auth.models import AbstractUser
# from django.db import models
from django.contrib.gis.db import models
from django.utils.translation import ugettext_lazy as _
from sights.models import Territory
from management.models import CatchAuth
# Create your models here.
class User(AbstractUser):
STATUS = [
('resp', _('Responsable')),
('obs', _('Observateur'))
]
status = models.CharField(max_length=10, choices=STATUS, default='obs', verbose_name=_('Statut de l\'utilisateur'))
coord_territory = models.ManyToManyField(Territory, blank=True,
verbose_name=_('Territoires du rôle de coordinateur'))
auth_access_alldata = models.NullBooleanField()
auth_edit_alldata = models.NullBooleanField()
catchauth = models.ManyToManyField(
CatchAuth,
blank=True, verbose_name=_('Authorisations de capture'))
organism = models.CharField(max_length=255, blank=True, null=True, verbose_name=_('Organisme'))
home_phone = models.CharField(max_length=50, blank=True, null=True, verbose_name=_('Numéro de téléphone fixe'))
mobile_phone = models.CharField(max_length=50, blank=True, null=True,
verbose_name=_('Numéro de téléphone portable'))
addr_appt = models.CharField(max_length=50, blank=True, null=True, verbose_name=_('Appartement'))
addr_building = models.CharField(max_length=255, blank=True, null=True, verbose_name=_('Immeuble'))
addr_street = models.CharField(max_length=255, blank=True, null=True, verbose_name=_('Rue'))
addr_city = models.CharField(max_length=255, blank=True, null=True, verbose_name=_('Commune'))
addr_city_code = models.CharField(max_length=10, blank=True, null=True, verbose_name=_('Code postal'))
addr_dept = models.CharField(max_length=255, blank=True, null=True, verbose_name=_('Département'))
addr_country = models.CharField(max_length=255, blank=True, null=True, verbose_name=_('Pays'))
comment = models.TextField(blank=True, null=True, verbose_name=_('Commentaire'))
id_bdsource = models.CharField(max_length=100, blank=True, null=True)
bdsource = models.CharField(max_length=100, blank=True, null=True)
geom = models.PointField(srid=2154, blank=True, null=True, verbose_name=_('Localisation géographique'))
timestamp_create = models.DateTimeField(
auto_now_add=True, editable=False)
timestamp_update = models.DateTimeField(
auto_now=True, editable=False)
def __str__(self):
return "Détails de %s" % (self.username)
class Meta:
verbose_name_plural = "Détails des utilisateurs"
from django.test import TestCase
# Create your tests here.
from django.shortcuts import render
# Create your views here.
from dal import autocomplete
from django.conf import settings
from django.contrib.auth.decorators import login_required
from django.contrib.auth.mixins import LoginRequiredMixin
from django.contrib.auth.models import User
from django.core.serializers import serialize
from django.db.models import Q, F
from django.http import HttpResponse
from djgeojson.views import GeoJSONLayerView, TiledGeoJSONLayerView
from sights.models import Place, UserDetail, Territory, Municipality
from sights.models import Place, Territory, Municipality
class ActiveUserAutocomplete(autocomplete.Select2QuerySetView):
def get_queryset(self):
# Don't forget to filter out results depending on the visitor !
if not self.request.user.is_authenticated():
return User.objects.none()
return settings.AUTH_USER_MODEL.objects.none()
qs = User.objects.filter(is_active=True).order_by('username')
qs = settings.AUTH_USER_MODEL.objects.filter(is_active=True).order_by('username')
if self.q:
qs = qs.filter(username__icontains=self.q)
......@@ -27,9 +27,9 @@ class AllUserAutocomplete(autocomplete.Select2QuerySetView):
def get_queryset(self):
# Don't forget to filter out results depending on the visitor !
if not self.request.user.is_authenticated():
return User.objects.none()
return settings.AUTH_USER_MODEL.objects.none()
qs = User.objects.all().order_by('username')
qs = settings.AUTH_USER_MODEL.objects.all().order_by('username')
if self.q:
qs = qs.filter(username__icontains=self.q)
......@@ -85,7 +85,7 @@ def PlaceAsGeoJSON(request):
:return:
'''
loggeduser = request.user
userdetail = UserDetail.objects.get(user=loggeduser)
userdetail = settings.AUTH_USER_MODEL.objects.get(user=loggeduser)
if userdetail.auth_access_alldata == True:
print('Chargement de la carte pour l\'utilisateur avec accès total')
place_list = Place.objects.all()
......
......@@ -45,7 +45,11 @@ INSTALLED_APPS = [
'django.contrib.admindocs',
'haystack',
'debug_toolbar',
'accounts',
'dicts',
'geodata',
'sights',
'management',
'ckeditor',
'leaflet',
'crispy_forms',
......@@ -118,6 +122,10 @@ HAYSTACK_CONNECTIONS = {
},
}
# Customizing User model
AUTH_USER_MODEL = 'accounts.User'
# Password validation
# https://docs.djangoproject.com/en/1.11/ref/settings/#auth-password-validators
......
INSERT INTO sights_dictspecie (id, sys_order, codesp, sp_true, sci_name, full_name, common_name_fr, common_name_eng)
INSERT INTO dicts_specie (id, sys_order, codesp, sp_true, sci_name, full_name, common_name_fr, common_name_eng)
VALUES
(1, 1, 'rhifer', TRUE, 'Rhinolophus ferrumequinum', 'Rhinolophus ferrumequinum (Schreber, 1774)', 'Grand rhinolophe',
'Greater Horseshoe Bat'),
......@@ -104,7 +104,7 @@ VALUES
(101, 0, 'rousse', FALSE, 'Roussette sp.', NULL, 'Roussette sp.', NULL);
INSERT INTO sights_dicttypeplace (id, code, category, descr) VALUES
INSERT INTO dicts_typeplace (id, code, category, descr) VALUES
(1, 'open', 'outdoor', 'Site terrestre de plein air'),
(2, 'aqua', 'outdoor', 'Site aquatique de plein air'),
(3, 'aaut', 'tree', 'arbre-autre'),
......@@ -135,7 +135,7 @@ INSERT INTO sights_dicttypeplace (id, code, category, descr) VALUES
(28, 'tboi', 'other', 'tas de bois entreposé'),
(29, 'zzzz', 'other', 'autre type de gîte');
INSERT INTO sights_dicttypedevice (id, method, code, descr) VALUES
INSERT INTO dicts_typedevice (id, method, code, descr) VALUES
(1, 'vv', 'mnnorm', 'filet japonais normal'),
(2, 'vv', 'mnmono', 'Filet japonais monofilament'),
(3, 'vv', 'mnhair', 'Filet japonais hair'),
......@@ -162,27 +162,27 @@ INSERT INTO sights_dicttypedevice (id, method, code, descr) VALUES
(24, 'du', 'd1000x', 'D1000x');
INSERT INTO sights_dictpropertydomain (id, code, "domain", descr) VALUES
INSERT INTO dicts_propertydomain (id, code, "domain", descr) VALUES
(1, 'doma', 'public', 'Site ou propriété domanial'),
(2, 'coll', 'public', 'Site ou propriété de la collectivité'),
(3, 'priv', 'prive', 'Site privé'),
(4, 'nd', 'nd', 'Non déterminé');
INSERT INTO sights_dictplaceprecision (id, code, descr) VALUES
INSERT INTO dicts_placeprecision (id, code, descr) VALUES
(1, 'precis', 'localisation précise'),
(2, 'locality', 'localisation au lieu-dit'),
(3, 'centroid', 'point central d''une zone ou d''un transect'),
(4, 'municip', 'localisation à la commune'),
(5, 'imprec', 'imprécis, au delà de l''échelle communale');
INSERT INTO sights_dictcontact (id, code, descr) VALUES
INSERT INTO dicts_contact (id, code, descr) VALUES
(1, 'vv', 'Vu en visuel'),
(2, 'vm', 'Vu en main'),
(3, 'du', 'Contact acoustique'),
(4, 'te', 'Télémétrie');
INSERT INTO sights_dictmethod (id, code, contact, descr) VALUES
INSERT INTO dicts_method (id, code, contact, descr) VALUES
(1, 'duan', 'du', 'Détection automatique en zero-crossing'),
(2, 'duea', 'du', 'Détection automatique en temps réel'),
(3, 'dudv', 'du', 'Détection en division de fréquence'),
......@@ -206,33 +206,33 @@ INSERT INTO sights_dictmethod (id, code, contact, descr) VALUES
(21, 'vvvu', 'vv', 'Comptage précis à vue');
INSERT INTO sights_dictbiomtesticule VALUES
INSERT INTO dicts_biomtesticule VALUES
(0, 't0', 'invisibles', 'testicules invisibles'),
(1, 't1', 'gonglés', 'testicules gonflés'),
(2, 't2', 'très gonflés', 'testicules très gonflés');
INSERT INTO sights_dictbiomepipidyme VALUES
INSERT INTO dicts_biomepipidyme VALUES
(0, 'e0', 'non gonflés', 'épididymes non gonflés'),
(1, 'e1', 'gonglés', 'épididymes gonflés'),
(2, 'e2', 'très gonflés', 'épididymes très gonflés');
INSERT INTO sights_dictbiomtuniqvag VALUES
INSERT INTO dicts_biomtuniqvag VALUES
(0, 's', 'sombres, noires', 'tuniques vaginales sombres, noires'),
(1, 'b', 'bicolores', 'tuniques vaginales bicolores'),
(2, 'c', 'claires, diffuses', 'tuniques vaginales claires, diffuses');
INSERT INTO sights_dictbiomglandtaille VALUES
INSERT INTO dicts_biomglandtaille VALUES
(0, 'gd0', 'non visibles', 'glandes buccales non visibles'),
(1, 'gd1', 'apparentes', 'glandes buccales apparentes'),
(2, 'gd2', 'proéminentes', 'glandes buccales proéminentes');
INSERT INTO sights_dictbiomglandcoul VALUES
INSERT INTO dicts_biomglandcoul VALUES
(0, 'p', 'roses', 'glandes buccales roses'),
(1, 'w', 'blanches', 'glandes buccales blanches'),
(2, 'or', 'oranges', 'glandes buccales oranges');
INSERT INTO sights_dictbiommamelle VALUES
INSERT INTO dicts_biommamelle VALUES
(0, 'm0', 'invisibles ou très petites',
'mamelles invisibles ou très petites ; poils sur les mamelles et pourtours identiques au reste du pelage'),
(1, 'm1', 'visibles', 'mamelles visibles, non gonflées ; poils longs mais plus fins sur mamelles et pourtours'),
......@@ -240,40 +240,40 @@ INSERT INTO sights_dictbiommamelle VALUES
(3, 'm3', 'visibles, non gonflées',
'mamelles visibles, non gonflées ; mamelles et pourtours recouverts de poils très courts (repousse)');
INSERT INTO sights_dictbiomgestation VALUES
INSERT INTO dicts_biomgestation VALUES
(1, 'ng', 'probablement non gestante', 'probablement non gestante'),
(2, 'pg', 'probablement gestante', 'probablement gestante'),
(3, 'g', 'gestante', 'gestante (palpée)');
INSERT INTO sights_dictbiomepiphyse VALUES
INSERT INTO dicts_biomepiphyse VALUES
(0, 'f0', 'pas de fusion', 'pas de fusion ; articulation rectiligne, alternance de zones claires et sombres'),
(1, 'f1', 'fusion en cours', 'fusion en cours ; articulation enflée, zones claires encore visibles'),
(2, 'f2', 'fusion terminé', 'fusion terminée ; articulation noduleuse, pas de zones claires');
INSERT INTO sights_dictbiomchinspot (id, code, short_descr, descr) VALUES
INSERT INTO dicts_biomchinspot (id, code, short_descr, descr) VALUES
(0, 'c0', 'non visible', 'chinspot non visible'),
(1, 'c1', 'peu visible', 'chinspot peu visible'),
(2, 'c2', 'bien visible', 'chinspot bien visible');
INSERT INTO sights_dictbiomdent (id, code, short_descr, descr) VALUES
INSERT INTO dicts_biomdent (id, code, short_descr, descr) VALUES
(0, 'u0', 'très pointues', 'dents très pointues'),
(1, 'u1', 'pointues', 'dents pointues'),
(2, 'u2', 'limées', 'dents limées');
INSERT INTO sights_dictstate (id, code) VALUES
INSERT INTO dicts_state (id, code) VALUES
(1, 'mauvais'),
(2, 'moyen'),
(3, 'bon'),
(4, 'neuf');
INSERT INTO sights_dictinterest (id, code) VALUES
INSERT INTO dicts_interest (id, code) VALUES
(1, 'nul'),
(2, 'moyen'),
(3, 'bon'),
(4, 'excellent');
INSERT INTO sights_dictage (id, code, descr) VALUES
INSERT INTO dicts_age (id, code, descr) VALUES
(1, 'j', 'juvénile'),
(2, 'sad', 'subadulte'),
(3, 'ad', 'adulte'),
......@@ -281,20 +281,20 @@ INSERT INTO sights_dictage (id, code, descr) VALUES
(5, 'v', 'vieux');
INSERT INTO sights_dictsex (id, code, descr) VALUES
INSERT INTO dicts_sex (id, code, descr) VALUES
(1, 'f', 'Femelle'),
(2, 'm', 'Mâle'),
(3, 'fm', 'Femelle et male'),
(4, 'nd', 'Non déterminé');
INSERT INTO sights_dictperiod (id, code, descr, period, day_start, month_start, day_end, month_end) VALUES
INSERT INTO dicts_period (id, code, descr, period, day_start, month_start, day_end, month_end) VALUES
('1', 'h', 'Hibernant', '01/12 au 28(29)/02', '1', '12', '29', '2'),
('2', 'tp', 'Transit printanier', '01/03 au 15/05', '1', '3', '15', '5'),
('3', 'e', 'Estivant', '16/05 au 15/08', '16', '5', '15', '8'),
('4', 'ta', 'Transit automnal', '16/08 au 30/11', '16', '8', '30', '11');
INSERT INTO sights_dictcountprecision (id, code, descr) VALUES
INSERT INTO dicts_countprecision (id, code, descr) VALUES
(1, 'precis', 'comptage précis'),
(2, 'estime', 'comptage estimé'),
(3, 'mini', 'minimum'),
......@@ -302,7 +302,7 @@ INSERT INTO sights_dictcountprecision (id, code, descr) VALUES
(5, 'telem', 'donnée télémétrique');
INSERT INTO sights_dictcountunit (id, code, descr) VALUES
INSERT INTO dicts_countunit (id, code, descr) VALUES
(1, 'ind', 'Nombre d''individu(s)'),
(2, 'azi', 'azimut télémétrique'),
(3, 'minp', 'Minute positive'),
......@@ -315,7 +315,7 @@ INSERT INTO sights_dictcountunit (id, code, descr) VALUES
(10, 'c5night', 'Contacts par nuit (5s)'),
(11, 'c15night', 'Contacts par nuit (15s)');
INSERT INTO sights_dicttreecircumstance (id, code, descr) VALUES
INSERT INTO dicts_treecircumstance (id, code, descr) VALUES
(1, 'calls', 'Cris audibles (révélant l''emplacement du gîte'),
(2, 'out', 'Sortie de gîte supposée'),
(3, 'radtrk', 'Radiopistage'),
......@@ -323,7 +323,7 @@ INSERT INTO sights_dicttreecircumstance (id, code, descr) VALUES
(5, 'prun', 'Travaux d''élagage'),
(6, 'view', 'Observation visuelle');
INSERT INTO sights_dicttreebecoming (id, code, descr) VALUES
INSERT INTO dicts_treebecoming (id, code, descr) VALUES
(1, 'prot', 'Arbre protégé'),
(2, 'inplac', 'Arbre toujours en place'),
(3, 'felpro', 'Abattage de l''arbre programmé'),
......@@ -331,12 +331,12 @@ INSERT INTO sights_dicttreebecoming (id, code, descr) VALUES
(5, 'natfel', 'Tombé naturellement'),
(6, 'nd', 'Non défini');
INSERT INTO sights_dicttreeforeststands (id, code, descr) VALUES
INSERT INTO dicts_treeforeststands (id, code, descr) VALUES
(1, 'for', 'Futaie'),
(2, 'copfor', 'Taillis sous futaie'),
(3, 'cop', 'Taillis');
INSERT INTO sights_dicttreecontext (id, code, descr) VALUES
INSERT INTO dicts_treecontext (id, code, descr) VALUES
(1, 'for', 'Forêt'),
(2, 'gar', 'Jardin'),
(3, 'sha', 'Alignement d''arbres'),
......@@ -344,12 +344,12 @@ INSERT INTO sights_dicttreecontext (id, code, descr) VALUES
(5, 'orc', 'Verger');
INSERT INTO sights_dicttreegiteplace (id, code, descr) VALUES
INSERT INTO dicts_treegiteplace (id, code, descr) VALUES
(1, 'trunk', 'Tronc'),
(2, 'branc', 'Branche'),
(3, 'carp', 'Charpentière');
INSERT INTO sights_dicttreegitetype (id, code, descr) VALUES
INSERT INTO dicts_treegitetype (id, code, descr) VALUES
(1, 'bir', 'Trou de pic'),
(2, 'bircom', 'Trou de pic communiquants'),
(3, 'cranar', 'Fissure étroite (< 3 cm)'),
......@@ -362,7 +362,7 @@ INSERT INTO sights_dicttreegitetype (id, code, descr) VALUES
(10, 'truspl', 'Blessure en forme d''écharde sur le tronc'),
(11, 'braspl', 'Trou sous ou sur une ancienne branche tombée');
INSERT INTO sights_dicttreegiteorigin (id, code, descr) VALUES
INSERT INTO dicts_treegiteorigin (id, code, descr) VALUES
(1, 'clim', 'Climatique'),
(2, 'forexp', 'Exploitation forestière'),
(3, 'prun', 'Travaux d''élagage'),
......
from django.contrib import admin
from .models import TypeDevice, TypePlace, Contact, BiomDent, PlaceManagementAction, LandCoverCLC
admin.site.register(TypePlace)
admin.site.register(Contact)
admin.site.register(TypeDevice)
admin.site.register(BiomDent)
admin.site.register(PlaceManagementAction)
admin.site.register(LandCoverCLC)
from django.apps import AppConfig
class DictsConfig(AppConfig):
name = 'dicts'
This diff is collapsed.
from django.contrib.gis.db import models
from django.utils.translation import ugettext_lazy as _
from django.db import models
# Create your models here.
class TypePlace(models.Model):
"""
Catégories des types localité utilisé dans la relation :model:`sights.Place`.
"""
id = models.IntegerField(primary_key=True)
code = models.CharField(max_length=6)
category = models.CharField(max_length=30)
descr = models.CharField(max_length=200)
def __str__(self):
return "%s ∙ %s ∙ %s" % (self.code, self.category, self.descr)
class Meta:
verbose_name_plural = "Catégories des types de localités"
ordering = ['category', 'code']
class PlacePrecision(models.Model):
"""
Catégories des précisions géographiques utilisé dans la relation :model:`sights.Place`.
"""
id = models.IntegerField(primary_key=True)
code = models.CharField(max_length=15)
descr = models.CharField(max_length=50)
def __str__(self):
return "%s ∙ %s" % (self.code, self.descr)
class Meta:
verbose_name_plural = "Catégories des types de précisions des localités"
class State(models.Model):
"""
Etat des gîtes
"""
id = models.IntegerField(primary_key=True)
code = models.CharField(max_length=15)
def __str__(self):
return self.code
class Meta:
verbose_name_plural = "Etat des gîtes"
class Interest(models.Model):
"""
Intérêt des gîtes
"""
id = models.IntegerField(primary_key=True)
code = models.CharField(max_length=15)
def __str__(self):
return self.code
class Meta:
verbose_name_plural = "Intérêt des gîtes"
class PlaceBatiDetail(models.Model):
"""
Méthodes d'inventaire/d'observations :model:`sights.Sighting`.
"""
id = models.IntegerField(primary_key=True)
code = models.CharField(max_length=6)
descr = models.CharField(max_length=50)
def __str__(self):
return "%s ∙ %s" % (self.code, self.descr)
class Meta:
verbose_name_plural = "Type de bâti"
class TreeSpecies(models.Model):
"""
ionnaire des essences d'arbres
Pour les bases françaises, l'id de la table correspond au champ cd_nom du référentiel taxonomique TaxRef
"""
id = models.IntegerField(primary_key=True)
common_name = models.CharField(max_length=200)
latin_name = models.CharField(max_length=200)
full_latin_name = models.CharField(max_length=300)
tax_level = models.CharField(max_length=50)
def __str__(self):
return self.full_latin_name
class TreeContext(models.Model):
"""
Tree biotop context :model:`sights.PlaceTreeDetail`.
"""
id = models.IntegerField(primary_key=True)
code = models.CharField(max_length=6)
descr = models.CharField(max_length=50)
def __str__(self):
return self.descr
class Meta:
verbose_name_plural = "ionnaire des Contextes écologiques des arbres"