]> git.parisson.com Git - mezzo.git/commitdiff
Job : add textField
authorEmilie <zawadzki@ircam.fr>
Wed, 28 Sep 2016 17:12:45 +0000 (19:12 +0200)
committerEmilie <zawadzki@ircam.fr>
Wed, 28 Sep 2016 17:12:45 +0000 (19:12 +0200)
app/local_settings.py
app/organization/job/forms.py
app/organization/job/migrations/0002_jobresponse_message.py [new file with mode: 0644]
app/organization/job/models.py
app/organization/job/views.py
app/templates/core/email/application_notification.html [deleted file]
app/templates/email/application_notification.html [new file with mode: 0644]

index ef1e640188b327f6f0473d2ade960db1e801ec58..f78738b4e51ea0525fb66cf82a5ca33c8bd3b148 100644 (file)
@@ -154,6 +154,7 @@ ARTICLE_PER_PAGE = 4 # just for tests because we haven't got enough content
 # a mode you'd pass directly to os.chmod.
 FILE_UPLOAD_PERMISSIONS = 0o664
 FILE_UPLOAD_TEMP_DIR = '/srv/media/uploads/tmp/'
+MAX_UPLOAD_SIZE = 512000000
 FILEBROWSER_MAX_UPLOAD_SIZE = 512000000
 
 if DEBUG:
index c37e8ba0711c3a6e0902775d722436e1a98e9499..fca4a411b8bf133b9fa7b966c5bd53fbca9b957c 100644 (file)
@@ -14,4 +14,4 @@ class JobResponseForm(ModelForm):
 
     class Meta:
         model = JobResponse
-        fields = ['first_name', 'last_name', 'email', 'curriculum_vitae', 'cover_letter', 'job_offer']
+        fields = ['first_name', 'last_name', 'email', 'message', 'curriculum_vitae', 'cover_letter', 'job_offer']
diff --git a/app/organization/job/migrations/0002_jobresponse_message.py b/app/organization/job/migrations/0002_jobresponse_message.py
new file mode 100644 (file)
index 0000000..8b910e2
--- /dev/null
@@ -0,0 +1,21 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.9.7 on 2016-09-28 16:58
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('organization-job', '0001_initial'),
+    ]
+
+    operations = [
+        migrations.AddField(
+            model_name='jobresponse',
+            name='message',
+            field=models.TextField(default='', max_length=800, verbose_name='message'),
+            preserve_default=False,
+        ),
+    ]
index 8f608fd513d2972cc3abca9c275116773e85f968..7dfaacaf9f454cdf988b0bb4ac101eef7a59ba19 100644 (file)
@@ -10,6 +10,7 @@ class JobResponse(models.Model):
     first_name = models.CharField(max_length=255, null=False, verbose_name=_('first name'))
     last_name = models.CharField(max_length=255, null=False, verbose_name=_('last name'))
     email = models.EmailField(max_length=255, null=False, verbose_name=_('email'))
+    message = models.TextField(max_length=800, verbose_name=_('message'))
     #@TODO validate type format
     curriculum_vitae = models.FileField(_("curriculum vitae"), max_length=1024, upload_to="job_responses/%Y/%m/%d/")
     cover_letter = models.FileField(_("cover letter"), max_length=1024, upload_to="job_responses/%Y/%m/%d/")
@@ -31,5 +32,3 @@ class JobOffer(Displayable, RichText):
     class Meta:
         verbose_name = _('job offer')
         verbose_name_plural = _("job offers")
-
-        
index 17aa0276a4fae995cfae13ff2a9036fcd2bb2ad4..afb46fe1ad9da46e81abbd03f78be9e3c3cd0255 100644 (file)
@@ -48,7 +48,6 @@ class JobOfferDetailView(CreateView):
         if ext_cv not in extention or ext_cl not in extention :
             messages.info(self.request, _("Only .pdf, .doc, .docx files allowed."))
             return super(JobOfferDetailView, self).form_invalid(form)
-
         email_application_notification(self.request, self.job_offer, form.cleaned_data)
         messages.info(self.request, _("You have successfully submitted your application."))
         return super(JobOfferDetailView, self).form_valid(form)
@@ -67,7 +66,6 @@ class JobOfferListView(ListView):
         context = super(JobOfferListView, self).get_context_data(**kwargs)
         return context
 
-
 def email_application_notification(request, job_offer, data):
     subject = "Candidature > " + job_offer.title
     to = [job_offer.email if job_offer.email else settings.DEFAULT_TO_EMAIL]
@@ -77,9 +75,10 @@ def email_application_notification(request, job_offer, data):
         'first_name': data['first_name'],
         'last_name': data['last_name'],
         'email': data['email'],
+        'message': data['message']
     }
 
-    message = get_template('core/email/application_notification.html').render(Context(ctx))
+    message = get_template('email/application_notification.html').render(Context(ctx))
     msg = EmailMessage(subject, message, to=to, from_email=from_email)
     msg.attach(data['curriculum_vitae'].name, data['curriculum_vitae'].read(), data['curriculum_vitae'].content_type)
     msg.attach(data['cover_letter'].name, data['cover_letter'].read(), data['cover_letter'].content_type)
diff --git a/app/templates/core/email/application_notification.html b/app/templates/core/email/application_notification.html
deleted file mode 100644 (file)
index 08df9bf..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-
-
-<!doctype html>
-
-<html lang="en">
-<head>
-  <meta charset="utf-8">
-</head>
-
-<body>
-  <p>Bonjour,</p>
-
-  <p>Une nouvelle candidature a été soumise :</p>
-  <p><strong>Nom : {{ last_name }}</strong></p>
-  <p><strong>Prénom : {{ first_name }}</strong></p>
-  <p><strong>Email :{{ email }}</strong></p>
-  <p>Le curriculum vitae ainsi que la lettre de motivation sont en pièces jointes.</p>
-  <p>Ces informations sont disponibles sur le backoffice de <a href="http://www.ircam.fr" title="site de l'ircam">http://www.ircam.fr</a> dans l'édition de l'offre d'emploi correspondante.</p>
-
-  <p>Bonne journée ! :)</p>
-</body>
-</html>
diff --git a/app/templates/email/application_notification.html b/app/templates/email/application_notification.html
new file mode 100644 (file)
index 0000000..b8c7177
--- /dev/null
@@ -0,0 +1,24 @@
+<!doctype html>
+
+<html lang="en">
+<head>
+  <meta charset="utf-8">
+</head>
+
+<body>
+  <p>Bonjour,</p>
+
+  <p>Une nouvelle candidature a été soumise :</p>
+  <p><strong>Nom : {{ last_name }}</strong></p>
+  <p><strong>Prénom : {{ first_name }}</strong></p>
+  <p><strong>Email :{{ email }}</strong></p>
+  <p><strong>Message :</strong></p>
+  <p>{{ message }}</p>
+  <br>
+  <br>
+  <p>Le curriculum vitae ainsi que la lettre de motivation sont en pièces jointes.</p>
+  <p>Ces informations sont disponibles sur le backoffice de <a href="http://www.ircam.fr" title="site de l'ircam">http://www.ircam.fr</a> dans l'édition de l'offre d'emploi correspondante.</p>
+
+  <p>Bonne journée ! :)</p>
+</body>
+</html>