Agenda
[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
18class Actualite(models.Model):
19 id = models.IntegerField(primary_key=True, db_column='id_actualite')
20 titre = models.CharField(max_length=765, db_column='titre_actualite')
21 texte = models.TextField(db_column='texte_actualite')
22 url = models.CharField(max_length=765, db_column='url_actualite')
23 logo = models.CharField(max_length=765, db_column='logo_actualite')
24 date = models.DateField(db_column='date_actualite')
25 visible = models.CharField(max_length=3, db_column='visible_actualite')
40a5ebfb 26 ancienid = models.IntegerField(db_column='ancienId_actualite')
6ef8ead4
CR
27
28 def __unicode__ (self):
29 return "Actualite %d: %s" % (self.id, self.titre)
30
d15017b2
CR
31 class Meta:
32 db_table = u'actualite'
33 ordering = ["-date",]
92c7413b
CR
34
35
36class ActiveManager(models.Manager):
37 def get_query_set(self):
38 return super(ActiveManager, self).get_query_set().filter(actif=True)
39
40class Evenement(models.Model):
41 actif = models.BooleanField(default = True)
42 uid = models.CharField(max_length = 255, default = uuid.uuid1)
43 approuve = models.BooleanField(default = False)
44 titre = models.CharField(max_length=255)
45 discipline = models.ForeignKey('Discipline', related_name = "discipline",
46 blank = True, null = True)
47 discipline_secondaire = models.ForeignKey('Discipline', related_name = \
48 "discipline_secondaire",
49 verbose_name = \
50 "Discipline secondaire",
51 blank = True, null = True)
52 mots_cles = models.TextField('Mots-Clés', blank = True, null = True)
53 type = models.CharField(max_length = 255, choices = \
54 (('Colloque', 'Colloque'),
55 ('Conférence', 'Conférence'),
56 ('Appel à contribution', 'Appel à contribution'),
57 ('Journée d\'étude', 'Journée d\'étude'),
58 (None, 'Autre')
59 )) #TODO: choices
60 fuseau = TimeZoneField(verbose_name = 'Fuseau horaire')
61 debut = models.DateTimeField(default = datetime.datetime.now)
62 fin = models.DateTimeField(default = datetime.datetime.now)
63 lieu = models.TextField()
64 description = models.TextField(blank = True, null = True)
65 #fichiers = TODO?
66 contact = models.TextField(blank = True, null = True)
67 url = models.CharField(max_length=255, blank = True, null = True)
68
69 objects = ActiveManager()
70