diff --git a/.gitignore b/.gitignore index 5485507a52adc3c6ccb46f76e14087e42860cb86..4d43f387e85330c273f8f85b730634253f3f74e7 100644 --- a/.gitignore +++ b/.gitignore @@ -15,7 +15,7 @@ __pycache__ .python-version - +/uploads* /media* SCIPOST_JOURNALS diff --git a/README.md b/README.md index 99340c790242facd727f41e6c44105b89844cd8a..fc63276cd5eea6b4756d47419c148c7f7f4a47ad 100644 --- a/README.md +++ b/README.md @@ -44,6 +44,7 @@ In this project, host-specific settings are defined in the `scipost-host-setting "CERTFILE": "none", "DEBUG": true, "ADMINS": "", + "MANAGERS": "", "ALLOWED_HOSTS": ["localhost", "127.0.0.1"], "SESSION_COOKIE_SECURE": false, "CSRF_COOKIE_SECURE": false, diff --git a/SciPost_v1/settings.py b/SciPost_v1/settings.py index 3989f5c1e1d3508141df74283c6046ff7ad46e3a..e4845d32cb516f74121ee8912819b656093d23ca 100644 --- a/SciPost_v1/settings.py +++ b/SciPost_v1/settings.py @@ -35,6 +35,7 @@ DEBUG = host_settings["DEBUG"] # Emails for server error reporting ADMINS = host_settings["ADMINS"] +MANAGERS = host_settings["MANAGERS"] ALLOWED_HOSTS = host_settings["ALLOWED_HOSTS"] diff --git a/SciPost_v1/urls.py b/SciPost_v1/urls.py index e1c8742b3efdde36aeb2adb9bf7a037939ef5cea..8bb1cbd455cf3f734dcc129e7f8c02ba31d6cf1f 100644 --- a/SciPost_v1/urls.py +++ b/SciPost_v1/urls.py @@ -15,7 +15,6 @@ Including another URLconf """ from django.conf import settings from django.conf.urls import include, url -from django.conf.urls.static import static from django.contrib import admin urlpatterns = [ @@ -33,7 +32,5 @@ urlpatterns = [ url(r'^theses/', include('theses.urls', namespace="theses")), url(r'^thesis/', include('theses.urls', namespace="theses")), url(r'^captcha/', include('captcha.urls')), -] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) +] - -# urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) diff --git a/comments/models.py b/comments/models.py index 38a1a0f25f3e4e62ef803807e5940faae1991ddb..e449d2a7382c0b0054082c1772ac5f46cf689b64 100644 --- a/comments/models.py +++ b/comments/models.py @@ -40,7 +40,7 @@ class Comment(TimeStampedModel): vetted_by = models.ForeignKey(Contributor, blank=True, null=True, on_delete=models.CASCADE, related_name='comment_vetted_by') - file_attachment = models.FileField(upload_to='comments/%Y/%m/%d/', blank=True, + file_attachment = models.FileField(upload_to='uploads/comments/%Y/%m/%d/', blank=True, validators=[validate_file_extension, validate_max_file_size]) # a Comment is either for a Commentary or Submission or a ThesisLink. diff --git a/submissions/models.py b/submissions/models.py index 40fe1c4c11cca8b4898a399e1ce57663687ec05a..8ca56af4a8d1d553d10b49041712a5eee45a5a53 100644 --- a/submissions/models.py +++ b/submissions/models.py @@ -689,14 +689,14 @@ class Report(models.Model): context = Context({'strengths': self.strengths, 'weaknesses': self.weaknesses, 'report': self.report, 'requested_changes': self.requested_changes}) output = ('<div class="row"><div class="col-12"><h3 class="highlight tight">' - 'Strengths</h3><div class="pl-md-4">{{ strengths }}</div></div></div>' + 'Strengths</h3><div class="pl-md-4">{{ strengths|linebreaks }}</div></div></div>' '<div class="row"><div class="col-12"><h3 class="highlight tight">' - 'Weaknesses</h3><div class="pl-md-4">{{ weaknesses }}</div></div></div>' + 'Weaknesses</h3><div class="pl-md-4">{{ weaknesses|linebreaks }}</div></div></div>' '<div class="row"><div class="col-12"><h3 class="highlight tight">' - 'Report</h3><div class="pl-md-4">{{ report }}</div></div></div>' + 'Report</h3><div class="pl-md-4">{{ report|linebreaks }}</div></div></div>' '<div class="row"><div class="col-12"><h3 class="highlight tight">' 'Requested changes</h3><div class="pl-md-4">' - '<p>{{ requested_changes }}</p>' + '<p>{{ requested_changes|linebreaks }}</p>' '<div class="reportRatings"><ul>' '<li>validity: ' + ranking_choices_dict[self.validity] + '</li>' '<li>significance: ' + ranking_choices_dict[self.significance] + '</li>' diff --git a/submissions/templates/submissions/submission_detail.html b/submissions/templates/submissions/submission_detail.html index 9a55f03955cb0cc037025847f93ac4a9fb780420..68750602f0e9eddaf708bac9af84bef5b2d2d317 100644 --- a/submissions/templates/submissions/submission_detail.html +++ b/submissions/templates/submissions/submission_detail.html @@ -6,6 +6,8 @@ {% load scipost_extras %} {% load submissions_extras %} +{% load filename %} +{% load file_extentions %} <script> $(document).ready(function(){ @@ -198,6 +200,18 @@ </div> <div class="col-12"> <p>{{ reply.comment_text|linebreaks }}</p> + {% if reply.file_attachment %} + <h3>Attachment:</h3> + <p> + <a target="_blank" href="{{ reply.file_attachment.url }}"> + {% if reply.file_attachment|is_image %} + <img class="attachment attachment-comment" src="{{ reply.file_attachment.url }}"> + {% else %} + {{ reply.file_attachment|filename }}<br><small>{{ reply.file_attachment.size|filesizeformat }}</small> + {% endif %} + </a> + </p> + {% endif %} </div> </div> </div>