Mise en place de l'app `usager`
authorWilly MANGA <willy.manga@auf.org>
Wed, 13 Apr 2011 09:11:13 +0000 (10:11 +0100)
committerWilly MANGA <willy.manga@auf.org>
Wed, 13 Apr 2011 09:11:13 +0000 (10:11 +0100)
 * python manage.py startapp usager
 * modif des settings en conséquence
  * inclusion de 'usager' dans INSTALLED_APPS

auf-cnf-usager/info/settings.py
auf-cnf-usager/info/usager/__init__.py [new file with mode: 0644]
auf-cnf-usager/info/usager/models.py [new file with mode: 0644]
auf-cnf-usager/info/usager/tests.py [new file with mode: 0644]
auf-cnf-usager/info/usager/views.py [new file with mode: 0644]

index b44b656..9fc313e 100644 (file)
@@ -76,4 +76,5 @@ INSTALLED_APPS = (
     'django.contrib.contenttypes',
     'django.contrib.sessions',
 #    'django.contrib.sites',
+    'info.usager',
 )
diff --git a/auf-cnf-usager/info/usager/__init__.py b/auf-cnf-usager/info/usager/__init__.py
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/auf-cnf-usager/info/usager/models.py b/auf-cnf-usager/info/usager/models.py
new file mode 100644 (file)
index 0000000..cd35b34
--- /dev/null
@@ -0,0 +1,77 @@
+# -*- coding:utf-8 -*-
+
+from django.db import models
+
+
+class Usager(models.Model):
+        """Toute nouvelle personne qui passe au CNF"""
+
+        nom = models.CharField("Nom de l'usager",
+                        max_length=200,primary_key=True)
+        tel = models.CharField(max_length=12)
+        email = models.EmailField(max_length=75)
+
+        def __unicode__(self):
+                return self.nom
+
+class Abonne(Usager):
+        """Celui qui s'inscrit à au moins un service du CNF"""
+
+        date_inscription = models.DateTimeField()
+        matricule = models.CharField(max_length=200,unique=True,default="CNFN-")
+
+class Universitaire(Abonne):
+        NIVEAU = (
+                        ('1','Niveau Licence'),
+                        ('2','Niveau Master'),
+                        ('3','Niveau Doctorat'),
+
+        )
+
+        ANNEE_UNIVERSITAIRE = (
+                        ('1','1'),
+                        ('2','2'),
+                        ('3','3'),
+                        ('4','4'),
+                        ('5','5'),
+                        ('6','6'),
+                        ('7','7'),
+                        ('8','8'),
+                        ('8+','plus de 8 an'),
+        )
+
+        specialite = models.CharField(max_length=200)
+        cycle = models.CharField(max_length=1, choices=NIVEAU)
+        annee_univ = models.CharField(max_length=1, choices=ANNEE_UNIVERSITAIRE)
+        nom_memoire = models.CharField(max_length=200)
+        encadreur = models.CharField(max_length=200)
+
+class Professionnel(Abonne):
+        entreprise = models.CharField(max_length=200)
+
+class Services(models.Model):
+        """ Services du CNF offerts aux usagers"""
+
+        FREQUENCE = (
+                        ('Mensuel','Mensuel'),
+                        ('Trimestriel','Trimestriel'),
+                        ('Semestriel','Semestriel'),
+                        ('Annuel','Annuel'),
+                        )
+
+        nom = models.CharField(max_length=200)
+        periodicite = models.CharField(max_length=1,choices=FREQUENCE)
+        valeur = models.CharField("Coût du service",max_length=200,default="Fcfa")
+        description = models.CharField(max_length=200)
+
+        def __unicode__(self):
+                return self.nom
+
+class Souscription(models.Model):
+        nom_abonne = models.ForeignKey('Abonne')
+        code_service = models.ForeignKey('Services')
+        date_souscription = models.DateTimeField()
+
+#TODO : je cherche à définir ce qu'il faut exactement retourner :(
+#        def __unicode__(self):
+#                return ????
diff --git a/auf-cnf-usager/info/usager/tests.py b/auf-cnf-usager/info/usager/tests.py
new file mode 100644 (file)
index 0000000..2247054
--- /dev/null
@@ -0,0 +1,23 @@
+"""
+This file demonstrates two different styles of tests (one doctest and one
+unittest). These will both pass when you run "manage.py test".
+
+Replace these with more appropriate tests for your application.
+"""
+
+from django.test import TestCase
+
+class SimpleTest(TestCase):
+    def test_basic_addition(self):
+        """
+        Tests that 1 + 1 always equals 2.
+        """
+        self.failUnlessEqual(1 + 1, 2)
+
+__test__ = {"doctest": """
+Another way to test that 1 + 1 is equal to 2.
+
+>>> 1 + 1 == 2
+True
+"""}
+
diff --git a/auf-cnf-usager/info/usager/views.py b/auf-cnf-usager/info/usager/views.py
new file mode 100644 (file)
index 0000000..60f00ef
--- /dev/null
@@ -0,0 +1 @@
+# Create your views here.