deplacement module
This commit is contained in:
parent
4c2549e8a4
commit
c92c0425ec
3 changed files with 18 additions and 34 deletions
|
|
@ -47,25 +47,7 @@ class Enseignant(models.Model):
|
|||
return '{0} {1}'.format(self.nom, self.prenom)
|
||||
|
||||
def descr(self):
|
||||
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__())
|
||||
|
||||
return '{0} ({1})'.format(self.__str__(), self.email)
|
||||
|
||||
|
||||
class Domaine(models.Model):
|
||||
|
|
@ -73,6 +55,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 +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__())
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue