deplacement module

This commit is contained in:
alazo 2017-02-20 20:23:52 +01:00
parent 4c2549e8a4
commit c92c0425ec
3 changed files with 18 additions and 34 deletions

View file

@ -50,29 +50,13 @@ class Enseignant(models.Model):
return '{0} ({1})'.format(self.__str__(), 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__())
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)
height_screen = 50
class Meta:
ordering = ('code',)
@ -83,10 +67,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__())

View file

@ -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
@ -109,11 +109,11 @@ USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.10/howto/static-files/
STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'static/')
STATIC_URL = '/cms/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',

View file

@ -47,7 +47,6 @@
<td></td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td class="l2 m">{{M07.url_code|safe}}</td><td class="l2 m">{{M09.url_code|safe}}</td>
</tr>
<tr>
<td></td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td class="l2 m">{{M08.url_code|safe}}</td><td>&nbsp;</td>
</tr>
@ -79,9 +78,9 @@
<tr>
<td class="l6 d">{{D6.url|safe}}</td>
<td class="l6 p">{{P09.url|safe}}</td>
<td colspan="2" class="l6 m">{{M16_1.url_code|safe}}</td>
<td colspan="2" class="l6 m">{{M16_2.url_code|safe}}</td>
<td colspan="2" class="l6 m">{{M16_3.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}} / {{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}} / {{M16_3e.url_code|safe}}</td>
</tr>
<!-- Ligne 7 -->
<tr>
@ -102,9 +101,6 @@
<br/>
<a href="{% url 'plan-pdf' %}">Imprimer en PDF</a>
</div>
<svg xmlns="http://www.w3.org/2000/svg">
{{D1.svg|safe}}
</svg>
{% endblock %}