for offre_dict in liste_offres:
offre = emploi.OffreEmploi()
- #offre.est_affiche = offre_dict['est_affiche']
- #offre.statut = offre_dict['statut']
+ offre.est_affiche = offre_dict['est_affiche']
+ offre.statut = offre_dict['statut']
offre.nom = offre_dict['nom']
offre.resume = offre_dict['resume']
offre.description = offre_dict['description']
obj_offres_emploi = []
offre = emploi.OffreEmploi()
- #obj_offre.est_affiche = offre_dict('est_affiche')
- #obj_offre.statut = offre_dict('statut')
+ offre.est_affiche = offre_dict['est_affiche']
+ offre.statut = offre_dict['statut']
offre.nom = offre_dict['nom']
offre.resume = offre_dict['resume']
offre.description = offre_dict['description']
-# -=- encoding: utf-8 -=-
+# -*- encoding: utf-8 -*
import datetime
from django.core.files.storage import FileSystemStorage
def __unicode__(self):
return '%s %s [%s]' % (self.prenom, self.nom, self.id)
+ def pieces_jointes(self):
+ return CandidatPiece.objects.filter(candidat=self)
+ pieces_jointes.allow_tags = True
+
class Meta:
db_table = 'emploi_candidat'
# Upload de fichiers
-#storage_prive = FileSystemStorage(settings.PRIVE_MEDIA_ROOT,
-# base_url=settings.PRIVE_MEDIA_URL)
+storage_prive = FileSystemStorage(settings.PRIVE_MEDIA_ROOT,
+ base_url=settings.PRIVE_MEDIA_URL)
def candidat_piece_dispatch(instance, filename):
- path = "offre_emploi/%s_%s/%s/%s_%s" % (instance.candidat.nom,
- instance.candidat.prenom, instance.nom, instance.candidat.id,
- filename)
+ path = u'%s/%s/%s_%s_%s/%s/%s' % ('emplois', instance.candidat.offre_emploi.id,
+ instance.candidat.nom, instance.candidat.prenom, instance.candidat.id,
+ instance.nom, filename)
return path
class CandidatPiece(models.Model):
candidat = models.ForeignKey(Candidat, db_column='candidat',
related_name='candidat_piece')
nom = models.CharField(max_length=3, choices=TYPE_PIECE_CHOICES)
- #path = PrivateFileField("file", upload_to=candidat_piece_dispatch)
- # path = models.FileField(verbose_name="Fichier",
- # upload_to=candidat_piece_dispatch, )
- #storage=storage_prive, )
+ path = models.FileField(verbose_name="Fichier",
+ upload_to=candidat_piece_dispatch, storage=storage_prive)
class Meta:
- db_table = 'emploi_evaluateur'
+ db_table = 'emploi_pieces'
verbose_name = "pièce jointe"
verbose_name_plural = "pièces jointes"
--- /dev/null
+# -*- encoding: utf-8 -*-
+
+import os
+from django.conf import settings
+
+# Absolute path to the directory that holds media.
+# Example: "/home/media/media.lawrence.com/"
+MEDIA_ROOT = getattr(settings, 'OE_MEDIA_ROOT',
+ os.path.join(os.path.dirname(__file__), 'media'))
+PRIVE_MEDIA_ROOT = getattr(settings, 'OE_PRIV_MEDIA_ROOT',
+ os.path.join(os.path.dirname(__file__), 'media_prive'))
+
+# 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/'
+PRIVE_MEDIA_URL = '/prive/'