Commit 5a96665c authored by Thom Wiggers's avatar Thom Wiggers 📐
Browse files

Merge branch '47-upload-meeting-documents-to-meeting-unique-directory' into 'master'

Namespace meeting documents to prevent nonces

Multiple meetings might have similarly named documents that would otherwise clash.
Closes #47 

See merge request !36
parents 676a48a7 23aad9ee
# -*- coding: utf-8 -*-
# Generated by Django 1.10 on 2016-08-13 09:16
from __future__ import unicode_literals
from django.db import migrations, models
import documents.models
import utils.validators
class Migration(migrations.Migration):
dependencies = [
('documents', '0004_auto_20160725_2346'),
]
operations = [
migrations.AlterField(
model_name='generalmeetingdocument',
name='file',
field=models.FileField(upload_to=documents.models.meetingdocument_upload_to, validators=[utils.validators.validate_file_extension]),
),
]
......@@ -58,10 +58,15 @@ class GeneralMeeting(models.Model):
ordering = ['datetime']
def meetingdocument_upload_to(instance, filename):
return 'documents/meetings/{}/files/{}'.format(instance.meeting.pk,
filename)
class GeneralMeetingDocument(models.Model):
meeting = models.ForeignKey(GeneralMeeting, on_delete=models.CASCADE)
file = models.FileField(
upload_to='documents/meetings/files/',
upload_to=meetingdocument_upload_to,
validators=[validate_file_extension],
)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment