Correction HL
[auf_savoirs_en_partage_django.git] / auf_savoirs_en_partage_django / savoirs / models.py
CommitLineData
92c7413b 1# -*- encoding: utf-8 -*-
d15017b2 2from django.db import models
92c7413b
CR
3import uuid, datetime
4from timezones.fields import TimeZoneField
d15017b2
CR
5
6
7class Discipline(models.Model):
8 id = models.IntegerField(primary_key=True, db_column='id_discipline')
9 nom = models.CharField(max_length=765, db_column='nom_discipline')
6ef8ead4
CR
10
11 def __unicode__ (self):
92c7413b 12 return self.nom
6ef8ead4 13
d15017b2
CR
14 class Meta:
15 db_table = u'discipline'
16 ordering = ["nom",]
17
79c398f6
CR
18class SourceActualite(models.Model):
19 nom = models.CharField(max_length=255)
20 url = models.CharField(max_length=255)
21
d15017b2
CR
22class Actualite(models.Model):
23 id = models.IntegerField(primary_key=True, db_column='id_actualite')
24 titre = models.CharField(max_length=765, db_column='titre_actualite')
25 texte = models.TextField(db_column='texte_actualite')
26 url = models.CharField(max_length=765, db_column='url_actualite')
27 logo = models.CharField(max_length=765, db_column='logo_actualite')
28 date = models.DateField(db_column='date_actualite')
29 visible = models.CharField(max_length=3, db_column='visible_actualite')
40a5ebfb 30 ancienid = models.IntegerField(db_column='ancienId_actualite')
6ef8ead4
CR
31
32 def __unicode__ (self):
33 return "Actualite %d: %s" % (self.id, self.titre)
34
d15017b2
CR
35 class Meta:
36 db_table = u'actualite'
37 ordering = ["-date",]
92c7413b
CR
38
39
40class ActiveManager(models.Manager):
41 def get_query_set(self):
42 return super(ActiveManager, self).get_query_set().filter(actif=True)
43
44class Evenement(models.Model):
45 actif = models.BooleanField(default = True)
46 uid = models.CharField(max_length = 255, default = uuid.uuid1)
47 approuve = models.BooleanField(default = False)
48 titre = models.CharField(max_length=255)
49 discipline = models.ForeignKey('Discipline', related_name = "discipline",
50 blank = True, null = True)
51 discipline_secondaire = models.ForeignKey('Discipline', related_name = \
52 "discipline_secondaire",
53 verbose_name = \
54 "Discipline secondaire",
55 blank = True, null = True)
56 mots_cles = models.TextField('Mots-Clés', blank = True, null = True)
57 type = models.CharField(max_length = 255, choices = \
58 (('Colloque', 'Colloque'),
59 ('Conférence', 'Conférence'),
60 ('Appel à contribution', 'Appel à contribution'),
61 ('Journée d\'étude', 'Journée d\'étude'),
62 (None, 'Autre')
63 )) #TODO: choices
64 fuseau = TimeZoneField(verbose_name = 'Fuseau horaire')
65 debut = models.DateTimeField(default = datetime.datetime.now)
66 fin = models.DateTimeField(default = datetime.datetime.now)
67 lieu = models.TextField()
68 description = models.TextField(blank = True, null = True)
69 #fichiers = TODO?
70 contact = models.TextField(blank = True, null = True)
71 url = models.CharField(max_length=255, blank = True, null = True)
72
73 objects = ActiveManager()
74