diff --git a/ietf/liaisons/forms.py b/ietf/liaisons/forms.py index 949b4254a..022106910 100644 --- a/ietf/liaisons/forms.py +++ b/ietf/liaisons/forms.py @@ -1,6 +1,7 @@ import datetime from django import forms +from django.conf import settings from django.forms.util import ErrorList from django.template.loader import render_to_string @@ -179,6 +180,9 @@ class LiaisonForm(forms.ModelForm): detail = instance, file_extension = extension, ) + attach_file = open('%sfile%s%s' % (settings.LIAISON_ATTACH_PATH, attach.pk, attach.file_extension), 'w') + attach_file.write(attached_file.read()) + attach_file.close() class IncomingLiaisonForm(LiaisonForm): @@ -281,6 +285,7 @@ class EditLiaisonForm(LiaisonForm): def __init__(self, *args, **kwargs): super(EditLiaisonForm, self).__init__(*args, **kwargs) self.edit = True + self.initial.update({'attachments': self.instance.uploads_set.all()}) def set_from_field(self): self.fields['from_field'].initial = self.instance.from_body diff --git a/ietf/liaisons/widgets.py b/ietf/liaisons/widgets.py index 703daae8a..22340fd20 100644 --- a/ietf/liaisons/widgets.py +++ b/ietf/liaisons/widgets.py @@ -1,3 +1,5 @@ +from django.conf import settings +from django.db.models.query import QuerySet from django.forms.widgets import Select, Widget from django.utils.safestring import mark_safe @@ -54,9 +56,11 @@ class ShowAttachmentsWidget(Widget): def render(self, name, value, attrs=None): html = u'
' % name html += u'' - if not value: - html += u'
No files attached
' + html += u'
' + if value and isinstance(value, QuerySet): + for attach in value: + html += u'%s
' % (settings.LIAISON_ATTACH_URL, attach.file_id, attach.file_extension, attach.file_title, ) else: - pass - html += u'
' + html += u'No files attached' + html += u'
' return mark_safe(html) diff --git a/ietf/settings.py b/ietf/settings.py index b3d3e31c7..04c667751 100644 --- a/ietf/settings.py +++ b/ietf/settings.py @@ -31,8 +31,6 @@ SERVER_EMAIL = 'Django Server ' DEFAULT_FROM_EMAIL = 'IETF Secretariat ' -LIAISON_UNIVERSAL_FROM = 'Liaison Statement Management Tool ' - MANAGERS = ADMINS DATABASE_ENGINE = 'mysql' @@ -176,6 +174,11 @@ else: IPR_EMAIL_TO = ['ietf-ipr@ietf.org', ] +# Liaison Statement Tool settings +LIAISON_UNIVERSAL_FROM = 'Liaison Statement Management Tool ' +LIAISON_ATTACH_PATH = '/a/www/ietf-datatracker/documents/LIAISON/' +LIAISON_ATTACH_URL = '/documents/LIAISON/' + # Put SECRET_KEY in here, or any other sensitive or site-specific # changes. DO NOT commit settings_local.py to svn. from settings_local import * diff --git a/ietf/templates/liaisons/liaisondetail_edit.html b/ietf/templates/liaisons/liaisondetail_edit.html index bb39d9b85..12351e6e8 100644 --- a/ietf/templates/liaisons/liaisondetail_edit.html +++ b/ietf/templates/liaisons/liaisondetail_edit.html @@ -13,7 +13,7 @@ {% if not liaison %}
  • If you wish to submit your liaison statement by e-mail, then please send it to statements@ietf.org
  • -
  • Fields marked with * are required. For detailed descriptions of the fields see Field help
  • +
  • Fields marked with * are required. For detailed descriptions of the fields see Field help
{% endif %} diff --git a/ietf/templates/liaisons/liaisonform.html b/ietf/templates/liaisons/liaisonform.html index ef769523d..154ebc842 100644 --- a/ietf/templates/liaisons/liaisonform.html +++ b/ietf/templates/liaisons/liaisonform.html @@ -8,7 +8,7 @@ {% endblock %} -
+
{% if form.errors %}
Please correct the errors below. diff --git a/static/css/liaisons.css b/static/css/liaisons.css index fb29ef56d..3bcb1b842 100644 --- a/static/css/liaisons.css +++ b/static/css/liaisons.css @@ -52,6 +52,13 @@ } #id_title, +.baseformedit #id_from_field, +.baseformedit #id_replyto, +.baseformedit #id_organization, +.baseformedit #id_to_poc, +.baseformedit #id_response_contact, +.baseformedit #id_technical_contact, +.baseformedit #id_cc1, .baseform textarea { width: 80%; } diff --git a/static/js/liaisons.js b/static/js/liaisons.js index eff969b6e..5fc236413 100644 --- a/static/js/liaisons.js +++ b/static/js/liaisons.js @@ -21,6 +21,7 @@ config.showOn = $('#' + fieldset.find('.showAttachsOn').html()); config.showOnDisplay = config.showOn.find('.attachedFiles'); + count = config.showOnDisplay.find('.initialAttach').length; config.showOnEmpty = config.showOn.find('.showAttachmentsEmpty').html(); config.enabledLabel = fieldset.find('.attachEnabledLabel').html(); };