Commit 6611ec9d authored by stef's avatar stef
Browse files

[enh] files are stored with a hashed name

parent e5391246
......@@ -71,6 +71,7 @@ class Comment(models.Model):
class Attachment(models.Model):
storage = models.FileField(upload_to='static')
name= models.CharField(max_length=512)
comment = models.ForeignKey(Comment)
class ViolationModerator(CommentModerator):
......@@ -9,7 +9,7 @@ from django.core.exceptions import ObjectDoesNotExist
from models import Violation, Attachment, Comment
from tempfile import mkstemp
from datetime import datetime
import hashlib, os, re, json
import hashlib, os, re, json, hashlib
from urlparse import urljoin
from BeautifulSoup import BeautifulSoup, Comment as BComment
......@@ -65,8 +65,12 @@ def add(request):
for f in request.FILES.getlist('attachments[]'):
m = hashlib.sha256()
for chunk in f.chunks():
return HttpResponseRedirect('/') # Redirect after POST
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