Changing length of field mimetype to 255 chars.

According to
http://www.iana.org/assignments/media-types/media-types.xhtml
the length of mimetypes currently can be up to 85 chars, so with 255 we
will be safe.
This commit is contained in:
Mathias Behrle
2014-03-04 19:10:50 +01:00
parent 862eba0ca5
commit 188033c0f7
2 changed files with 157 additions and 3 deletions
+3 -3
View File
@@ -320,7 +320,7 @@ class DocumentVersion(models.Model):
# File related fields
file = models.FileField(upload_to=get_filename_from_uuid, storage=STORAGE_BACKEND(), verbose_name=_(u'file'))
mimetype = models.CharField(max_length=64, null=True, blank=True, editable=False)
mimetype = models.CharField(max_length=255, null=True, blank=True, editable=False)
encoding = models.CharField(max_length=64, null=True, blank=True, editable=False)
filename = models.CharField(max_length=255, default=u'', editable=False, db_index=True)
checksum = models.TextField(blank=True, null=True, verbose_name=_(u'checksum'), editable=False)
@@ -526,11 +526,11 @@ class DocumentVersion(models.Model):
return self.file.storage.size(self.file.path)
else:
return None
def rename(self, new_name):
new_filename, new_extension = os.path.splitext(new_name)
name, extension = os.path.splitext(self.filename)
# Preserve existing extension if new name doesn't has one
if new_extension:
extension = new_extension