From: davin baragiotta Date: Wed, 23 Mar 2011 18:40:05 +0000 (-0400) Subject: fix related_name + accueil X-Git-Tag: DAE~262^2~1 X-Git-Url: http://git.auf.org/?p=auf_rh_dae.git;a=commitdiff_plain;h=ae936f8d89312f5b2f6c78cf54b437d142ef97b9 fix related_name + accueil --- diff --git a/project/rh/models.py b/project/rh/models.py index 2f21e85..4e2b51e 100644 --- a/project/rh/models.py +++ b/project/rh/models.py @@ -18,7 +18,7 @@ class Employe(models.Model): id = models.IntegerField(primary_key=True) nom = models.CharField(max_length=255) prenom = models.CharField(max_length=255) - nationalite = models.ForeignKey('datamaster_modeles.Pays', to_field='code', related_name='nationalite', db_column='nationalite') + nationalite = models.ForeignKey('datamaster_modeles.Pays', to_field='code', related_name='employes_nationalite', db_column='nationalite') date_naissance = models.DateField(null=True, blank=True) #Infos personnelles genre = models.CharField(max_length=1, choices=GENRE_CHOICES, null=True, blank=True) @@ -32,7 +32,7 @@ class Employe(models.Model): ville = models.CharField(max_length=255, null=True, blank=True) province = models.CharField(max_length=255, null=True, blank=True) code_postal = models.CharField(max_length=255, null=True, blank=True) - pays = models.ForeignKey('datamaster_modeles.Pays', to_field='code', null=True, blank=True, related_name='pays', db_column='pays') + pays = models.ForeignKey('datamaster_modeles.Pays', to_field='code', null=True, blank=True, related_name='employes', db_column='pays') #Métas date_creation = models.DateField(auto_now_add=True) date_maj = models.DateField(auto_now=True) @@ -49,18 +49,18 @@ class Dossier(models.Model): code = models.CharField(max_length=10, unique=True) employe = models.ForeignKey('Employe', db_column='employe') #Postes - poste1 = models.ForeignKey('Poste', db_column='poste1', related_name='poste1') - implantation1 = models.ForeignKey('datamaster_modeles.Implantation', db_column='implantation1', related_name='implantation1') + poste1 = models.ForeignKey('Poste', db_column='poste1', related_name='dossiers_poste1') + implantation1 = models.ForeignKey('datamaster_modeles.Implantation', db_column='implantation1', related_name='dossiers_implantation1') complement1 = models.TextField(null=True, blank=True) responsable_implantation1 = models.IntegerField() - poste2 = models.ForeignKey('Poste', db_column='poste2', related_name='poste2', blank=True, null=True) - implantation2 = models.ForeignKey('datamaster_modeles.Implantation', db_column='implantation2', related_name='implantation2') + poste2 = models.ForeignKey('Poste', db_column='poste2', related_name='dossiers_poste2', blank=True, null=True) + implantation2 = models.ForeignKey('datamaster_modeles.Implantation', db_column='implantation2', related_name='dossiers_implantation2') complement2 = models.TextField(null=True, blank=True) responsable_implantation2 = models.IntegerField() #Relations service = models.ForeignKey('Service', db_column='service') - responsable = models.ForeignKey('Employe', db_column='responsable', related_name='responsable') - remplacement_de = models.ForeignKey('Employe', db_column='remplacement_de', related_name='remplacement_de') + responsable = models.ForeignKey('Employe', db_column='responsable', related_name='responsable_de') + remplacement_de = models.ForeignKey('Employe', db_column='remplacement_de', related_name='replaced_by') type = models.CharField(max_length=1, choices=TYPE_DOSSIER_CHOICES) statut = models.ForeignKey('Statut', db_column='statut') organisme_bstg = models.ForeignKey('OrganismeBstg', db_column='organisme_bstg') @@ -92,7 +92,7 @@ class AyantDroit(models.Model): nom = models.CharField(max_length=255) prenom = models.CharField(max_length=255) #Relation - employe = models.ForeignKey('Employe', db_column='employe', related_name='employe') + employe = models.ForeignKey('Employe', db_column='employe', related_name='ayants_droit') lien_parente = models.CharField(max_length=10, choices=LIEN_PARENTE_CHOICES, null=True, blank=True) #Méta commentaire = models.TextField(null=True, blank=True) @@ -180,7 +180,7 @@ class Poste(models.Model): #Identification id = models.IntegerField(primary_key=True) implantation = models.ForeignKey('datamaster_modeles.Implantation', - db_column='implantation', related_name='+') + db_column='implantation', related_name='postes') type_poste = models.ForeignKey('TypePoste', db_column='type_poste') proportion = models.CharField(max_length=10, choices=PROPORTION_CHOICES) #(sert à quoi?) renommer "regime_travail" ou autre? convertir data en % (data * 100; ex: 1 = 100%) @@ -255,7 +255,7 @@ class ValeurPoint(models.Model): #Identification id = models.IntegerField(primary_key=True) valeur = models.FloatField() - implantation = models.ForeignKey('datamaster_modeles.Implantation', db_column='implantation') + implantation = models.ForeignKey('datamaster_modeles.Implantation', db_column='implantation', related_name='valeurs_point') #Méta annee = models.IntegerField() @@ -270,7 +270,7 @@ class TauxChange(models.Model): annee = models.IntegerField() taux = models.FloatField() #Relations - implantation = models.ForeignKey('datamaster_modeles.Implantation', db_column='implantation') + implantation = models.ForeignKey('datamaster_modeles.Implantation', db_column='implantation', related_name='taux_change') class Devise(models.Model): diff --git a/project/rh/templates/rh/index.html b/project/rh/templates/rh/index.html new file mode 100644 index 0000000..3b2c919 --- /dev/null +++ b/project/rh/templates/rh/index.html @@ -0,0 +1,7 @@ +{% extends 'base.html' %} + +{% block title %}Ressources humaines{% endblock %} + +{% block content %} +Gestion des ressources humaines. +{% endblock %} diff --git a/project/rh/urls.py b/project/rh/urls.py new file mode 100644 index 0000000..9430adc --- /dev/null +++ b/project/rh/urls.py @@ -0,0 +1,8 @@ +# -*- encoding: utf-8 -* +from django.conf.urls.defaults import patterns, url + +urlpatterns = patterns( + 'project.rh.views', + url(r'^$', 'index', name='index'), + #url(r'^employes$', 'employes', name='employes'), +) diff --git a/project/rh/views.py b/project/rh/views.py index 51051bc..566f922 100644 --- a/project/rh/views.py +++ b/project/rh/views.py @@ -3,3 +3,6 @@ from django.shortcuts import redirect, render_to_response, get_object_or_404 from django.template import RequestContext from project.rh import models as rh + +def index(request): + return render_to_response('rh/index.html', {}, RequestContext(request)) diff --git a/project/urls.py b/project/urls.py index b805830..6b373e1 100644 --- a/project/urls.py +++ b/project/urls.py @@ -15,6 +15,7 @@ urlpatterns = patterns( (r'^dae/', include('project.dae.urls')), (r'^connexion/$', 'django.contrib.auth.views.login'), (r'^deconnexion/$', 'django.contrib.auth.views.logout'), + (r'^', include('project.rh.urls')), )