version beta

This commit is contained in:
alazo 2017-01-08 22:23:53 +01:00
parent 2f5614666f
commit 545c0c494f
18 changed files with 467 additions and 71 deletions

5
.gitignore vendored Normal file
View file

@ -0,0 +1,5 @@
*.pyc
common/local_settings.py
db.sqlite3
*.sql

18
.project Normal file
View file

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>eds</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.python.pydev.PyDevBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.python.pydev.pythonNature</nature>
<nature>org.python.pydev.django.djangoNature</nature>
</natures>
</projectDescription>

12
.pydevproject Normal file
View file

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?eclipse-pydev version="1.0"?><pydev_project>
<pydev_variables_property name="org.python.pydev.PROJECT_VARIABLE_SUBSTITUTION">
<key>DJANGO_MANAGE_LOCATION</key>
<value>eds/manage.py</value>
</pydev_variables_property>
<pydev_pathproperty name="org.python.pydev.PROJECT_SOURCE_PATH">
<path>/${PROJECT_DIR_NAME}</path>
</pydev_pathproperty>
<pydev_property name="org.python.pydev.PYTHON_PROJECT_VERSION">python 3.0</pydev_property>
<pydev_property name="org.python.pydev.PYTHON_PROJECT_INTERPRETER">eds</pydev_property>
</pydev_project>

View file

@ -0,0 +1,5 @@
eclipse.preferences.version=1
encoding//cms/forms.py=utf-8
encoding//cms/models.py=utf-8
encoding//cms/views.py=utf-8
encoding//common/settings.py=utf-8

View file

@ -0,0 +1,27 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.10.4 on 2017-01-08 21:19
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('cms', '0012_auto_20170104_1347'),
]
operations = [
migrations.AlterModelOptions(
name='competence',
options={'ordering': ('code',), 'verbose_name': 'compétence'},
),
migrations.AlterModelOptions(
name='processus',
options={'ordering': ('code',), 'verbose_name_plural': 'processus'},
),
migrations.AlterModelOptions(
name='souscompetence',
options={'ordering': ('code',), 'verbose_name': 'sous-compétence'},
),
]

View file

@ -5,8 +5,22 @@ Created on 17 nov. 2012
@author: alzo @author: alzo
''' '''
from django.db import models from django.db import models
from django.http.response import HttpResponse
from django.conf import settings
from reportlab.platypus import SimpleDocTemplate
from reportlab.platypus import Paragraph, Spacer, PageBreak, Table, TableStyle, Image
from reportlab.graphics.shapes import Line
from reportlab.lib.pagesizes import A4, landscape
from reportlab.lib.units import cm
from reportlab.lib.enums import TA_LEFT, TA_CENTER
from reportlab.lib import colors
from reportlab.lib.styles import ParagraphStyle as PS
style_8_c = PS(name='CORPS', fontName='Helvetica', fontSize=6, alignment = TA_CENTER)
style_normal = PS(name='CORPS', fontName='Helvetica', fontSize=8, alignment = TA_LEFT)
style_bold = PS(name='CORPS', fontName='Helvetica-Bold', fontSize=10, alignment = TA_LEFT)
style_title = PS(name='CORPS', fontName='Helvetica', fontSize=12, alignment = TA_LEFT)
style_adress = PS(name='CORPS', fontName='Helvetica', fontSize=10, alignment = TA_LEFT, leftIndent=300)
# Create your models here. # Create your models here.
CHOIX_TYPE_SAVOIR = ( CHOIX_TYPE_SAVOIR = (
@ -32,6 +46,9 @@ class Enseignant(models.Model):
def __str__(self): def __str__(self):
return '{0} {1}'.format(self.nom, self.prenom) return '{0} {1}'.format(self.nom, self.prenom)
def descr(self):
return '{0} ({1})'.format(self.__str__(), self.email)
class Domaine(models.Model): class Domaine(models.Model):
code = models.CharField(max_length=20, blank=True) code = models.CharField(max_length=20, blank=True)
@ -102,7 +119,7 @@ class Module(models.Model):
return "<a href='/module/{0}'>{1}</a>".format(self.id, self.__str__()) return "<a href='/module/{0}'>{1}</a>".format(self.id, self.__str__())
def url_code(self): def url_code(self):
return "<a href='/module/{0}'>{1}</a>".format(self.id, self.code) return "<a href='/module/{0}' title='{2}'>{1}</a>".format(self.id, self.code, self.nom)
class Competence(models.Model): class Competence(models.Model):
@ -143,7 +160,6 @@ class Ressource(models.Model):
class Objectif(models.Model): class Objectif(models.Model):
libelle = models.CharField(max_length=200, blank=False) libelle = models.CharField(max_length=200, blank=False)
#type = models.CharField(max_length=30, choices = CHOIX_TYPE_SAVOIR)
module=models.ForeignKey(Module, null=True, default=None) module=models.ForeignKey(Module, null=True, default=None)
def __str__(self): def __str__(self):
@ -155,9 +171,60 @@ class Document(models.Model):
class PDFResponse(HttpResponse):
def __init__(self, filename, title=''):
HttpResponse.__init__(self, content_type='application/pdf')
self['Content-Disposition'] = 'attachment; filename={0}'.format(filename)
self['Content-Type'] = 'charset=utf-8'
self.story = []
image = Image(settings.MEDIA_ROOT + '/media/header.gif', width=350, height=40)
image.hAlign = 0
self.story.append(image)
self.story.append(Spacer(0,1*cm))
data = [['Filières EDS', title]]
t = Table(data, colWidths=[8*cm,8*cm])
t.setStyle(TableStyle([ ('ALIGN',(0,0),(0,0),'LEFT'),
('ALIGN',(1,0),(-1,-1),'RIGHT'),
('LINEABOVE', (0,0) ,(-1,-1), 0.5, colors.black),
('LINEBELOW', (0,-1),(-1,-1), 0.5, colors.black),
]))
t.hAlign = 0
self.story.append(t)
class MyDocTemplate(SimpleDocTemplate):
def __init__(self, name):
#BaseDocTemplate.__init__(self,name, pagesize=A4, topMargin=0.5*cm)
SimpleDocTemplate.__init__(self, name, pagesize=A4, topMargin=0.5*cm)
self.fileName = name
def beforePage(self):
# page number
self.canv.saveState()
self.canv.setFontSize(8)
#self.canv.drawCentredString(self.CENTRE_WIDTH,1*cm,"Page : " + str(self.canv.getPageNumber()))
self.canv.restoreState()
class MyDocTemplateLandscape(SimpleDocTemplate):
def __init__(self, name):
SimpleDocTemplate.__init__(self, name, pagesize=landscape(A4), topMargin=0.5*cm)
self.fileName = name
def beforePage(self):
# page number
self.canv.saveState()
self.canv.setFontSize(8)
#self.canv.drawCentredString(self.CENTRE_WIDTH,1*cm,"Page : " + str(self.canv.getPageNumber()))
self.canv.restoreState()

View file

@ -31,12 +31,11 @@
#plan { #plan {
border-collapse: separate; border-collapse: separate;
border-spacing: 5px 10px; border-spacing: 5px 6px;
} }
table th { table th {
font-size:120%; font-size:110%;
} }
ul, ul li { ul, ul li {
@ -49,11 +48,16 @@ ul li {
list-style-type:none; list-style-type:none;
*/ */
} }
.liste-table { .liste-table {
margin-left:10px;
padding-left:0px;
}
.liste-table li{
list-style-type:square; list-style-type:square;
margin-left:0px; margin-left:3px;
padding:0px; padding:0px 10px;;
} }
.clear-booth { .clear-booth {
float:none; float:none;

BIN
cms/static/img/header.gif Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

View file

@ -5,9 +5,10 @@ Created on 4 déc. 2012
@author: alzo @author: alzo
''' '''
import os import os
from django.shortcuts import render from django.shortcuts import render, render_to_response
from django.views.generic import ListView, TemplateView, DetailView from django.views.generic import ListView, TemplateView, DetailView
from .models import Domaine, Processus, Module, Document, Document from .models import Domaine, Processus, Module, Document, PDFResponse, MyDocTemplate, MyDocTemplateLandscape
from .models import style_normal, style_bold, style_title
from django.db.models import F, Sum from django.db.models import F, Sum
from django.conf import settings from django.conf import settings
@ -15,12 +16,19 @@ from django.http import HttpResponseRedirect
from django.http import HttpResponse from django.http import HttpResponse
from .forms import DocumentForm from .forms import DocumentForm
from reportlab.pdfgen import canvas
from reportlab.platypus import Paragraph, Spacer, PageBreak, Table, TableStyle, Preformatted
from reportlab.lib.units import cm
from reportlab.lib.enums import TA_LEFT
from reportlab.lib import colors
from reportlab.lib.colors import HexColor
# Create your views here. # Create your views here.
class HomeView(TemplateView): class HomeView(TemplateView):
template_name = 'cms/index.html' template_name = 'cms/index.html'
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
context = super(HomeView, self).get_context_data(**kwargs) context = super(HomeView, self).get_context_data(**kwargs)
for d in Domaine.objects.all().order_by('code'): for d in Domaine.objects.all().order_by('code'):
@ -35,6 +43,88 @@ class HomeView(TemplateView):
return context return context
class HomwPDFView(TemplateView):
template_name = 'cms/index.html'
def render_to_response(self, context, **response_kwargs):
response = PDFResponse('PlanFormation.pdf' ,'Plan de formation')
d = Domaine.objects.all().order_by('code')
p = Processus.objects.all().order_by('code')
data = [['Domaines','Processus', 'Sem1', 'Sem2', 'Sem3','Sem4','Sem5','Sem6'],
[Preformatted(d[0].__str__(), style_normal, maxLineLength=40), Preformatted(p[0].__str__(), style_normal, maxLineLength=60) , 'M01' , '' ,'' , '' , '' ,'' ],
['' , '' , 'M02' , '' ,'' , '' , '' ,'' ],
['' , Preformatted(p[1].__str__(), style_normal, maxLineLength=60) , '' , 'M03' ,'' , '' , '' , '' ],
['' , '' , '' , 'M04' ,'' , '' , '' , '' ],
[Preformatted(d[1].__str__(), style_normal, maxLineLength=40), Preformatted(p[2].__str__(), style_normal, maxLineLength=60) , 'M05' , '' ,'M06' , '' , '' , '' ],
['' , Preformatted(p[3].__str__(), style_normal, maxLineLength=60) , '' , '' ,'' , 'M07' , '' , 'M09' ],
['' , '' , '' , '' ,'' , 'M08' , '' , '' ],
[Preformatted(d[2].__str__(), style_normal, maxLineLength=40), Preformatted(p[4].__str__(), style_normal, maxLineLength=60) , '' , '' ,'' , 'M10' , '' , 'M12' ],
['' , Preformatted(p[5].__str__(), style_normal, maxLineLength=60) , '' , '' ,'' , 'M11' , '' , '' ],
[Preformatted(d[3].__str__(), style_normal, maxLineLength=40), Preformatted(p[6].__str__(), style_normal, maxLineLength=60) , '' , '' ,'' , 'M13' , '' , 'M14' ],
[Preformatted(d[4].__str__(), style_normal, maxLineLength=40), Preformatted(p[7].__str__(), style_normal, maxLineLength=60) , 'M15' , '' ,'' , '' , '' , '' ],
[Preformatted(d[5].__str__(), style_normal, maxLineLength=40), Preformatted(p[8].__str__(), style_normal, maxLineLength=60) , 'M16_1' , '' ,'M16_2' , '' , 'M16_3' , '' ],
[Preformatted(d[6].__str__(), style_normal, maxLineLength=40), Preformatted(p[9].__str__(), style_normal, maxLineLength=60), 'M17_1' , '' ,'M17_2' , '' , 'M17_3' , '' ],
[Preformatted(d[7].__str__(), style_normal, maxLineLength=40), Preformatted(p[10].__str__(), style_normal, maxLineLength=60) , 'Macc' , '' ,'' , '' , '' , '' ],
]
t = Table(data, colWidths=[5.5*cm, 8*cm, 1.5*cm, 1.5*cm,1.5*cm, 1.5*cm,1.5*cm,1.5*cm], spaceBefore=1*cm, spaceAfter=1*cm)
t.setStyle(TableStyle([
('SIZE', (0,0), (-1,-1), 8),
('FONT', (0,0), (-1,0), 'Helvetica-Bold'),
('VALIGN',(0,0),(-1,-1),'MIDDLE'),
('ALIGN',(2,0),(-1,-1),'CENTER'),
#('BOX',(0,0),(-1,-1), 0.25, colors.black),
('GRID',(0,0),(-1,-1), 0.25, colors.black),
('SPAN',(0,1), (0,4)),
('SPAN',(1,1), (1,2)),
('SPAN',(1,3), (1,4)),
('SPAN',(0,5), (0,7)),
('SPAN',(1,6), (1,7)),
('SPAN',(0,8), (0,9)),
('SPAN',(0,8), (0,9)),
('SPAN',(5,8), (6,8)),
('SPAN',(5,9), (6,9)),
('SPAN',(2,11), (-1,11)),
('SPAN',(2,12), (3,12)),
('SPAN',(4,12), (5,12)),
('SPAN',(6,12), (7,12)),
('SPAN',(2,13), (3,13)),
('SPAN',(4,13), (5,13)),
('SPAN',(6,13), (7,13)),
('SPAN',(2,14), (-1,14)),
('BACKGROUND',(0,1), (1,4), colors.orange),
('BACKGROUND',(2,1), (2,2), colors.orange),
('BACKGROUND',(3,3), (3,4), colors.orange),
('BACKGROUND',(0,5), (1,7), colors.red),
('BACKGROUND',(2,5), (2,5), colors.red),
('BACKGROUND',(4,5), (4,5), colors.red),
('BACKGROUND',(5,6), (5,6), colors.red),
('BACKGROUND',(7,6), (7,6), colors.red),
('BACKGROUND',(5,7), (5,7), colors.red),
('BACKGROUND',(0,8), (1,9), colors.pink),
('BACKGROUND',(5,8), (-1,8), colors.pink),
('BACKGROUND',(5,9), (6,9), colors.pink),
('BACKGROUND',(0,10), (1,10), HexColor('#AD7FA8')),
('BACKGROUND',(5,10), (5,10), HexColor('#AD7FA8')),
('BACKGROUND',(7,10), (7,10), HexColor('#AD7FA8')),
('BACKGROUND',(0,11), (-1,11), HexColor('#729FCF')),
('BACKGROUND',(0,12), (-1,12), colors.lightgreen),
('BACKGROUND',(0,13), (-1,13), colors.white),
('BACKGROUND',(0,14), (-1,14), colors.lightgrey),
]))
t.hAlign = 0
response.story.append(t)
doc = MyDocTemplateLandscape(response)
doc.build(response.story)
return response
class DomaineDetailView(DetailView): class DomaineDetailView(DetailView):
template_name = 'cms/domaine_detail.html' template_name = 'cms/domaine_detail.html'
@ -65,33 +155,172 @@ class ModuleListView(ListView):
template_name = 'cms/module_list.html' template_name = 'cms/module_list.html'
model = Module model = Module
def Preformatted_left(text):
return Preformatted(text, style_normal, maxLineLength=15)
def Preformatted_right(text):
return Preformatted(text, style_normal, maxLineLength=110)
class ModulePDF(DetailView):
template_name = 'cms/module_detail.html'
model = Module
def get_object(self):
# Call the superclass
return super(ModulePDF, self).get_object()
def render_to_response(self, context, **response_kwargs):
#return DetailView.render_to_response(self, context, **response_kwargs)
m = self.get_object()
response = PDFResponse('Module_{0}.pdf'.format(m.code) ,'Module de formation')
str_comp = ''
for c in m.competences.all():
str_comp += '- {0} ({1})\n'.format(c.libelle, c.code)
if self.request.user.is_authenticated:
for sc in c.souscompetence_set.all():
str_comp += ' -- {0}\n'.format(sc.libelle)
str_res = ''
for c in m.ressource_set.all():
str_res += '- {0}\n'.format(c.libelle)
str_obj = ''
for c in m.objectif_set.all():
str_obj += '- {0}\n'.format(c.libelle)
lines = m.contenu.split('\n')
str_con = ''
for l in lines:
str_con += '{0}\n'.format(l)
response.story.append(Spacer(0,1*cm))
response.story.append(Paragraph(m.__str__(), style_title))
data = [[Preformatted_left('Domaine'), Preformatted_right(m.processus.domaine.__str__())],
[Preformatted_left('Processus'), Preformatted_right(m.processus.__str__())],
[Preformatted_left('Situation emblématique'), Preformatted_right(m.situation)],
[Preformatted_left('Compétences visées'), Preformatted_right(str_comp)],
[Preformatted_left('Ressources à acquérir'), Preformatted_right(str_res)],
[Preformatted_left('Objectifs à atteindre'), Preformatted_right(str_obj)],
[Preformatted_left('Contenu'), Preformatted_right(str_con)],
[Preformatted_left('Evaluation'), Preformatted_right(m.evaluation)],
[Preformatted_left('Type'), Preformatted_right(m.type)],
[Preformatted_left('Semestre'), Preformatted_right(m.semestre)],
[Preformatted_left('Présentiel'), Preformatted_right('{0} heures'.format(m.periode_presentiel))],
[Preformatted_left('Travail personnel'), Preformatted_right('{0} heures'.format(m.travail_perso))],
[Preformatted_left('Responsable'), Preformatted_right(m.processus.domaine.responsable.descr())],
]
t = Table(data, colWidths=[2.5*cm,10*cm])
t.setStyle(TableStyle([ ('ALIGN',(0,0),(-1,-1),'LEFT'),
('VALIGN',(0,0),(-1,-1),'TOP'),
('LEFTPADDING', (0,0),(-1,-1), 0),
]))
t.hAlign=0
response.story.append(Spacer(0,1*cm))
response.story.append(t)
doc = MyDocTemplate(response)
doc.build(response.story)
return response
"""
Calcul du nombre de périodes de formation
"""
def get_context(context):
liste = Module.objects.exclude(periode_presentiel = 0)
context['tot'] = liste.aggregate(Sum(F('periode_presentiel')))
context['sem1'] = liste.exclude(sem1 = 0)
context['tot1'] = liste.aggregate(Sum(F('sem1')))
context['sem2'] = liste.exclude(sem2 = 0)
context['tot2'] = liste.aggregate(Sum(F('sem2')))
context['sem3'] = liste.exclude(sem3 = 0)
context['tot3'] = liste.aggregate(Sum(F('sem3')))
context['sem4'] = liste.exclude(sem4 = 0)
context['tot4'] = liste.aggregate(Sum(F('sem4')))
context['sem5'] = liste.exclude(sem5 = 0)
context['tot5'] = liste.aggregate(Sum(F('sem5')))
context['sem6'] = liste.exclude(sem6 = 0)
context['tot6'] = liste.aggregate(Sum(F('sem6')))
return context
class PeriodeView(TemplateView): class PeriodeView(TemplateView):
template_name = 'cms/periodes.html' template_name = 'cms/periodes.html'
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
context = TemplateView.get_context_data(self, **kwargs) context = TemplateView.get_context_data(self, **kwargs)
liste = Module.objects.exclude(periode_presentiel = 0) return get_context(context)
context['tot'] = liste.aggregate(Sum(F('periode_presentiel')))
context['sem1'] = liste.exclude(sem1 = 0)
context['tot1'] = liste.aggregate(Sum(F('sem1')))
context['sem2'] = liste.exclude(sem2 = 0)
context['tot2'] = liste.aggregate(Sum(F('sem2')))
context['sem3'] = liste.exclude(sem3 = 0)
context['tot3'] = liste.aggregate(Sum(F('sem3')))
context['sem4'] = liste.exclude(sem4 = 0)
context['tot4'] = liste.aggregate(Sum(F('sem4')))
context['sem5'] = liste.exclude(sem5 = 0)
context['tot5'] = liste.aggregate(Sum(F('sem5')))
context['sem6'] = liste.exclude(sem6 = 0)
context['tot6'] = liste.aggregate(Sum(F('sem6')))
return context
class PeriodePDFView(TemplateView):
template_name = 'cms/periodes.html'
def render_to_response(self, context, **response_kwargs):
response = PDFResponse('Périodes.pdf' ,'Périodes de formation')
context = get_context(context)
data = [['Semestre 1', '{0} h.'.format(context['tot1']['sem1__sum']),'', 'Semestre 2', '{0} h.'.format(context['tot2']['sem2__sum'])],
[context['sem1'][0], '{0} h.'.format(context['sem1'][0].sem1),'', context['sem2'][0], '{0} h.'.format(context['sem2'][0].sem2) ],
[context['sem1'][1], '{0} h.'.format(context['sem1'][1].sem1),'', context['sem2'][1], '{0} h.'.format(context['sem2'][1].sem2) ],
[context['sem1'][2], '{0} h.'.format(context['sem1'][2].sem1),'', context['sem2'][2], '{0} h.'.format(context['sem2'][2].sem2) ],
[context['sem1'][3], '{0} h.'.format(context['sem1'][3].sem1),'', context['sem2'][3], '{0} h.'.format(context['sem2'][3].sem2) ],
[context['sem1'][4], '{0} h.'.format(context['sem1'][4].sem1),'', context['sem2'][4], '{0} h.'.format(context['sem2'][4].sem2) ],
[context['sem1'][5], '{0} h.'.format(context['sem1'][5].sem1),'', '','' ],
[context['sem1'][6], '{0} h.'.format(context['sem1'][6].sem1),'', '','' ],
['Semestre 3', '{0} h.'.format(context['tot3']['sem3__sum']),'', 'Semestre 4', '{0} h.'.format(context['tot4']['sem4__sum'])],
[context['sem3'][0], '{0} h.'.format(context['sem3'][0].sem3),'', context['sem4'][0], '{0} h.'.format(context['sem4'][0].sem4) ],
[context['sem3'][1], '{0} h.'.format(context['sem3'][1].sem3),'', context['sem4'][1], '{0} h.'.format(context['sem4'][1].sem4) ],
[context['sem3'][2], '{0} h.'.format(context['sem3'][2].sem3),'', context['sem4'][2], '{0} h.'.format(context['sem4'][2].sem4) ],
[context['sem3'][3], '{0} h.'.format(context['sem3'][3].sem3),'', context['sem4'][3], '{0} h.'.format(context['sem4'][3].sem4) ],
[context['sem3'][4], '{0} h.'.format(context['sem3'][4].sem3),'', context['sem4'][4], '{0} h.'.format(context['sem4'][4].sem4) ],
[context['sem3'][5], '{0} h.'.format(context['sem3'][5].sem3),'', context['sem4'][5], '{0} h.'.format(context['sem4'][5].sem4) ],
['','', '',context['sem4'][6], '{0} h.'.format(context['sem4'][6].sem4) ],
['Semestre 5', '{0} h.'.format(context['tot5']['sem5__sum']),'', 'Semestre 6', '{0} h.'.format(context['tot6']['sem6__sum'])],
[context['sem5'][0], '{0} h.'.format(context['sem5'][0].sem5),'', context['sem6'][0], '{0} h.'.format(context['sem6'][0].sem6) ],
[context['sem5'][1], '{0} h.'.format(context['sem5'][1].sem5),'', context['sem6'][1], '{0} h.'.format(context['sem6'][1].sem6) ],
[context['sem5'][2], '{0} h.'.format(context['sem5'][2].sem5),'', context['sem6'][2], '{0} h.'.format(context['sem6'][2].sem6) ],
[context['sem5'][3], '{0} h.'.format(context['sem5'][3].sem5),'', context['sem6'][3], '{0} h.'.format(context['sem6'][3].sem6) ],
[context['sem5'][4], '{0} h.'.format(context['sem5'][4].sem5),'', context['sem6'][4], '{0} h.'.format(context['sem6'][4].sem6) ],
[context['sem5'][5], '{0} h.'.format(context['sem5'][5].sem5),'', '','' ],
[context['sem5'][6], '{0} h.'.format(context['sem5'][6].sem5),'', '','' ],
]
t = Table(data, colWidths=[6.5*cm,1*cm, 1*cm, 6.5*cm, 1*cm], spaceBefore=2*cm, spaceAfter=1.5*cm)
t.setStyle(TableStyle([ ('ALIGN',(0,0),(-1,-1),'LEFT'),
('VALIGN',(0,0),(-1,-1),'TOP'),
('LEFTPADDING', (0,0),(-1,-1), 0),
('SIZE', (0,0), (-1,-1), 8),
('ALIGN', (1,0), (1,-1), 'RIGHT'),
('ALIGN', (-1,0), (-1,-1), 'RIGHT'),
('LINEBELOW', (0,0), (1,0), 1, colors.black),
('LINEBELOW', (3,0), (-1,0), 1, colors.black),
('TOPPADDING', (0,8), (-1,8), 15),
('LINEBELOW', (0,8), (1,8), 1, colors.black),
('LINEBELOW', (3,8), (-1,8), 1, colors.black),
('TOPPADDING', (0,16), (-1,16), 15),
('LINEBELOW', (0,16), (1,16), 1, colors.black),
('LINEBELOW', (3,16), (-1,16), 1, colors.black),
]))
t.hAlign = 0
response.story.append(t)
response.story.append(Paragraph('Total des heures de cours: {0} h.'.format(context['tot']['periode_presentiel__sum']), style_normal))
doc = MyDocTemplate(response)
doc.build(response.story)
return response
def AddDoc(request): def AddDoc(request):
if request.method == 'POST': if request.method == 'POST':
@ -115,4 +344,10 @@ def Download(request, file_name):
return response return response
def pdf_view(request):
with open('/home/alzo/dev/eds/media/media/EDS_Calendrier_2017.pdf', 'r') as pdf:
response = HttpResponse(pdf.read().decode('latin-1') , content_type='application/pdf')
response['Content-Disposition'] = 'inline;filename=some_file.pdf'
return response
pdf.closed

View file

@ -113,7 +113,7 @@ STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'static/') STATIC_ROOT = os.path.join(BASE_DIR, 'static/')
MEDIA_URL = '/media/' MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'media') MEDIA_ROOT = os.path.join(BASE_DIR, 'media/')
from .local_settings import * from .local_settings import *

View file

@ -21,6 +21,7 @@ from django.conf.urls.static import static
urlpatterns = [ urlpatterns = [
url(r'^$', views.HomeView.as_view(), name='home'), url(r'^$', views.HomeView.as_view(), name='home'),
url(r'^plan_pdf/$', views.HomwPDFView.as_view(), name='plan-pdf'),
url(r'^admin/', admin.site.urls), url(r'^admin/', admin.site.urls),
url(r'^domaine/(?P<pk>\d+)$', views.DomaineDetailView.as_view(), name='domaine-detail'), url(r'^domaine/(?P<pk>\d+)$', views.DomaineDetailView.as_view(), name='domaine-detail'),
url(r'^domaines/$', views.DomaineListView.as_view(), name='domaine-list'), url(r'^domaines/$', views.DomaineListView.as_view(), name='domaine-list'),
@ -28,7 +29,10 @@ urlpatterns = [
url(r'^processus/$', views.ProcessusListView.as_view(), name='processus-list'), url(r'^processus/$', views.ProcessusListView.as_view(), name='processus-list'),
url(r'^module/(?P<pk>\d+)$', views.ModuleDetailView.as_view(), name='module-detail'), url(r'^module/(?P<pk>\d+)$', views.ModuleDetailView.as_view(), name='module-detail'),
url(r'^modules/$', views.ModuleListView.as_view(), name='module-list'), url(r'^modules/$', views.ModuleListView.as_view(), name='module-list'),
url(r'^periode$', views.PeriodeView.as_view(), name='periode'), url(r'^periodes$', views.PeriodeView.as_view(), name='periodes'),
url(r'^periodes_pdf$', views.PeriodePDFView.as_view(), name='periodes-pdf'),
url(r'^upload$', views.AddDoc, name='upload'), url(r'^upload$', views.AddDoc, name='upload'),
url(r'^download/(?P<file_name>.+)$', views.Download, name='download'), url(r'^download/(?P<file_name>.+)$', views.Download, name='download'),
url(r'^calendrier/$', views.pdf_view, name='pdf-view'),
url(r'^module_pdf/(?P<pk>\d+)$', views.ModulePDF.as_view(), name='module-pdf'),
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) ] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

BIN
media/media/header.gif Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

View file

@ -1,7 +0,0 @@
@CHARSET "UTF-8";
#titre_col ul li {
list-style-type:none;
}

View file

@ -2,8 +2,17 @@
{% block title %}EDS{% endblock %} {% block title %}EDS{% endblock %}
{% block branding %}<h1 id="site-name"><a href="{% url 'admin:index' %}">Formation EDS</a></h1>{% endblock %} {% block branding %}<h1 id="site-name"><a href="{% url 'home' %}">Formation en Education sociale ES</a></h1>{% endblock %}
{% block usertools %}<div id="user-tools"><a href="{% url 'admin:index' %}">Admin</a></div>{% endblock %} {% block usertools %}
<div id="user-tools">
{% if user.is_authenticated %}
{% block welcome-msg %}Bienvenue <strong>{% firstof user.username %}</strong>.{% endblock %}
<a href="http://localhost:8000">Site public</a>&nbsp;&nbsp;<a href="{% url 'admin:index' %}">Admin</a>
{% else %}
<a href="{% url 'admin:index' %}">Admin</a>
{% endif %}
</div>
{% endblock %}
{% block nav-global %}{% endblock %} {% block nav-global %}{% endblock %}
{% block breadcrumbs %} {% block breadcrumbs %}
<div class="breadcrumbs"> <div class="breadcrumbs">
@ -12,7 +21,8 @@
<li><a href="{% url 'domaine-list' %}">Domaines</a>&nbsp;&nbsp;</li> <li><a href="{% url 'domaine-list' %}">Domaines</a>&nbsp;&nbsp;</li>
<li><a href="{% url 'processus-list' %}">Processus</a>&nbsp;&nbsp;</li> <li><a href="{% url 'processus-list' %}">Processus</a>&nbsp;&nbsp;</li>
<li><a href="{% url 'module-list' %}">Modules</a>&nbsp;&nbsp;</li> <li><a href="{% url 'module-list' %}">Modules</a>&nbsp;&nbsp;</li>
<li><a href="#">Calendrier</a>&nbsp;&nbsp;</li> <li><a href="{% url 'periodes' %}">Périodes</a>&nbsp;&nbsp;</li>
<!-- <li><a href="{% url 'pdf-view' %}">Calendrier</a>&nbsp;&nbsp;</li>-->
{% if has_permission %} {% if has_permission %}
<li><a href="#">Calendrier</a>&nbsp;&nbsp;</li> <li><a href="#">Calendrier</a>&nbsp;&nbsp;</li>
{% endif %} {% endif %}

View file

@ -79,9 +79,9 @@
<tr> <tr>
<td class="l6 d">{{D6.url|safe}}</td> <td class="l6 d">{{D6.url|safe}}</td>
<td class="l6 p">{{P09.url|safe}}</td> <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}}</td> <td colspan="2" class="l6 m">{{M16_1a.url_code|safe}} / {{M16_1b.url_code|safe}} / {{M16_1c.url_code|safe}}</td>
<td colspan="2" class="l6 m">{{M16_2a.url_code|safe}} - {{M16_2b.url_code|safe}} - {{M16_2c.url_code|safe}}</td> <td colspan="2" class="l6 m">{{M16_2a.url_code|safe}} / {{M16_2b.url_code|safe}} / {{M16_2c.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}}</td> <td colspan="2" class="l6 m">{{M16_3a.url_code|safe}} / {{M16_3b.url_code|safe}} / {{M16_3c.url_code|safe}}</td>
</tr> </tr>
<!-- Ligne 7 --> <!-- Ligne 7 -->
<tr> <tr>
@ -97,6 +97,8 @@
<td colspan="6" class="l8 m">{{MACC.url_code|safe}}</td> <td colspan="6" class="l8 m">{{MACC.url_code|safe}}</td>
</tr> </tr>
</table> </table>
<br/>
<a href="{% url 'plan-pdf' %}">Imprimer en PDF</a>
</div> </div>
{% endblock %} {% endblock %}

View file

@ -10,13 +10,15 @@
<table> <table>
<tr><th>Domaine</th><td>{{object.processus.domaine.url|safe}}</td></tr> <tr><th>Domaine</th><td>{{object.processus.domaine.url|safe}}</td></tr>
<tr><th>Processus</th><td>{{object.processus.url|safe}}</td></tr> <tr><th>Processus</th><td>{{object.processus.url|safe}}</td></tr>
<tr><th>Situation emblématique</th><td>{{object.situation}}</td></tr> <tr><th>Situation emblématique</th><td>{{object.situation|linebreaksbr}}</td></tr>
<tr><th>Compétences visées</th><td><p>L'éducateur social, l'éducatrice sociale</p> <tr><th>Compétences visées</th><td><p>L'éducateur social, l'éducatrice sociale:</p>
{% for c in object.competences.all %}- {{c.libelle}} ({{c.code}})<br />{% endfor %}</td></tr> {% for c in object.competences.all %}- {{c.libelle}} ({{c.code}})<br />
<tr><th>Ressources</th><td>{% for c in object.ressource_set.all %}- {{c}}<br />{% endfor %}</td></tr> {% if user.is_authenticated %}
<tr><th>Objectifs</th><td>{% for c in object.objectif_set.all %}- {{c}}<br />{% endfor %}</td></tr> {% for sc in c.souscompetence_set.all %}&nbsp;&nbsp;&nbsp; - {{sc.libelle}} <br />{%endfor %}{% endif %}{% endfor %}</td></tr>
<tr><th>Contenu</th><td>{{object.contenu}}</td></tr> <tr><th>Ressources à acquérir</th><td>{% for c in object.ressource_set.all %}- {{c}}<br />{% endfor %}</td></tr>
<tr><th>Evaluation</th><td>{{object.evaluation}}</td></tr> <tr><th>Objectifs à atteindre</th><td>{% for c in object.objectif_set.all %}- {{c}}<br />{% endfor %}</td></tr>
<tr><th>Contenu</th><td>{{object.contenu|linebreaksbr}}</td></tr>
<tr><th>Evaluation</th><td>{{object.evaluation|linebreaksbr}}</td></tr>
<tr><th>Type</th><td>{{object.type}}</td></tr> <tr><th>Type</th><td>{{object.type}}</td></tr>
<tr><th>Semestre</th><td>{{object.semestre}}</td></tr> <tr><th>Semestre</th><td>{{object.semestre}}</td></tr>
{% if object.periode_presentiel > 0 %} {% if object.periode_presentiel > 0 %}
@ -28,9 +30,9 @@
{% if object.travail_perso > 0 %} {% if object.travail_perso > 0 %}
<tr><th>Travail perso.</th><td>{{object.travail_perso}} heures</td></tr> <tr><th>Travail perso.</th><td>{{object.travail_perso}} heures</td></tr>
{% endif %} {% endif %}
<tr><th>Responsable</th><td>{{object.processus.domaine.responsable}} ({{object.processus.domaine.responsable.email}})</td></tr> <tr><th>Responsable</th><td>{{object.processus.domaine.responsable.descr}}</td></tr>
</table> </table>
<p><a href="{% url 'module-pdf' object.id %}">Imprimer en PDF</a></p>
</div> </div>
{% endblock %} {% endblock %}

View file

@ -1,47 +1,59 @@
{% extends "./base_site.html" %} {% extends "./base_site.html" %}
{% load i18n static %} {% 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 coltype %}colMS{% endblock %}
{% block bodyclass %}{{ block.super }} dashboard{% endblock %}
{% block breadcrumbs %}{% endblock %}
{% block content %} {% block content %}
<div id="content-main"> <div id="content-main">
<h1>Périodes de formation</h1> <h1>Périodes de formation</h1>
<table> <table>
<tr><th>Semestre 1</th><th text-align="right">{{tot1.sem1__sum}}h.</th></tr> <tr><th width="275px">Semestre 1</th><th text-align="right">{{tot1.sem1__sum}}h.</th><th width="275px">Semestre 2</th><th text-align="right">{{tot2.sem2__sum}}h.</th></tr>
<tr><td colspan="2"><table>
{% for s in sem1 %} {% for s in sem1 %}
<tr><td>{{s}}</td><td>{{s.sem1}} h.</td></tr> <tr><td>{{s}}</td><td>{{s.sem1}} h.</td></tr>
{% endfor %} {% endfor %}
<tr><th>Semestre 2</th><th text-align="right">{{tot2.sem2__sum}}h.</th></tr> </table>
</td>
<td colspan="2">
<table>
{% for s in sem2 %} {% for s in sem2 %}
<tr><td>{{s}}</td><td>{{s.sem2}} h.</td></tr> <tr><td>{{s}}</td><td>{{s.sem2}} h.</td></tr>
{% endfor %} {% endfor %}
<tr><th>Semestre 3</th><th text-align="right">{{tot3.sem3__sum}}h.</th></tr> </table>
</td></tr>
<tr><th>Semestre 3</th><th text-align="right">{{tot3.sem3__sum}}h.</th><th>Semestre 4</th><th text-align="right">{{tot4.sem4__sum}}h.</th> </tr>
<tr><td colspan="2"><table>
{% for s in sem3 %} {% for s in sem3 %}
<tr><td>{{s}}</td><td>{{s.sem3}} h.</td></tr> <tr><td>{{s}}</td><td>{{s.sem3}} h.</td></tr>
{% endfor %} {% endfor %}
<tr><th>Semestre 4</th><th text-align="right">{{tot4.sem4__sum}}h.</th></tr> </table></td>
<td colspan="2"><table>
{% for s in sem4 %} {% for s in sem4 %}
<tr><td>{{s}}</td><td>{{s.sem4}} h.</td></tr> <tr><td>{{s}}</td><td>{{s.sem4}} h.</td></tr>
{% endfor %} {% endfor %}
<tr><th>Semestre 5</th><th text-align="right">{{tot5.sem5__sum}}h.</th></tr> </table></td></tr>
<tr><th>Semestre 5</th><th text-align="right">{{tot5.sem5__sum}}h.</th><th>Semestre 6</th><th text-align="right">{{tot6.sem6__sum}}h.</th></tr>
<tr><td colspan="2"><table>
{% for s in sem5 %} {% for s in sem5 %}
<tr><td>{{s}}</td><td>{{s.sem5}} h.</td></tr> <tr><td>{{s}}</td><td>{{s.sem5}} h.</td></tr>
{% endfor %} {% endfor %}
<tr><th>Semestre 6</th><th text-align="right">{{tot6.sem6__sum}}h.</th></tr> </table></td>
<td colspan="2">
<table>
{% for s in sem6 %} {% for s in sem6 %}
<tr><td>{{s}}</td><td>{{s.sem6}} h.</td></tr> <tr><td>{{s}}</td><td>{{s.sem6}} h.</td></tr>
{% endfor %} {% endfor %}
</table> </table>
{{tot.tot__sum}} </td></tr>
</table>
<br/>
Total des périodes de cours: {{tot.periode_presentiel__sum}} heures
<br/><br/>
<a href="{% url 'periodes-pdf' %}">Imprimer en PDF</a>
</div> </div>
{% endblock %} {% endblock %}

View file

@ -13,7 +13,7 @@
<h1>{{object}}</h1> <h1>{{object}}</h1>
<table> <table>
<tr><th>Description</th><td>{{object.description}}</td></tr> <tr><th>Description</th><td>{{object.description}}</td></tr>
<tr><th>Compétences visées</th><td><p>L'éducateur social, l'éducatrice sociale</p> <tr><th>Compétences visées</th><td><p>L'éducateur social, l'éducatrice sociale:</p>
{% for m in object.module_set.all %}{% for c in m.competences.all %} {% for m in object.module_set.all %}{% for c in m.competences.all %}
- {{c.libelle}} ({{c.code}})<br />{% endfor %}{% endfor %}</td></tr> - {{c.libelle}} ({{c.code}})<br />{% endfor %}{% endfor %}</td></tr>
<tr><th>Domaine</th><td>{{object.domaine.url|safe}}</td></tr> <tr><th>Domaine</th><td>{{object.domaine.url|safe}}</td></tr>