Skip to content

Commit

Permalink
[#1025] Allow non-ascii characters in document upload
Browse files Browse the repository at this point in the history
  • Loading branch information
KasperBrandt committed Feb 11, 2015
1 parent 68dd18c commit 3a209bd
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions akvo/rsr/models/project_document.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,14 @@ def __unicode__(self):
return self.title

def clean(self):
"""
Check if the user has at least uploaded a document or indicated an URL.
"""
# Check if the user has at least uploaded a document or indicated an URL.
if not (self.url or self.document):
raise ValidationError(u'It is required to upload a document or indicate an URL.')

# Check for non-unicode characters
if self.document:
self.document.name = self.document.name.encode('ascii','ignore')

def show_link(self):
title = self.title if self.title else u'Untitled document'
if self.url:
Expand Down

0 comments on commit 3a209bd

Please sign in to comment.