beta2
This commit is contained in:
parent
545c0c494f
commit
67dc9bcb00
16 changed files with 290 additions and 72 deletions
33
cms/admin.py
33
cms/admin.py
|
|
@ -1,8 +1,7 @@
|
|||
from django.contrib import admin
|
||||
from .models import (Enseignant, Domaine, Competence, SousCompetence, Objectif,
|
||||
Ressource, Module, Processus)
|
||||
from django.forms.widgets import Widget
|
||||
from django.forms import widgets
|
||||
from .forms import ProcessusAdminForm, ModuleAdminForm, DomaineAdminForm
|
||||
# Register your models here.
|
||||
|
||||
class SousCompetenceInline(admin.TabularInline):
|
||||
|
|
@ -14,27 +13,41 @@ class CompetenceInline(admin.TabularInline):
|
|||
extra=0
|
||||
#template ='templates/admin/cms/processus/edit_inline/tabular.html'
|
||||
|
||||
class RessourceAdmin(admin.ModelAdmin):
|
||||
list_display = ('nom', 'module')
|
||||
|
||||
|
||||
class ModuleAdmin(admin.ModelAdmin):
|
||||
form = ModuleAdminForm
|
||||
inlines = [CompetenceInline,]
|
||||
extra = 0
|
||||
|
||||
|
||||
class ProcessusAdmin(admin.ModelAdmin):
|
||||
inlines = (CompetenceInline,)
|
||||
form = ProcessusAdminForm
|
||||
|
||||
class ProcessusAdminInline(admin.TabularInline):
|
||||
model = Processus
|
||||
extra=0
|
||||
|
||||
|
||||
class CompetenceAdmin(admin.ModelAdmin):
|
||||
list_display = ('code', 'nom', 'module')
|
||||
list_editable = ('module',)
|
||||
inlines = (SousCompetenceInline,)
|
||||
|
||||
|
||||
class RessourceAdmin(admin.ModelAdmin):
|
||||
pass
|
||||
|
||||
|
||||
class DomaineAdmin(admin.ModelAdmin):
|
||||
list_display = ('nom', 'responsable',)
|
||||
form = DomaineAdminForm
|
||||
inlines = [ProcessusAdminInline,]
|
||||
|
||||
|
||||
admin.site.register(Enseignant)
|
||||
admin.site.register(Domaine)
|
||||
admin.site.register(Domaine, DomaineAdmin)
|
||||
admin.site.register(Competence, CompetenceAdmin)
|
||||
admin.site.register(SousCompetence)
|
||||
admin.site.register(Objectif)
|
||||
admin.site.register(Ressource)
|
||||
admin.site.register(Module)
|
||||
admin.site.register(Ressource, RessourceAdmin)
|
||||
admin.site.register(Module, ModuleAdmin)
|
||||
admin.site.register(Processus, ProcessusAdmin)
|
||||
|
|
|
|||
54
cms/forms.py
54
cms/forms.py
|
|
@ -4,9 +4,57 @@ Created on 17 nov. 2012
|
|||
|
||||
@author: alzo
|
||||
'''
|
||||
|
||||
from .models import Processus, Module, Domaine
|
||||
from django import forms
|
||||
|
||||
from django.contrib import admin
|
||||
from _collections_abc import __all__
|
||||
#from django.forms import Textarea, TextInput
|
||||
|
||||
|
||||
class DocumentForm(forms.Form):
|
||||
docfile = forms.FileField(label='Selectionner un fichier',
|
||||
help_text='Taille max.: 42 megabytes')
|
||||
docfile = forms.FileField(label='Selectionner un fichier', help_text='Taille max.: 42 megabytes')
|
||||
|
||||
class ProcessusAdminForm(forms.ModelForm):
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(ProcessusAdminForm, self).__init__(*args, **kwargs)
|
||||
#self.fields['nom'].widget.attrs['size']='50'
|
||||
|
||||
class Meta:
|
||||
model = Processus
|
||||
fields = ('code', 'nom', 'domaine', 'description')
|
||||
widgets = {
|
||||
'nom': forms.Textarea(attrs={'cols': 75, 'rows':2}),
|
||||
}
|
||||
|
||||
class DomaineAdminForm(forms.ModelForm):
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(DomaineAdminForm, self).__init__(*args, **kwargs)
|
||||
|
||||
class Meta:
|
||||
model = Domaine
|
||||
fields = ('code', 'nom', 'responsable')
|
||||
widgets = {
|
||||
'nom': forms.Textarea(attrs={'cols': 75, 'rows':2}),
|
||||
}
|
||||
|
||||
class ModuleAdminForm(forms.ModelForm):
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(ModuleAdminForm, self).__init__(*args, **kwargs)
|
||||
#self.fields['nom'].widget.attrs['size']='50'
|
||||
|
||||
class Meta:
|
||||
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}),
|
||||
}
|
||||
|
||||
64
cms/migrations/0014_auto_20170127_1444.py
Normal file
64
cms/migrations/0014_auto_20170127_1444.py
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.10.4 on 2017-01-27 14:44
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('cms', '0013_auto_20170108_2119'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RenameField(
|
||||
model_name='competence',
|
||||
old_name='libelle',
|
||||
new_name='nom',
|
||||
),
|
||||
migrations.RenameField(
|
||||
model_name='domaine',
|
||||
old_name='libelle',
|
||||
new_name='nom',
|
||||
),
|
||||
migrations.RenameField(
|
||||
model_name='processus',
|
||||
old_name='libelle',
|
||||
new_name='nom',
|
||||
),
|
||||
migrations.RenameField(
|
||||
model_name='ressource',
|
||||
old_name='libelle',
|
||||
new_name='nom',
|
||||
),
|
||||
migrations.RenameField(
|
||||
model_name='souscompetence',
|
||||
old_name='libelle',
|
||||
new_name='nom',
|
||||
),
|
||||
migrations.RemoveField(
|
||||
model_name='competence',
|
||||
name='processus',
|
||||
),
|
||||
migrations.RemoveField(
|
||||
model_name='module',
|
||||
name='competences',
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='competence',
|
||||
name='module',
|
||||
field=models.ForeignKey(default=None, null=True, on_delete=django.db.models.deletion.CASCADE, to='cms.Module'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='module',
|
||||
name='didactique',
|
||||
field=models.TextField(),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='module',
|
||||
name='evaluation',
|
||||
field=models.TextField(),
|
||||
),
|
||||
]
|
||||
20
cms/migrations/0015_auto_20170129_0700.py
Normal file
20
cms/migrations/0015_auto_20170129_0700.py
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.10.4 on 2017-01-29 07:00
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('cms', '0014_auto_20170127_1444'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RenameField(
|
||||
model_name='objectif',
|
||||
old_name='libelle',
|
||||
new_name='nom',
|
||||
),
|
||||
]
|
||||
19
cms/migrations/0016_remove_module_description.py
Normal file
19
cms/migrations/0016_remove_module_description.py
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.10.4 on 2017-01-29 19:24
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('cms', '0015_auto_20170129_0700'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RemoveField(
|
||||
model_name='module',
|
||||
name='description',
|
||||
),
|
||||
]
|
||||
|
|
@ -52,14 +52,14 @@ class Enseignant(models.Model):
|
|||
|
||||
class Domaine(models.Model):
|
||||
code = models.CharField(max_length=20, blank=True)
|
||||
libelle = models.CharField(max_length=200, blank=False)
|
||||
nom = models.CharField(max_length=200, blank=False)
|
||||
responsable = models.ForeignKey(Enseignant, null=True, default=None)
|
||||
|
||||
class Meta:
|
||||
ordering = ('code',)
|
||||
|
||||
def __str__(self):
|
||||
return '{0} - {1}'.format(self.code, self.libelle)
|
||||
return '{0} - {1}'.format(self.code, self.nom)
|
||||
|
||||
def url(self):
|
||||
return "<a href='/domaine/{0}'>{1}</a>".format(self.id, self.__str__())
|
||||
|
|
@ -67,7 +67,7 @@ class Domaine(models.Model):
|
|||
|
||||
class Processus(models.Model):
|
||||
code = models.CharField(max_length=20, blank=True)
|
||||
libelle = models.CharField(max_length=200, blank=False)
|
||||
nom = models.CharField(max_length=200, blank=False)
|
||||
domaine = models.ForeignKey(Domaine, null=False)
|
||||
description = models.TextField(default='')
|
||||
|
||||
|
|
@ -77,7 +77,7 @@ class Processus(models.Model):
|
|||
verbose_name_plural = 'processus'
|
||||
|
||||
def __str__(self):
|
||||
return '{0} - {1}'.format(self.code, self.libelle)
|
||||
return '{0} - {1}'.format(self.code, self.nom)
|
||||
|
||||
def url(self):
|
||||
return "<a href='/processus/{0}'>{1}</a>".format(self.id, self.__str__())
|
||||
|
|
@ -87,17 +87,15 @@ class Module(models.Model):
|
|||
|
||||
code = models.CharField(max_length=10, blank=False, default='Code')
|
||||
nom = models.CharField(max_length=100, blank=False, default='Nom du module')
|
||||
description = models.TextField()
|
||||
type = models.CharField(max_length=20, choices= CHOIX_TYPE_MODULE)
|
||||
competences = models.ManyToManyField('Competence')
|
||||
situation = models.TextField()
|
||||
evaluation = models.TextField()
|
||||
contenu = models.TextField()
|
||||
periode_presentiel = models.IntegerField()
|
||||
travail_perso = models.IntegerField()
|
||||
pratique_prof = models.IntegerField(default=0)
|
||||
didactique = models.TextField(default='')
|
||||
evaluation = models.TextField(default='')
|
||||
didactique = models.TextField()
|
||||
evaluation = models.TextField()
|
||||
sem1 = models.IntegerField(default=0)
|
||||
sem2 = models.IntegerField(default=0)
|
||||
sem3 = models.IntegerField(default=0)
|
||||
|
|
@ -124,22 +122,22 @@ class Module(models.Model):
|
|||
|
||||
class Competence(models.Model):
|
||||
code = models.CharField(max_length=20, blank=True)
|
||||
libelle = models.CharField(max_length=250, blank=False)
|
||||
nom = models.CharField(max_length=250, blank=False)
|
||||
type = models.CharField(max_length=35, blank=True, default='')
|
||||
processus = models.ForeignKey(Processus, null=True, default=None)
|
||||
module = models.ForeignKey(Module, null=True, default=None)
|
||||
|
||||
class Meta:
|
||||
ordering = ('code',)
|
||||
verbose_name = 'compétence'
|
||||
|
||||
def __str__(self):
|
||||
return '{0} - {1}'.format(self.code, self.libelle)
|
||||
return '{0} - {1}'.format(self.code, self.nom)
|
||||
|
||||
|
||||
|
||||
class SousCompetence(models.Model):
|
||||
code = models.CharField(max_length=20, blank=True)
|
||||
libelle = models.CharField(max_length=250, blank=False)
|
||||
nom = models.CharField(max_length=250, blank=False)
|
||||
competence = models.ForeignKey(Competence, null=False)
|
||||
|
||||
class Meta:
|
||||
|
|
@ -147,23 +145,23 @@ class SousCompetence(models.Model):
|
|||
verbose_name = 'sous-compétence'
|
||||
|
||||
def __str__(self):
|
||||
return '{0} - {1}'.format(self.code, self.libelle)
|
||||
return '{0} - {1}'.format(self.code, self.nom)
|
||||
|
||||
|
||||
class Ressource(models.Model):
|
||||
libelle = models.CharField(max_length=200, blank=False)
|
||||
nom = models.CharField(max_length=200, blank=False)
|
||||
type = models.CharField(max_length=30, choices = CHOIX_TYPE_SAVOIR, default='Savoir')
|
||||
module=models.ForeignKey(Module, null=True, default=None)
|
||||
|
||||
def __str__(self):
|
||||
return '{0}'.format(self.libelle)
|
||||
return '{0}'.format(self.nom)
|
||||
|
||||
class Objectif(models.Model):
|
||||
libelle = models.CharField(max_length=200, blank=False)
|
||||
nom = models.CharField(max_length=200, blank=False)
|
||||
module=models.ForeignKey(Module, null=True, default=None)
|
||||
|
||||
def __str__(self):
|
||||
return '{0}'.format(self.libelle)
|
||||
return '{0}'.format(self.nom)
|
||||
|
||||
|
||||
class Document(models.Model):
|
||||
|
|
@ -173,19 +171,23 @@ class Document(models.Model):
|
|||
|
||||
class PDFResponse(HttpResponse):
|
||||
|
||||
def __init__(self, filename, title=''):
|
||||
def __init__(self, filename, title='', portrait=True):
|
||||
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 = Image(settings.MEDIA_ROOT + '/media/header.png', width=499, height=99)
|
||||
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])
|
||||
if portrait:
|
||||
t = Table(data, colWidths=[8*cm,8*cm])
|
||||
else:
|
||||
t = Table(data, colWidths=[11*cm,11*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),
|
||||
|
|
@ -194,21 +196,24 @@ class PDFResponse(HttpResponse):
|
|||
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
|
||||
self.PAGE_WIDTH = A4[0]
|
||||
self.PAGE_HEIGHT = A4[1]
|
||||
self.CENTRE_WIDTH = self.PAGE_WIDTH/2.0
|
||||
self.CENTRE_HEIGHT = self.PAGE_HEIGHT/2.0
|
||||
|
||||
|
||||
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.drawCentredString(self.CENTRE_WIDTH,1*cm,"Page : " + str(self.canv.getPageNumber()))
|
||||
self.canv.restoreState()
|
||||
|
||||
|
||||
|
|
@ -218,12 +223,16 @@ class MyDocTemplateLandscape(SimpleDocTemplate):
|
|||
def __init__(self, name):
|
||||
SimpleDocTemplate.__init__(self, name, pagesize=landscape(A4), topMargin=0.5*cm)
|
||||
self.fileName = name
|
||||
self.PAGE_WIDTH = A4[1]
|
||||
self.PAGE_HEIGHT = A4[0]
|
||||
self.CENTRE_WIDTH = self.PAGE_WIDTH/2.0
|
||||
self.CENTRE_HEIGHT = self.PAGE_HEIGHT/2.0
|
||||
|
||||
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.drawCentredString(self.CENTRE_WIDTH,1*cm,"Page : " + str(self.canv.getPageNumber()))
|
||||
self.canv.restoreState()
|
||||
|
||||
|
||||
|
|
|
|||
81
cms/views.py
81
cms/views.py
|
|
@ -48,7 +48,7 @@ class HomwPDFView(TemplateView):
|
|||
|
||||
def render_to_response(self, context, **response_kwargs):
|
||||
|
||||
response = PDFResponse('PlanFormation.pdf' ,'Plan de formation')
|
||||
response = PDFResponse('PlanFormation.pdf' ,'Plan de formation', portrait=False)
|
||||
d = Domaine.objects.all().order_by('code')
|
||||
p = Processus.objects.all().order_by('code')
|
||||
|
||||
|
|
@ -181,19 +181,19 @@ class ModulePDF(DetailView):
|
|||
|
||||
|
||||
str_comp = ''
|
||||
for c in m.competences.all():
|
||||
str_comp += '- {0} ({1})\n'.format(c.libelle, c.code)
|
||||
for c in m.competence_set.all():
|
||||
str_comp += '- {0} ({1})\n'.format(c.nom, c.code)
|
||||
if self.request.user.is_authenticated:
|
||||
for sc in c.souscompetence_set.all():
|
||||
str_comp += ' -- {0}\n'.format(sc.libelle)
|
||||
str_comp += ' -- {0}\n'.format(sc.nom)
|
||||
|
||||
str_res = ''
|
||||
for c in m.ressource_set.all():
|
||||
str_res += '- {0}\n'.format(c.libelle)
|
||||
str_res += '- {0}\n'.format(c.nom)
|
||||
|
||||
str_obj = ''
|
||||
for c in m.objectif_set.all():
|
||||
str_obj += '- {0}\n'.format(c.libelle)
|
||||
str_obj += '- {0}\n'.format(c.nom)
|
||||
|
||||
lines = m.contenu.split('\n')
|
||||
str_con = ''
|
||||
|
|
@ -211,8 +211,8 @@ class ModulePDF(DetailView):
|
|||
[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('Type'), Preformatted_right('{0}, obligatoire'.format(m.type))],
|
||||
[Preformatted_left('Semestre'), Preformatted_right('Sem. {0}'.format(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())],
|
||||
|
|
@ -237,7 +237,8 @@ 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['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)
|
||||
|
|
@ -249,7 +250,10 @@ def get_context(context):
|
|||
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')))
|
||||
context['tot6'] = liste.aggregate(Sum(F('sem6')))
|
||||
context['tot'] = context['tot1']['sem1__sum'] + context['tot2']['sem2__sum'] + context['tot3']['sem3__sum'] + \
|
||||
context['tot4']['sem4__sum'] + context['tot5']['sem5__sum'] + context['tot6']['sem6__sum']
|
||||
|
||||
return context
|
||||
|
||||
|
||||
|
|
@ -269,30 +273,30 @@ class PeriodePDFView(TemplateView):
|
|||
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'])],
|
||||
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),'', '','' ],
|
||||
[context['sem1'][5], '{0} h.'.format(context['sem1'][5].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) ],
|
||||
[context['sem3'][5], '{0} h.'.format(context['sem3'][5].sem3),'', '' ],
|
||||
|
||||
['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),'', '','' ],
|
||||
[context['sem5'][4], '{0} h.'.format(context['sem5'][4].sem5),'', '', '' ],
|
||||
[context['sem5'][5], '{0} h.'.format(context['sem5'][5].sem5),'', '', '' ],
|
||||
]
|
||||
|
||||
t = Table(data, colWidths=[6.5*cm,1*cm, 1*cm, 6.5*cm, 1*cm], spaceBefore=2*cm, spaceAfter=1.5*cm)
|
||||
|
|
@ -305,18 +309,21 @@ class PeriodePDFView(TemplateView):
|
|||
('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),
|
||||
('TOPPADDING', (0,7), (-1,7), 15),
|
||||
('LINEBELOW', (0,7), (1,7), 1, colors.black),
|
||||
('LINEBELOW', (3,7), (-1,7), 1, colors.black),
|
||||
('TOPPADDING', (0,14), (-1,14), 15),
|
||||
('LINEBELOW', (0,14), (1,14), 1, colors.black),
|
||||
('LINEBELOW', (3,14), (-1,14), 1, colors.black),
|
||||
('FONT', (0, 0), (-1, 0), 'Helvetica-Bold'),
|
||||
('FONT', (0, 7), (-1, 7), 'Helvetica-Bold'),
|
||||
('FONT', (0, 14), (-1, 14), 'Helvetica-Bold'),
|
||||
]))
|
||||
|
||||
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))
|
||||
response.story.append(Paragraph('Total des heures de cours: {0} h.'.format(context['tot']), style_normal))
|
||||
doc = MyDocTemplate(response)
|
||||
doc.build(response.story)
|
||||
|
||||
|
|
@ -349,5 +356,25 @@ def pdf_view(request):
|
|||
response = HttpResponse(pdf.read().decode('latin-1') , content_type='application/pdf')
|
||||
response['Content-Disposition'] = 'inline;filename=some_file.pdf'
|
||||
return response
|
||||
pdf.closed
|
||||
|
||||
pdf.closed
|
||||
|
||||
|
||||
def import_xls_file(request):
|
||||
import xlrd
|
||||
|
||||
if request.method == 'POST':
|
||||
xlspath = '/home/alzo/Export_CLOEE_FE.xls'
|
||||
with xlrd.open_workbook(xlspath) as book:
|
||||
sheet = book.sheet_by_index(0)
|
||||
print(sheet.ncols)
|
||||
print(sheet.nrows)
|
||||
|
||||
|
||||
if request.method == 'GET':
|
||||
xlspath = '/home/alzo/Export_CLOEE_FE.xls'
|
||||
with xlrd.open_workbook(xlspath) as book:
|
||||
sheet = book.sheet_by_index(0)
|
||||
for rownum in range(1,sheet.nrows):
|
||||
print(int(sheet.row_values(rownum)[0]))
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue