diff --git a/cms/models.py b/cms/models.py
index 2f37f3e..58d6861 100644
--- a/cms/models.py
+++ b/cms/models.py
@@ -48,13 +48,31 @@ class Enseignant(models.Model):
def descr(self):
return '{0} ({1})'.format(self.__str__(), self.email)
+
+
+class SVG_Domaine:
+ compteur = 0
+ x = 30
+ y = 10
+ width = 200
+ svg = ''
+ txt = '{1}'
+
+ 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__())
+
+
-
class Domaine(models.Model):
code = models.CharField(max_length=20, blank=True)
nom = models.CharField(max_length=200, blank=False)
responsable = models.ForeignKey(Enseignant, null=True, default=None)
-
+
class Meta:
ordering = ('code',)
@@ -64,6 +82,14 @@ class Domaine(models.Model):
def url(self):
return "{1}".format(self.id, self.__str__())
+ def svg(self):
+ svg = ''
+ txt = '{1}'
+
+ return svg.format(20, 100, settings.DOMAINE_COULEURS[self.code]) + txt.format(50, self.__str__())
+
+
+
class Processus(models.Model):
code = models.CharField(max_length=20, blank=True)
@@ -177,8 +203,7 @@ class PDFResponse(HttpResponse):
self['Content-Type'] = 'charset=utf-8'
self.story = []
image = Image(settings.MEDIA_ROOT + '/media/header.png', width=480, height=80)
- image.hAlign = 0
-
+ image.hAlign = TA_LEFT
self.story.append(image)
#self.story.append(Spacer(0,1*cm))
@@ -193,7 +218,7 @@ class PDFResponse(HttpResponse):
('LINEABOVE', (0,0) ,(-1,-1), 0.5, colors.black),
('LINEBELOW', (0,-1),(-1,-1), 0.5, colors.black),
]))
- t.hAlign = 0
+ t.hAlign = TA_LEFT
self.story.append(t)
@@ -201,7 +226,7 @@ class PDFResponse(HttpResponse):
class MyDocTemplate(SimpleDocTemplate):
def __init__(self, name):
- SimpleDocTemplate.__init__(self, name, pagesize=A4, topMargin=0.5*cm)
+ SimpleDocTemplate.__init__(self, name, pagesize=A4, topMargin=0*cm)
self.fileName = name
self.PAGE_WIDTH = A4[0]
self.PAGE_HEIGHT = A4[1]
@@ -221,7 +246,7 @@ class MyDocTemplate(SimpleDocTemplate):
class MyDocTemplateLandscape(SimpleDocTemplate):
def __init__(self, name):
- SimpleDocTemplate.__init__(self, name, pagesize=landscape(A4), topMargin=0.5*cm)
+ SimpleDocTemplate.__init__(self, name, pagesize=landscape(A4), topMargin=0*cm, leftMargin=2*cm)
self.fileName = name
self.PAGE_WIDTH = A4[1]
self.PAGE_HEIGHT = A4[0]
diff --git a/cms/views.py b/cms/views.py
index cc41137..a7da03e 100644
--- a/cms/views.py
+++ b/cms/views.py
@@ -56,7 +56,7 @@ class HomwPDFView(TemplateView):
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' ,'' , '' , '' , '' ],
+ ['' , 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' ],
@@ -79,13 +79,12 @@ class HomwPDFView(TemplateView):
#('BOX',(0,0),(-1,-1), 0.25, colors.black),
('GRID',(0,0),(-1,-1), 0.25, colors.black),
- ('SPAN',(0,1), (0,4)),
+ ('SPAN',(0,1), (0,4)), #Domaine 1
('SPAN',(1,1), (1,2)),
('SPAN',(1,3), (1,4)),
- ('SPAN',(0,5), (0,7)),
+ ('SPAN',(0,5), (0,7)), #Domaine 2
('SPAN',(1,6), (1,7)),
- ('SPAN',(0,8), (0,9)),
- ('SPAN',(0,8), (0,9)),
+ ('SPAN',(0,8), (0,9)), #Domaine 3
('SPAN',(5,8), (6,8)),
('SPAN',(5,9), (6,9)),
('SPAN',(2,11), (-1,11)),
@@ -98,7 +97,8 @@ class HomwPDFView(TemplateView):
('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',(5,3), (5,3), colors.orange),
+ ('BACKGROUND',(3,4), (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),
@@ -278,7 +278,7 @@ class PeriodePDFView(TemplateView):
[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'][4], '{0} h.'.format(context['sem1'][4].sem1),'', '', ''],
[context['sem1'][5], '{0} h.'.format(context['sem1'][5].sem1),'', '', ''],
@@ -288,7 +288,7 @@ class PeriodePDFView(TemplateView):
[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['sem3'][5], '{0} h.'.format(context['sem3'][5].sem3),'', context['sem4'][5], '{0} h.'.format(context['sem4'][5].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) ],
diff --git a/common/settings.py b/common/settings.py
index 35ea039..254c6de 100644
--- a/common/settings.py
+++ b/common/settings.py
@@ -129,6 +129,8 @@ STUDENT_IMPORT_MAPPING = {
}
+DOMAINE_COULEURS = {'D1':'#fcaf3e', 'D2': '#cc0000', 'D3': '#ef896b', 'D4': '#ad7fa8', 'D5': '#729fcf', 'D6':'#73d216', 'D7':'#ffffff', 'D8':'#babdb6' }
+
from .local_settings import *
diff --git a/templates/cms/index.html b/templates/cms/index.html
index a3a5932..5fd9712 100644
--- a/templates/cms/index.html
+++ b/templates/cms/index.html
@@ -30,7 +30,7 @@
| {{P02.url|safe}} |
- | {{M03.url_code|safe}} | | | | |
+ | | | {{M03.url_code|safe}} | | |
@@ -87,7 +87,9 @@
| {{D7.url|safe}} |
{{P10.url|safe}} |
- {{M17_1.url_code|safe}} | {{M17_2.url_code|safe}} | {{M17_3.url_code|safe}} |
+ {{M17_1.url_code|safe}} |
+ {{M17_2.url_code|safe}} |
+ {{M17_3.url_code|safe}} |
@@ -100,6 +102,9 @@
Imprimer en PDF
+
{% endblock %}
diff --git a/templates/cms/periodes.html b/templates/cms/periodes.html
index 862683f..8384405 100644
--- a/templates/cms/periodes.html
+++ b/templates/cms/periodes.html
@@ -10,43 +10,45 @@
Périodes de formation
| Semestre 1 | {{tot1.sem1__sum}}h. | | Semestre 2 | {{tot2.sem2__sum}}h. |
-
+
{% for s in sem1 %}
-| {{s}} | {{s.sem1}} h. |
+| {{s}} | {{s.sem1}} h. |
{% endfor %}
|
|
-
+
{% for s in sem2 %}
-| {{s}} | {{s.sem2}} h. |
+| {{s}} | {{s.sem2}} h. |
{% endfor %}
+| | |
| Semestre 3 | {{tot3.sem3__sum}}h. | | Semestre 4 | {{tot4.sem4__sum}}h. |
-
+
{% for s in sem3 %}
-| {{s}} | {{s.sem3}} h. |
+| {{s}} | {{s.sem3}} h. |
{% endfor %}
|
|
-
+
{% for s in sem4 %}
-| {{s}} | {{s.sem4}} h. |
+| {{s}} | {{s.sem4}} h. |
{% endfor %}
|
+| | |
| Semestre 5 | {{tot5.sem5__sum}}h. | | Semestre 6 | {{tot6.sem6__sum}}h. |
-
+
{% for s in sem5 %}
-| {{s}} | {{s.sem5}} h. |
+| {{s}} | {{s.sem5}} h. |
{% endfor %}
|
|
-
+
{% for s in sem6 %}
-| {{s}} | {{s.sem6}} h. |
+| {{s}} | {{s.sem6}} h. |
{% endfor %}
| | | | | |