]> git.parisson.com Git - mezzo.git/commitdiff
Upgrade Project form, makes (almost) every fields required, add organization and...
authorGuillaume Pellerin <guillaume.pellerin@ircam.fr>
Wed, 22 Mar 2017 23:27:48 +0000 (00:27 +0100)
committerGuillaume Pellerin <guillaume.pellerin@ircam.fr>
Wed, 22 Mar 2017 23:27:48 +0000 (00:27 +0100)
app/local_settings.py
app/organization/network/migrations/0093_auto_20170322_1846.py [new file with mode: 0644]
app/organization/network/models.py
app/organization/projects/forms.py
app/organization/projects/models.py
app/organization/projects/views.py
app/themes/vertigo_starts_eu/templates/projects/inc/project_validation.html [new file with mode: 0644]
app/themes/vertigo_starts_eu/templates/projects/project_ict_create.html
app/themes/vertigo_starts_eu/templates/projects/project_ict_create_notification.html [new file with mode: 0644]
app/themes/vertigo_starts_eu/templates/projects/project_ict_validation.html

index 592145adfcce72eabbc50c696a15f343ac8101ef..8ee6dc75350920776379c13eeeefc0698463f4af 100644 (file)
@@ -73,9 +73,9 @@ FILEBROWSER_SELECT_FORMATS = {
 
 EMAIL_HOST = 'smtp.ircam.fr'
 EMAIL_PORT = '25'
-DEFAULT_FROM_EMAIL = 'www@ircam.fr'
-DEFAULT_TO_EMAIL = 'drh@ircam.fr'
-EMAIL_SUBJECT_PREFIX = "[IRCAM WWW]"
+DEFAULT_FROM_EMAIL = 'vertigo@iuk.fraunhofer.de'
+DEFAULT_TO_EMAIL = 'vertigo@iuk.fraunhofer.de'
+EMAIL_SUBJECT_PREFIX = '[Vertigo]'
 
 SITE_TITLE = 'IRCAM'
 SITE_TAGLINE = 'Institut de Recherche et de Coordination Acoustique et Musique'
diff --git a/app/organization/network/migrations/0093_auto_20170322_1846.py b/app/organization/network/migrations/0093_auto_20170322_1846.py
new file mode 100644 (file)
index 0000000..aa19a75
--- /dev/null
@@ -0,0 +1,25 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.9.11 on 2017-03-22 17:46
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('organization-network', '0092_auto_20170314_1918'),
+    ]
+
+    operations = [
+        migrations.AddField(
+            model_name='person',
+            name='organization_name',
+            field=models.CharField(blank=True, max_length=128, null=True, verbose_name='organization_name'),
+        ),
+        migrations.AddField(
+            model_name='person',
+            name='position',
+            field=models.CharField(blank=True, max_length=128, null=True, verbose_name='position'),
+        ),
+    ]
index 94f5a57513ce64c345a2c0f20e4d9c6e40603c56..aaf27aa91279548d71001656361894243b3d6edb 100644 (file)
@@ -215,6 +215,8 @@ class Person(Displayable, AdminThumbMixin, Address):
     bio = RichTextField(_('biography'), blank=True)
     role = models.CharField(_('role'), max_length=256, blank=True, null=True)
     external_id = models.CharField(_('external ID'), blank=True, null=True, max_length=128)
+    organization_name = models.CharField(_('organization name'), blank=True, null=True, max_length=128)
+    position = models.CharField(_('position'), blank=True, null=True, max_length=128)
 
     class Meta:
         verbose_name = _('person')
index 5ab93ff01b295212529925572989ac84addb3d99..ee93d0e13551261e2dbf0e92e835243e2e865a8a 100644 (file)
@@ -59,6 +59,7 @@ class ProjectForm(ModelForm):
         super(ProjectForm, self).__init__(*args, **kwargs)
         self.fields['title'].label = "Project name"
         self.fields['keywords'].help_text = "5 comma separated keywords"
+        self.fields['keywords'].required = True
 
     class Meta:
         model = Project
@@ -94,14 +95,40 @@ class ProjectUserImageInline(InlineFormSet):
     fields = ['file', 'credits']
 
 
+class ProjectLinkInline(InlineFormSet):
+
+    extra = 3
+    model = ProjectLink
+    prefix = 'Public link'
+    text = "To be published only for ICT-Projects selected by the consortium"
+    can_delete = False
+    fields = ['url', 'type']
+
+
+
+class ProjectContactForm(ModelForm):
+
+    def __init__(self, *args, **kwargs):
+        super(ProjectContactForm, self).__init__(*args, **kwargs)
+        self.fields['organization_name'].help_text = "The organization related to the contact"
+        self.fields['position'].help_text = "The position of the contact in the organization"
+        for field in self._meta.fields:
+            self.fields[field].required = True
+
+    class Meta:
+        model = ProjectContact
+        fields = ('first_name', 'last_name', 'email', 'organization_name',
+                    'position', 'address', 'telephone', 'address', 'postal_code',
+                    'city', 'country')
+
+
 class ProjectContactInline(InlineFormSet):
 
     max_num = 1
     model = ProjectContact
+    form_class = ProjectContactForm
     prefix = 'Private project contact'
     can_delete = False
-    fields = ['first_name', 'last_name', 'address', 'email',
-                 'telephone', 'address', 'postal_code', 'city', 'country']
 
 
 class OrganizationContactInline(InlineFormSet):
index 75116285534a32442a1d093c0831561ce4444a8a..7257e0ea75ac4d1254dc26711d1c40ed2bb42d1d 100644 (file)
@@ -342,7 +342,7 @@ class ProjectPublicData(models.Model):
     resources_description = models.TextField(_('resource description'), help_text="Resources available to the artist -- e.g. office facility, studio facility, technical equipment, internet connection, laboratory, and periods of availability for artistic production, staff possibly allocated to the project, available budget for travel, consumables and equipment, etc... (50 – 100 words).")
     period = models.CharField(_('period of implementation'), max_length=128, help_text="Possible period of implementation (must be part of the project implementation workplan)")
     image = models.FileField(_("Image"), max_length=1024, upload_to="user/images/%Y/%m/%d/", help_text="Representing the project")
-    image_credits = models.CharField(_('Image credits'), max_length=256, blank=True, null=True)
+    image_credits = models.CharField(_('Image credits'), max_length=256)
 
     class Meta:
         verbose_name = 'Project public data'
index 7130564f2c54c8be0a2afbd8bcc8230e0dfc7d84..4f3da05f8cc603031758526eb62c34d1d9960644 100644 (file)
@@ -21,6 +21,9 @@
 
 from django.shortcuts import render
 from django.views.generic.detail import SingleObjectMixin
+from django.template.loader import render_to_string, get_template
+from django.core.mail import EmailMessage
+from django.template import Context
 from dal import autocomplete
 from dal_select2_queryset_sequence.views import Select2QuerySetSequenceView
 from mezzanine_agenda.models import Event
@@ -141,24 +144,45 @@ class ProjectICTSubmissionView(ProjectCallMixin, TemplateView):
 
     model = Project
     template_name='projects/project_ict_submission.html'
-
-
+    
 
 class ProjectICTCreateView(ProjectCallMixin, CreateWithInlinesView):
 
     model = Project
     form_class = ProjectForm
     template_name='projects/project_ict_create.html'
-    inlines = [ProjectPublicDataInline, ProjectPrivateDataInline, ProjectUserImageInline, ProjectContactInline,]
+    inlines = [ProjectPublicDataInline, ProjectPrivateDataInline, ProjectUserImageInline,
+                ProjectContactInline]
     topic = 'ICT'
 
-
     def forms_valid(self, form, inlines):
         self.object = form.save()
         self.call = ProjectCall.objects.get(slug=self.kwargs['slug'])
         self.object.call = self.call
         self.object.topic, c = ProjectTopic.objects.get_or_create(name='ICT')
         self.object.save()
+
+        for formset in inlines:
+            print(formset.prefix)
+            if 'contact' in formset.prefix:
+                for f in formset:
+                    contact_data = f.cleaned_data
+                    contact_email = contact_data.get("email")
+
+        from_email = settings.DEFAULT_FROM_EMAIL
+        to_email = [contact_email, settings.DEFAULT_TO_EMAIL]
+        subject = settings.EMAIL_SUBJECT_PREFIX + ' ' + self.call.title
+        ctx = {
+            'first_name': contact_data['first_name'],
+            'last_name': contact_data['last_name'],
+            'project_title': self.object.title,
+        }
+
+        message = get_template('projects/project_ict_create_notification.html').render(Context(ctx))
+        msg = EmailMessage(subject, message, to=to_email, from_email=from_email)
+        msg.content_subtype = 'html'
+        msg.send()
+
         return super(ProjectICTCreateView, self).forms_valid(form, inlines)
 
     def get_success_url(self):
diff --git a/app/themes/vertigo_starts_eu/templates/projects/inc/project_validation.html b/app/themes/vertigo_starts_eu/templates/projects/inc/project_validation.html
new file mode 100644 (file)
index 0000000..947af05
--- /dev/null
@@ -0,0 +1,7 @@
+<p>Thank you for applying for the Vertigo Call for Projects and your interest in hosting an artist.</p>
+<p>With the submission of data and documents about your project, you declare, that you are allowed to establish a cooperation with an artist funded by the Vertigo project.</p>
+<p>We will keep you informed about the further project selection process.</p>
+
+{# You submitted the following data:#}
+
+<p>If you wish to change the information or would like to add further information, please send an email containing the new information to <a href="mailto:vertigo@iuk.fraunhofer.de">vertigo@iuk.fraunhofer.de</a>.</p>
index 8fc4a57b8187394a27cee25aa9dc518b14efc2b4..ad66d183391e94e0bfb82e2ef7c990b0151aec2d 100644 (file)
@@ -21,7 +21,7 @@
     {% editable object.title %}
         <h1 class="dotted">{% trans "Project submission form" %}</h1>
     {% endeditable %}
-        <h3>All fields are required</h3>
+        <h3>All fields are mandatory / required</h3>
 {% endblock %}
 
 {% block page_content %}
                 {% elif "Public data" in formset.prefix %}
                     <h5>To be published only for ICT-Projects selected by the consortium</h5>
                 {% elif "Private images" in formset.prefix %}
-                    <h5>3 key images for inspiring artist + any video content available</h5>
+                    <h5>3 key images for inspiring artist</h5>
                 {% endif %}
                 {% for form in formset %}
                    {% fields_for form %}
                 {% endfor %}
             {% endfor %}
           <div class="form-actions">
+              <h3>All fields are mandatory / required</h3>
+              <p>With the submission of data and documents about your project, you declare, that you are allowed to establish a cooperation with an artist funded by the Vertigo project.</p>
+              <br>
               <input class="btn btn-primary btn-lg" type="submit"
                   value="{% if page.form.button_text %}{{ page.form.button_text }}{% else %}{% trans "Submit" %}{% endif %}">
           </div>
diff --git a/app/themes/vertigo_starts_eu/templates/projects/project_ict_create_notification.html b/app/themes/vertigo_starts_eu/templates/projects/project_ict_create_notification.html
new file mode 100644 (file)
index 0000000..cb1d6c4
--- /dev/null
@@ -0,0 +1,11 @@
+<!doctype html>
+<html lang="en">
+<head>
+  <meta charset="utf-8">
+</head>
+
+<body>
+    <p>Dear {{ first_name }} {{ last_name }},</p>
+    {% include 'projects/inc/project_validation.html' %}
+</body>
+</html>
index 434ee296377391e80dc0c19412a9bc5a2ed920d5..7bd8630480f45c55141a1a2f24064a8ba4b25516 100644 (file)
@@ -25,9 +25,8 @@
 
 {% block page_content %}
     <div class="row">
-        <p>Thank you for having submitted your project. It will evaluated in the next few days by the evaluation board and you will then receive an email notification for the result.</p>
-        <p>For the first call of 2017, you cannot update your project data on your own, so please <a href="mailto:vertigo@iuk.fraunhofer.de">send an email</a> to the board if you need any modification.</p>
-        <p>See you soon!</p>
+        <p>Dear Submitter,</p>
+        {% include 'projects/inc/project_validation.html' %}
     </div>
 {% endblock %}