Merge branch 'master' of https://github.com/alazo/eds
This commit is contained in:
commit
b8c01e477a
10 changed files with 208 additions and 51 deletions
28
cms/admin.py
28
cms/admin.py
|
|
@ -1,19 +1,30 @@
|
|||
from django.contrib import admin
|
||||
from .models import (Enseignant, Domaine, Competence, SousCompetence, Objectif,
|
||||
Ressource, Module, Processus)
|
||||
from .forms import ProcessusAdminForm, ModuleAdminForm, DomaineAdminForm
|
||||
from .forms import (ProcessusAdminForm, ProcessusInlineAdminForm, ModuleAdminForm, DomaineAdminForm, CompetenceAdminForm,
|
||||
SousCompetenceInlineAdminForm, CompetenceInlineAdminForm, ObjectifAdminForm, RessourceAdminForm,
|
||||
SousCompetenceAdminForm)
|
||||
# Register your models here.
|
||||
|
||||
class SousCompetenceInline(admin.TabularInline):
|
||||
form = SousCompetenceInlineAdminForm
|
||||
model = SousCompetence
|
||||
extra = 0
|
||||
|
||||
class CompetenceInline(admin.TabularInline):
|
||||
form = CompetenceInlineAdminForm
|
||||
model = Competence
|
||||
extra=0
|
||||
#template ='templates/admin/cms/processus/edit_inline/tabular.html'
|
||||
|
||||
class SousCompetenceAdmin(admin.ModelAdmin):
|
||||
form = SousCompetenceAdminForm
|
||||
|
||||
|
||||
|
||||
|
||||
class RessourceAdmin(admin.ModelAdmin):
|
||||
form = RessourceAdminForm
|
||||
list_display = ('nom', 'module')
|
||||
|
||||
|
||||
|
|
@ -26,12 +37,19 @@ class ModuleAdmin(admin.ModelAdmin):
|
|||
class ProcessusAdmin(admin.ModelAdmin):
|
||||
form = ProcessusAdminForm
|
||||
|
||||
class ProcessusAdminInline(admin.TabularInline):
|
||||
|
||||
class ObjectifAdmin(admin.ModelAdmin):
|
||||
form = ObjectifAdminForm
|
||||
|
||||
|
||||
class ProcessusInlineAdmin(admin.TabularInline):
|
||||
form = ProcessusInlineAdminForm
|
||||
model = Processus
|
||||
extra=0
|
||||
|
||||
|
||||
class CompetenceAdmin(admin.ModelAdmin):
|
||||
form = CompetenceAdminForm
|
||||
list_display = ('code', 'nom', 'module')
|
||||
list_editable = ('module',)
|
||||
inlines = (SousCompetenceInline,)
|
||||
|
|
@ -40,14 +58,14 @@ class CompetenceAdmin(admin.ModelAdmin):
|
|||
class DomaineAdmin(admin.ModelAdmin):
|
||||
list_display = ('nom', 'responsable',)
|
||||
form = DomaineAdminForm
|
||||
inlines = [ProcessusAdminInline,]
|
||||
inlines = [ProcessusInlineAdmin,]
|
||||
|
||||
|
||||
admin.site.register(Enseignant)
|
||||
admin.site.register(Domaine, DomaineAdmin)
|
||||
admin.site.register(Competence, CompetenceAdmin)
|
||||
admin.site.register(SousCompetence)
|
||||
admin.site.register(Objectif)
|
||||
admin.site.register(SousCompetence, SousCompetenceAdmin)
|
||||
admin.site.register(Objectif, ObjectifAdmin)
|
||||
admin.site.register(Ressource, RessourceAdmin)
|
||||
admin.site.register(Module, ModuleAdmin)
|
||||
admin.site.register(Processus, ProcessusAdmin)
|
||||
|
|
|
|||
118
cms/forms.py
118
cms/forms.py
|
|
@ -4,7 +4,7 @@ Created on 17 nov. 2012
|
|||
|
||||
@author: alzo
|
||||
'''
|
||||
from .models import Processus, Module, Domaine
|
||||
from .models import Processus, Module, Domaine, Competence, SousCompetence
|
||||
from django import forms
|
||||
|
||||
from django.contrib import admin
|
||||
|
|
@ -14,7 +14,8 @@ from _collections_abc import __all__
|
|||
|
||||
class DocumentForm(forms.Form):
|
||||
docfile = forms.FileField(label='Selectionner un fichier', help_text='Taille max.: 42 megabytes')
|
||||
|
||||
|
||||
|
||||
class ProcessusAdminForm(forms.ModelForm):
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
|
|
@ -25,7 +26,8 @@ class ProcessusAdminForm(forms.ModelForm):
|
|||
model = Processus
|
||||
fields = ('code', 'nom', 'domaine', 'description')
|
||||
widgets = {
|
||||
'nom': forms.Textarea(attrs={'cols': 75, 'rows':2}),
|
||||
'nom': forms.Textarea(attrs={'cols': 125, 'rows':2}),
|
||||
'description': forms.Textarea(attrs={'cols': 125, 'rows':8}),
|
||||
}
|
||||
|
||||
class DomaineAdminForm(forms.ModelForm):
|
||||
|
|
@ -37,9 +39,103 @@ class DomaineAdminForm(forms.ModelForm):
|
|||
model = Domaine
|
||||
fields = ('code', 'nom', 'responsable')
|
||||
widgets = {
|
||||
'nom': forms.Textarea(attrs={'cols': 75, 'rows':2}),
|
||||
'nom': forms.Textarea(attrs={'cols': 125, 'rows':2}),
|
||||
}
|
||||
|
||||
|
||||
class CompetenceAdminForm(forms.ModelForm):
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(CompetenceAdminForm, self).__init__(*args, **kwargs)
|
||||
|
||||
class Meta:
|
||||
model = Competence
|
||||
fields = ('__all__')
|
||||
widgets = {
|
||||
'nom': forms.Textarea(attrs={'cols': 125, 'rows':2}),
|
||||
}
|
||||
|
||||
|
||||
class SousCompetenceAdminForm(forms.ModelForm):
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(SousCompetenceAdminForm, self).__init__(*args, **kwargs)
|
||||
|
||||
class Meta:
|
||||
model = SousCompetence
|
||||
fields = ('__all__')
|
||||
widgets = {
|
||||
'nom': forms.Textarea(attrs={'cols': 125, 'rows':2}),
|
||||
}
|
||||
|
||||
|
||||
class CompetenceInlineAdminForm(forms.ModelForm):
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(CompetenceInlineAdminForm, self).__init__(*args, **kwargs)
|
||||
|
||||
class Meta:
|
||||
model = SousCompetence
|
||||
fields = ('__all__')
|
||||
widgets = {
|
||||
'code': forms.Textarea(attrs={'cols': 5, 'rows':1}),
|
||||
'nom': forms.Textarea(attrs={'cols': 125, 'rows':2}),
|
||||
}
|
||||
|
||||
|
||||
class SousCompetenceInlineAdminForm(forms.ModelForm):
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(SousCompetenceInlineAdminForm, self).__init__(*args, **kwargs)
|
||||
|
||||
class Meta:
|
||||
model = SousCompetence
|
||||
fields = ('__all__')
|
||||
widgets = {
|
||||
'code': forms.Textarea(attrs={'cols': 5, 'rows':1}),
|
||||
'nom': forms.Textarea(attrs={'cols': 125, 'rows':1}),
|
||||
}
|
||||
|
||||
|
||||
class ProcessusInlineAdminForm(forms.ModelForm):
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(ProcessusInlineAdminForm, self).__init__(*args, **kwargs)
|
||||
|
||||
class Meta:
|
||||
model = SousCompetence
|
||||
fields = ('__all__')
|
||||
widgets = {
|
||||
'code': forms.Textarea(attrs={'cols': 5, 'rows':1}),
|
||||
'nom': forms.Textarea(attrs={'cols': 75, 'rows':4}),
|
||||
'description': forms.Textarea(attrs={'cols': 95, 'rows':6}),
|
||||
}
|
||||
|
||||
class ObjectifAdminForm(forms.ModelForm):
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(ObjectifAdminForm, self).__init__(*args, **kwargs)
|
||||
|
||||
class Meta:
|
||||
model = SousCompetence
|
||||
fields = ('__all__')
|
||||
widgets = {
|
||||
'nom': forms.Textarea(attrs={'cols': 125, 'rows':2}),
|
||||
}
|
||||
|
||||
|
||||
class RessourceAdminForm(forms.ModelForm):
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(RessourceAdminForm, self).__init__(*args, **kwargs)
|
||||
|
||||
class Meta:
|
||||
model = SousCompetence
|
||||
fields = ('__all__')
|
||||
widgets = {
|
||||
'nom': forms.Textarea(attrs={'cols': 125, 'rows':3}),
|
||||
}
|
||||
|
||||
|
||||
class ModuleAdminForm(forms.ModelForm):
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
|
|
@ -50,11 +146,11 @@ class ModuleAdminForm(forms.ModelForm):
|
|||
model = Module
|
||||
fields = ('__all__')
|
||||
widgets = {
|
||||
'nom': forms.Textarea(attrs={'cols': 73, 'rows':2}),
|
||||
'description': forms.Textarea(attrs={'cols': 73, 'rows':4}),
|
||||
'situation': forms.Textarea(attrs={'cols': 73, 'rows':6}),
|
||||
'contenu': forms.Textarea(attrs={'cols': 73, 'rows':4}),
|
||||
'didactique': forms.Textarea(attrs={'cols': 73, 'rows':4}),
|
||||
'evaluation': forms.Textarea(attrs={'cols': 73, 'rows':2}),
|
||||
'nom': forms.Textarea(attrs={'cols': 125, 'rows':2}),
|
||||
'description': forms.Textarea(attrs={'cols': 125, 'rows':4}),
|
||||
'situation': forms.Textarea(attrs={'cols': 125, 'rows':6}),
|
||||
'contenu': forms.Textarea(attrs={'cols': 125, 'rows':4}),
|
||||
'didactique': forms.Textarea(attrs={'cols': 125, 'rows':2}),
|
||||
'evaluation': forms.Textarea(attrs={'cols': 125, 'rows':2}),
|
||||
}
|
||||
|
||||
30
cms/migrations/0017_auto_20170308_0437.py
Normal file
30
cms/migrations/0017_auto_20170308_0437.py
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.10.4 on 2017-03-08 03:37
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('cms', '0016_remove_module_description'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='module',
|
||||
name='periode_presentiel',
|
||||
field=models.IntegerField(verbose_name='Période en présentiel'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='module',
|
||||
name='pratique_prof',
|
||||
field=models.IntegerField(default=0, verbose_name='Pratique professionnelle'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='module',
|
||||
name='travail_perso',
|
||||
field=models.IntegerField(verbose_name='Travail personnel'),
|
||||
),
|
||||
]
|
||||
|
|
@ -47,25 +47,9 @@ class Enseignant(models.Model):
|
|||
return '{0} {1}'.format(self.nom, self.prenom)
|
||||
|
||||
def descr(self):
|
||||
return '{0} (<A HREF="{1}">{3}</A>)'.format(self.__str__(), self.email, self.email)
|
||||
|
||||
|
||||
class SVG_Domaine:
|
||||
compteur = 0
|
||||
x = 30
|
||||
y = 10
|
||||
width = 200
|
||||
svg = '<rect x="20" y="{0}" rx="5" ry="5" width="60" height="{1}" fill="{3}" stroke="black" stroke-width="2" />'
|
||||
txt = '<text x="25" y="{0}" style="stroke:#000000;font-size:12;">{1}</text>'
|
||||
|
||||
def get_svg(self):
|
||||
return '{0}{1}'.format(self.svg, self.txt)
|
||||
|
||||
def __init__(self, domaine):
|
||||
SVG_Domaine.compteur += 1
|
||||
self.svg = self.svg.format(20, 100, settings.DOMAINE_COULEUR[domaine.code])
|
||||
self.txt = self.txt.format(20, domaine.__str__())
|
||||
|
||||
|
||||
return '{0} (<a href="mailto:{1}">{2}</A>)'.format(self.__str__(), self.email, self.email)
|
||||
|
||||
|
||||
|
||||
class Domaine(models.Model):
|
||||
|
|
@ -73,6 +57,8 @@ class Domaine(models.Model):
|
|||
nom = models.CharField(max_length=200, blank=False)
|
||||
responsable = models.ForeignKey(Enseignant, null=True, default=None)
|
||||
|
||||
height_screen = 50
|
||||
|
||||
class Meta:
|
||||
ordering = ('code',)
|
||||
|
||||
|
|
@ -83,10 +69,14 @@ class Domaine(models.Model):
|
|||
return "<a href='/domaine/{0}'>{1}</a>".format(self.id, self.__str__())
|
||||
|
||||
def svg(self):
|
||||
svg = '<rect x="20" y="{0}" rx="5" ry="5" width="200" height="{1}" fill="{2}" stroke="black" stroke-width="1" />'
|
||||
txt = '<text x="25" y="{0}" style="stroke:#000000;font-size:10;">{1}</text>'
|
||||
processus = self.processus_set.all()
|
||||
|
||||
return svg.format(20, 100, settings.DOMAINE_COULEURS[self.code]) + txt.format(50, self.__str__())
|
||||
|
||||
svg = '<rect x="20" y="{0}" rx="5" ry="5" width="250" height="{1}" fill="{2}" stroke="black" stroke-width="1" />'
|
||||
txt = '<text x="25" y="{0}" style="stroke:#000000;font-size:10;">{1}</text>'
|
||||
height_frame = processus.count()* self.height_screen
|
||||
color = settings.DOMAINE_COULEURS[self.code]
|
||||
return svg.format(20, height_frame , color) + txt.format(50, self.__str__())
|
||||
|
||||
|
||||
|
||||
|
|
@ -117,9 +107,9 @@ class Module(models.Model):
|
|||
situation = models.TextField()
|
||||
evaluation = models.TextField()
|
||||
contenu = models.TextField()
|
||||
periode_presentiel = models.IntegerField()
|
||||
travail_perso = models.IntegerField()
|
||||
pratique_prof = models.IntegerField(default=0)
|
||||
periode_presentiel = models.IntegerField(verbose_name='Période en présentiel')
|
||||
travail_perso = models.IntegerField(verbose_name = 'Travail personnel')
|
||||
pratique_prof = models.IntegerField(default=0, verbose_name='Pratique professionnelle')
|
||||
didactique = models.TextField()
|
||||
evaluation = models.TextField()
|
||||
sem1 = models.IntegerField(default=0)
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ ROOT_URLCONF = 'common.urls'
|
|||
TEMPLATES = [
|
||||
{
|
||||
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
||||
'DIRS': [os.path.join(BASE_DIR, 'templates/')],
|
||||
'DIRS': [os.path.join(BASE_DIR, 'templates')],
|
||||
'APP_DIRS': True,
|
||||
'OPTIONS': {
|
||||
'context_processors': [
|
||||
|
|
@ -97,7 +97,7 @@ AUTH_PASSWORD_VALIDATORS = [
|
|||
|
||||
LANGUAGE_CODE = 'fr-fr'
|
||||
|
||||
TIME_ZONE = 'UTC'
|
||||
TIME_ZONE = 'Europe/Zurich'
|
||||
|
||||
USE_I18N = True
|
||||
|
||||
|
|
@ -110,10 +110,10 @@ USE_TZ = True
|
|||
# https://docs.djangoproject.com/en/1.10/howto/static-files/
|
||||
|
||||
STATIC_URL = '/static/'
|
||||
STATIC_ROOT = os.path.join(BASE_DIR, 'static/')
|
||||
STATIC_ROOT = os.path.join(BASE_DIR, 'static')
|
||||
|
||||
MEDIA_URL = '/media/'
|
||||
MEDIA_ROOT = os.path.join(BASE_DIR, 'media/')
|
||||
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
|
||||
|
||||
STUDENT_IMPORT_MAPPING = {
|
||||
'Num élève': 'id_ext',
|
||||
|
|
|
|||
25
templates/cms/404.html
Normal file
25
templates/cms/404.html
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
{% extends "./base_site.html" %}
|
||||
{% load i18n static %}
|
||||
|
||||
{% block extrastyle %}{{ block.super }}<link rel="stylesheet" type="text/css" href="{% static "admin/css/dashboard.css" %}" />
|
||||
<link rel="stylesheet" type="text/css" href="{% static "css/main.css" %}" />{% endblock %}
|
||||
|
||||
{% block coltype %}colMS{% endblock %}
|
||||
|
||||
{% block bodyclass %}{{ block.super }} dashboard{% endblock %}
|
||||
|
||||
{% block breadcrumbs %}
|
||||
<div class="breadcrumbs">
|
||||
<a href="{% url 'home' %}">Accueil</a>
|
||||
<a href="{% url 'document' %}">Document</a>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
<div id="content-main">
|
||||
Page non trouvée
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
|
||||
|
|
@ -8,7 +8,7 @@
|
|||
{% block content %}
|
||||
|
||||
<div id="content-main">
|
||||
<h1>Domaine: {{object.code}} - {{object.libelle}}</h1>
|
||||
<h1>Domaine: {{object}}</h1>
|
||||
{% for p in object.processus_set.all %}
|
||||
<div class="processus"><h2>Processus: {{ p.url|safe }}</h2></div>
|
||||
{% for m in p.module_set.all %}
|
||||
|
|
|
|||
|
|
@ -47,7 +47,6 @@
|
|||
<td></td><td> </td><td> </td><td> </td><td class="l2 m">{{M07.url_code|safe}}</td><td class="l2 m">{{M09.url_code|safe}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
||||
<td></td><td> </td><td> </td><td> </td><td class="l2 m">{{M08.url_code|safe}}</td><td> </td>
|
||||
</tr>
|
||||
|
||||
|
|
@ -81,7 +80,7 @@
|
|||
<td class="l6 p">{{P09.url|safe}}</td>
|
||||
<td colspan="2" class="l6 m">{{M16_1a.url_code|safe}} / {{M16_1b.url_code|safe}} / {{M16_1c.url_code|safe}} / {{M16_1d.url_code|safe}} / {{M16_1e.url_code|safe}}</td>
|
||||
<td colspan="2" class="l6 m">{{M16_2a.url_code|safe}}</td>
|
||||
<td colspan="2" class="l6 m">{{M16_3a.url_code|safe}} / {{M16_3b.url_code|safe}} / {{M16_3c.url_code|safe}} / {{M16_3d.url_code|safe}}</td>
|
||||
<td colspan="2" class="l6 m">{{M16_3a.url_code|safe}} / {{M16_3b.url_code|safe}} / {{M16_3c.url_code|safe}} / {{M16_3d.url_code|safe}} / {{M16_3e.url_code|safe}}</td>
|
||||
</tr>
|
||||
<!-- Ligne 7 -->
|
||||
<tr>
|
||||
|
|
@ -102,7 +101,6 @@
|
|||
<br/>
|
||||
<a href="{% url 'plan-pdf' %}">Imprimer en PDF</a>
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@
|
|||
{% if object.travail_perso > 0 %}
|
||||
<tr><th>Travail perso.</th><td>{{object.travail_perso}} heures</td></tr>
|
||||
{% endif %}
|
||||
<tr><th>Responsable</th><td>{{object.processus.domaine.responsable.descr}}</td></tr>
|
||||
<tr><th>Responsable</th><td>{{object.processus.domaine.responsable.descr|safe}}</td></tr>
|
||||
</table>
|
||||
<p><a href="{% url 'module-pdf' object.id %}">Imprimer en PDF</a></p>
|
||||
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
{% for m in object.module_set.all %}{% for c in m.competences.all %}
|
||||
- {{c.libelle}} ({{c.code}})<br />{% endfor %}{% endfor %}</td></tr>
|
||||
<tr><th>Domaine</th><td>{{object.domaine.url|safe}}</td></tr>
|
||||
<tr><th>Responsable</th><td>{{object.domaine.responsable}} ({{object.domaine.responsable.email}})</td></tr>
|
||||
<tr><th>Responsable</th><td>{{object.domaine.responsable.descr|safe}}</td></tr>
|
||||
<tr><th>Modules concernés</th><td>{% for m in object.module_set.all %}{{m.url|safe}}</br>{% endfor %}</td></tr>
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue