aboutsummaryrefslogtreecommitdiffstats
path: root/account/extra.py
diff options
context:
space:
mode:
authorWeitian LI <liweitianux@gmail.com>2014-05-20 16:54:06 +0800
committerWeitian LI <liweitianux@gmail.com>2014-05-20 16:54:06 +0800
commit40154f8351084f5f674cf3e7ea1e8b3bb65136a0 (patch)
treece111594bb2fae3fbecefcd22fd366dc030529c9 /account/extra.py
parent3fb6d3594492aa5cbe599a9fd7f247c72c0057a5 (diff)
downloaddjango-skaschool-40154f8351084f5f674cf3e7ea1e8b3bb65136a0.tar.bz2
* enabled 'south' in 'INSTALLED_APPS'
* added 'introspection_rules' of ContentTypeRestrictedFileField for south
Diffstat (limited to 'account/extra.py')
-rw-r--r--account/extra.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/account/extra.py b/account/extra.py
index 74c11e7..d0f74f2 100644
--- a/account/extra.py
+++ b/account/extra.py
@@ -12,9 +12,12 @@ from django.conf import settings
from django.template.defaultfilters import filesizeformat
from django.utils.translation import ugettext_lazy as _
+from south.modelsinspector import add_introspection_rules
+
import os
+### custom fields ###
class ContentTypeRestrictedFileField(models.FileField):
"""
Same as FileField, but you can specify:
@@ -54,6 +57,18 @@ class ContentTypeRestrictedFileField(models.FileField):
#
return data
+## add custom fields to south inspection
+add_introspection_rules([
+ (
+ [ContentTypeRestrictedFileField], # class these apply to
+ [], # positional arguments
+ { # keyword argument
+ "content_types": ["content_types", {}],
+ "max_upload_size": ["max_upload_size", {}],
+ },
+ ),
+], ["^account\.extra\.ContentTypeRestrictedFileField"])
+
### OverwriteStorage ###
class OverwriteStorage(FileSystemStorage):