parts = django
versions = versions
-find-links = http://pypi.auf.org/simple/auf.recipe.django
- http://pypi.auf.org/simple/auf.django.skin
+find-links = http://pypi.auf.org/simple/auf.recipe.django/
+ http://pypi.auf.org/simple/auf.django.skin/
http://pypi.auf.org/datamaster_modeles/
- http://pypi.auf.org/simple/auf.django.auth
+ http://pypi.auf.org/simple/auf.django.auth/
+ http://pypi.auf.org/simple/auf.django.workflow/
eggs =
django
south
django-admin-tools
auf.django.skin
+ auf.django.workflow
datamaster_modeles
auf.django.auth
django-reversion
+ simplejson
[versions]
django-admin-tools = 0.4.0
auf.django.skin = 0.15dev
auf.django.auth = 0.5.2dev
django-reversion = 1.3.3
+auf.django.workflow = 0.6dev
[django]
recipe = auf.recipe.django
# Managers
objects = PosteManager()
+ def _get_key(self):
+ """
+ Les vues sont montées selon une clef spéciale pour identifier la provenance du poste.
+ Cette méthode fournit un moyen de reconstruire cette clef afin de générer les URLs.
+ """
+ return "dae-%s" % self.id
+ key = property(_get_key)
+
def get_dossiers(self):
"""
Liste tous les anciens dossiers liés à ce poste.
<td>{{ remun.type }}</td>
<td>
{{ remun.devise }}
- <input name="montant_mois-{{ remun.id }}"
+ <input type="hidden" id="taux_devise-{{ remun.id }}"
+ name="taux_devise-{{ remun.id }}"
+ value="{{ remun.taux_devise }}" />
+ <input type="text" id="montant_mois-{{ remun.id }}"
+ name="montant_mois-{{ remun.id }}"
value="{{ remun.montant_mois }}" /></td>
- <td><input name="cg-montant-{{ remun.id }}"
+ <td><input type="text" id="montant-{{ remun.id }}"
+ name="cg-montant-{{ remun.id }}"
value="{{ remun.montant|default_if_none:'' }}" /></td>
- <td>{{ remun.montant_euro_mois }}</td>
- <td>{{ remun.montant_euro }}</td>
- <td><input name="cg-precision-{{ remun.id }}"
+ <td id="montant_euro_mois-{{ remun.id }}">
+ {{ remun.montant_euro_mois }}</td>
+ <td id="montant_euro-{{ remun.id }}">{{ remun.montant_euro }}</td>
+ <td><input type="text" name="cg-precision-{{ remun.id }}"
value="{{ remun.precision|default_if_none:'' }}" /></td>
</tr>
{% empty %}
</fieldset>
+ <script type="text/javascript">
+ function round2(n) {
+ return Math.round(n * 100) / 100;
+ }
+
+ $('#global-cost input[id^="montant"]').live('keyup', function() {
+ var value = $(this).val(),
+ idParts = $(this).attr('id').split('-'),
+ name = idParts[0],
+ id = idParts[1];
+ if (name == 'montant') {
+ $('#montant_mois-' + id).val(round2(value / 12));
+ } else {
+ value = value * 12;
+ $('#montant-' + id).val(round2(value));
+ }
+ var taux = $('#taux_devise-' + id).val();
+ $('#montant_euro_mois-' + id).text(round2(value / taux / 12));
+ $('#montant_euro-' + id).text(round2(value / taux));
+ });
+ </script>
+
<h2 class="section">SECTION 4 - JUSTIFICATION DE LA DEMANDE (OBLIGATOIRE)</h2>
<input type="submit" name="save" value="Sauvegarder" />
<th>Valid. Recteur</th>
<th>Décision finale</th>
</tr>
-{% for poste in postes %}
+{% for poste, premiere_revision in postes %}
<tr>
- <td><a href="">{{ poste }}</a></td>
- <td>{{ poste.date_creation|date:"Y-m-d" }}</td>
- <td>{{ poste.user_creation }}</td>
+ <td><a href="{% url poste poste.key %}">{{ poste }}</a></td>
+ <td>{{ premiere_revision.date_created|date:"Y-m-d" }}</td>
+ <td>{{ premiere_revision.user }}</td>
<td></td>
<td></td>
<td></td>
# -*- encoding: utf-8 -*-
from collections import defaultdict
from datetime import date
-from json import dumps
+from simplejson import dumps
import warnings
from django.http import Http404, HttpResponse
from django.shortcuts import redirect, render_to_response, get_object_or_404
from django.template import RequestContext
+from reversion.models import Version
+
from project.dae.forms import (ChoosePosteForm, DossierForm, EmployeForm,
PosteForm, PosteFinancementForm, PostePieceForm,
DossierPieceForm)
from project.decorators import admin_required
-
def index(request):
return render_to_response('dae/index.html', {}, RequestContext(request))
def postes_liste(request):
""" Liste des postes. """
vars = dict()
- vars['postes'] = dae.Poste.objects.all().order_by('-date_creation')
+ vars['postes'] = []
+ for p in dae.Poste.objects.all().order_by('-date_creation'):
+ premiere_revision = Version.objects.get_for_object(p)[0].revision
+ vars['postes'].append((p, premiere_revision))
return render_to_response('dae/postes_liste.html', vars,
RequestContext(request))
if 'save' in request.POST:
if employe_form.is_valid():
data = dict(request.POST.items())
- with warnings.catch_warnings():
- warnings.simplefilter('ignore')
- employe = employe_form.save()
+ #with warnings.catch_warnings():
+ # warnings.simplefilter('ignore')
+ employe = employe_form.save()
data['employe'] = 'dae-%s' % employe.id
employe_form = EmployeForm(data, instance=employe)