Premiere version : mise en route du suivi.
authorCyril Robert <Cyril Robert cyrilrbt@gmail.com>
Thu, 13 May 2010 13:10:53 +0000 (09:10 -0400)
committerCyril Robert <Cyril Robert cyrilrbt@gmail.com>
Thu, 13 May 2010 13:10:53 +0000 (09:10 -0400)
18 files changed:
.gitignore [new file with mode: 0644]
README.txt [new file with mode: 0644]
auf_contrats/__init__.py [new file with mode: 0644]
auf_contrats/contrats/__init__.py [new file with mode: 0644]
auf_contrats/contrats/admin.py [new file with mode: 0644]
auf_contrats/contrats/models.py [new file with mode: 0644]
auf_contrats/contrats/tests.py [new file with mode: 0644]
auf_contrats/contrats/views.py [new file with mode: 0644]
auf_contrats/development.py [new file with mode: 0644]
auf_contrats/media/contrats/marathon.pdf [new file with mode: 0755]
auf_contrats/media/contrats/output.pdf [new file with mode: 0755]
auf_contrats/media/contrats/output_.pdf [new file with mode: 0755]
auf_contrats/production.py [new file with mode: 0644]
auf_contrats/settings.py [new file with mode: 0644]
auf_contrats/urls.py [new file with mode: 0644]
bootstrap.py [new file with mode: 0644]
buildout.cfg [new file with mode: 0644]
devel.cfg [new file with mode: 0644]

diff --git a/.gitignore b/.gitignore
new file mode 100644 (file)
index 0000000..05e286b
--- /dev/null
@@ -0,0 +1,29 @@
+# binaires
+*.pyc
+*.pyo
+
+# Fichier temporaires:
+.*.swp
+*~
+\#*#
+
+# DB de dev
+*.db
+
+# restants de merge
+*.orig
+*.rej
+
+# Configuration du projet - par environnement
+conf.py
+django.wsgi
+
+# buildout
+.installed.cfg
+bin
+develop-eggs
+downloads
+eggs
+log
+parts
+tmp
diff --git a/README.txt b/README.txt
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/auf_contrats/__init__.py b/auf_contrats/__init__.py
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/auf_contrats/contrats/__init__.py b/auf_contrats/contrats/__init__.py
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/auf_contrats/contrats/admin.py b/auf_contrats/contrats/admin.py
new file mode 100644 (file)
index 0000000..9a141c2
--- /dev/null
@@ -0,0 +1,8 @@
+from django.contrib import admin
+from models import *
+
+admin.site.register(Contrat)
+admin.site.register(Etape)
+admin.site.register(NotificationCommentaire)
+admin.site.register(NotificationEtape)
+admin.site.register(Action)
diff --git a/auf_contrats/contrats/models.py b/auf_contrats/contrats/models.py
new file mode 100644 (file)
index 0000000..6c265d3
--- /dev/null
@@ -0,0 +1,51 @@
+# -*- encoding: utf-8 -*-
+from django.db import models
+from auf_references_client.models import Personne
+
+class Contrat(models.Model):
+    date = models.DateField(auto_now_add = True, verbose_name = "Création")
+    valide = models.BooleanField(default = False, verbose_name = "Validé")
+    refuse = models.BooleanField(default = False, verbose_name = "Refusé")
+    titre = models.CharField(max_length = 255)
+    document = models.FileField(upload_to = "contrats/")
+    nom = models.CharField(max_length = 64)
+    prenom = models.CharField(max_length = 64)
+
+    def __unicode__(self):
+        return "%s (%s)" % (self.titre, self.date)
+    
+    class Meta:
+        ordering = ['date', 'titre']
+
+class Etape(models.Model):
+    personne = models.ForeignKey(Personne)
+    suivant = models.ForeignKey('Etape', blank = True, null = True)
+
+    def __unicode__(self):
+        s = "%s %s" % (self.personne.prenom, self.personne.nom)
+        if self.suivant is not None:
+            s += " (avant %s %s)" % (self.suivant.personne.prenom, 
+                                     self.suivant.personne.nom)
+        return s
+
+class NotificationCommentaire(models.Model):
+    personne = models.ForeignKey(Personne)
+
+    def __unicode__(self):
+        return "Notif. commentaires pour %s" % self.personne.courriel
+
+class NotificationEtape(models.Model):
+    personne = models.ForeignKey(Personne)
+    etape = models.ForeignKey('Etape')
+    acceptation = models.BooleanField(default = False)
+    def __unicode__(self):
+        return "Notif. etape %s pour %s" % (self.etape.id, self.personne.courriel)
+
+class Action(models.Model):
+    date = models.DateTimeField(auto_now_add = True)
+    personne = models.ForeignKey(Personne)
+    contrat = models.ForeignKey('Contrat')
+    etape = models.ForeignKey('Etape')
+    valide = models.BooleanField(default = False, verbose_name = "Validé")
+    refuse = models.BooleanField(default = False, verbose_name = "Refusé")
+    commentaire = models.TextField(blank = True, null = True)
diff --git a/auf_contrats/contrats/tests.py b/auf_contrats/contrats/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_contrats/contrats/views.py b/auf_contrats/contrats/views.py
new file mode 100644 (file)
index 0000000..60f00ef
--- /dev/null
@@ -0,0 +1 @@
+# Create your views here.
diff --git a/auf_contrats/development.py b/auf_contrats/development.py
new file mode 100644 (file)
index 0000000..9ac7214
--- /dev/null
@@ -0,0 +1,4 @@
+
+from auf_contrats.settings import *
+DEBUG=True
+TEMPLATE_DEBUG=DEBUG
diff --git a/auf_contrats/media/contrats/marathon.pdf b/auf_contrats/media/contrats/marathon.pdf
new file mode 100755 (executable)
index 0000000..c5015b9
Binary files /dev/null and b/auf_contrats/media/contrats/marathon.pdf differ
diff --git a/auf_contrats/media/contrats/output.pdf b/auf_contrats/media/contrats/output.pdf
new file mode 100755 (executable)
index 0000000..b4f1c7e
Binary files /dev/null and b/auf_contrats/media/contrats/output.pdf differ
diff --git a/auf_contrats/media/contrats/output_.pdf b/auf_contrats/media/contrats/output_.pdf
new file mode 100755 (executable)
index 0000000..b4f1c7e
Binary files /dev/null and b/auf_contrats/media/contrats/output_.pdf differ
diff --git a/auf_contrats/production.py b/auf_contrats/production.py
new file mode 100644 (file)
index 0000000..0999f57
--- /dev/null
@@ -0,0 +1,2 @@
+
+from auf_contrats.settings import *
diff --git a/auf_contrats/settings.py b/auf_contrats/settings.py
new file mode 100644 (file)
index 0000000..f29837d
--- /dev/null
@@ -0,0 +1,73 @@
+
+import os
+
+ADMINS = (
+    # ('Your Name', 'your_email@domain.com'),
+)
+
+MANAGERS = ADMINS
+
+DATABASE_ENGINE = 'sqlite3'    # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
+DATABASE_NAME = 'auf_contrats.db'
+DATABASE_USER = ''             # Not used with sqlite3.
+DATABASE_PASSWORD = ''         # Not used with sqlite3.
+DATABASE_HOST = ''             # Set to empty string for localhost. Not used with sqlite3.
+DATABASE_PORT = ''             # Set to empty string for default. Not used with sqlite3.
+
+TIME_ZONE = 'America/Chicago'
+
+LANGUAGE_CODE = 'en-us'
+
+# Absolute path to the directory that holds media.
+# Example: "/home/media/media.lawrence.com/"
+MEDIA_ROOT = os.path.join(os.path.dirname(__file__), 'media')
+
+# URL that handles the media served from MEDIA_ROOT. Make sure to use a
+# trailing slash if there is a path component (optional in other cases).
+# Examples: "http://media.lawrence.com", "http://example.com/media/"
+MEDIA_URL = '/media/'
+
+# URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a
+# trailing slash.
+# Examples: "http://foo.com/media/", "/media/".
+ADMIN_MEDIA_PREFIX = '/admin_media/'
+
+# Don't share this with anybody.
+SECRET_KEY = 'ui09$l-@+1en^ehxav4h9@!v&_n&i8&rfada@&i2gldk7dsb2-'
+
+MIDDLEWARE_CLASSES = (
+    'django.middleware.common.CommonMiddleware',
+    'django.contrib.sessions.middleware.SessionMiddleware',
+    'django.contrib.auth.middleware.AuthenticationMiddleware',
+    'django.middleware.doc.XViewMiddleware',
+)
+
+ROOT_URLCONF = 'auf_contrats.urls'
+
+
+INSTALLED_APPS = (
+    'django.contrib.auth',
+    'django.contrib.contenttypes',
+    'django.contrib.sessions',
+    'django.contrib.admin',
+    'django_roa',
+    'contrats',
+)
+
+TEMPLATE_LOADERS = (
+    'django.template.loaders.filesystem.load_template_source',
+    'django.template.loaders.app_directories.load_template_source',
+)
+
+TEMPLATE_DIRS = (
+    os.path.join(os.path.dirname(__file__), "templates"),
+)
+
+# ROA
+AUTHENTICATION_BACKENDS = (
+    'auf_references_client.backends.CascadeBackend',
+)
+AUTH_PASSWORD_REQUIRED = True
+
+ROA_CUSTOM_ARGS = {'api-key': 'a2e5262c04b65b5bdb69848d00139d34'}
+from auf_references_client.settings import *
diff --git a/auf_contrats/urls.py b/auf_contrats/urls.py
new file mode 100644 (file)
index 0000000..9dd40d5
--- /dev/null
@@ -0,0 +1,19 @@
+
+from django.conf.urls.defaults import patterns, include, handler500
+from django.conf import settings
+from django.contrib import admin
+admin.autodiscover()
+
+handler500 # Pyflakes
+
+urlpatterns = patterns(
+    '',
+    (r'^admin/(.*)', admin.site.root),
+    (r'^accounts/login/$', 'django.contrib.auth.views.login'),
+)
+
+if settings.DEBUG:
+    urlpatterns += patterns('',
+        (r'^media/(?P<path>.*)$', 'django.views.static.serve',
+         {'document_root': settings.MEDIA_ROOT}),
+    )
diff --git a/bootstrap.py b/bootstrap.py
new file mode 100644 (file)
index 0000000..7728587
--- /dev/null
@@ -0,0 +1,77 @@
+##############################################################################
+#
+# Copyright (c) 2006 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""Bootstrap a buildout-based project
+
+Simply run this script in a directory containing a buildout.cfg.
+The script accepts buildout command-line options, so you can
+use the -c option to specify an alternate configuration file.
+
+$Id$
+"""
+
+import os, shutil, sys, tempfile, urllib2
+
+tmpeggs = tempfile.mkdtemp()
+
+is_jython = sys.platform.startswith('java')
+
+try:
+    import pkg_resources
+except ImportError:
+    ez = {}
+    exec urllib2.urlopen('http://peak.telecommunity.com/dist/ez_setup.py'
+                         ).read() in ez
+    ez['use_setuptools'](to_dir=tmpeggs, download_delay=0)
+
+    import pkg_resources
+
+if sys.platform == 'win32':
+    def quote(c):
+        if ' ' in c:
+            return '"%s"' % c # work around spawn lamosity on windows
+        else:
+            return c
+else:
+    def quote (c):
+        return c
+
+cmd = 'from setuptools.command.easy_install import main; main()'
+ws  = pkg_resources.working_set
+
+if is_jython:
+    import subprocess
+    
+    assert subprocess.Popen([sys.executable] + ['-c', quote(cmd), '-mqNxd', 
+           quote(tmpeggs), 'zc.buildout'], 
+           env=dict(os.environ,
+               PYTHONPATH=
+               ws.find(pkg_resources.Requirement.parse('setuptools')).location
+               ),
+           ).wait() == 0
+
+else:
+    assert os.spawnle(
+        os.P_WAIT, sys.executable, quote (sys.executable),
+        '-c', quote (cmd), '-mqNxd', quote (tmpeggs), 'zc.buildout',
+        dict(os.environ,
+            PYTHONPATH=
+            ws.find(pkg_resources.Requirement.parse('setuptools')).location
+            ),
+        ) == 0
+
+ws.add_entry(tmpeggs)
+ws.require('zc.buildout')
+import zc.buildout.buildout
+zc.buildout.buildout.main(sys.argv[1:] + ['bootstrap'])
+shutil.rmtree(tmpeggs)
diff --git a/buildout.cfg b/buildout.cfg
new file mode 100644 (file)
index 0000000..61663d3
--- /dev/null
@@ -0,0 +1,13 @@
+[buildout]
+parts = django
+find-links = http://pypi.auf.org/auf_references_client/
+    http://pypi.auf.org/auf_references_modeles/
+
+[django]
+recipe = djangorecipe
+version = 1.1.1
+project = auf_contrats
+wsgi=true
+settings=production
+extra-paths = auf_contrats
+eggs = auf_references_client
diff --git a/devel.cfg b/devel.cfg
new file mode 100644 (file)
index 0000000..2a1c4c8
--- /dev/null
+++ b/devel.cfg
@@ -0,0 +1,7 @@
+[buildout]
+extends=buildout.cfg
+
+[django]
+wsgi=false
+settings=development
+