From 9177e7f60868a34a50da65d5dc7fe2aac17b2804 Mon Sep 17 00:00:00 2001 From: Weitian LI Date: Tue, 29 Apr 2014 01:27:31 +0800 Subject: * updated transcript help_text of account/models.py * updated ValidationError message and used named string of account/extra.py * small changes to 'profile.html' and 'profile_update.html' * added class Meta to notice/models.py/NoticeAttachment --- account/extra.py | 4 ++-- account/models.py | 2 +- account/templates/account/profile.html | 1 + account/templates/account/profile_update.html | 1 + notice/models.py | 4 ++++ 5 files changed, 9 insertions(+), 3 deletions(-) diff --git a/account/extra.py b/account/extra.py index e478c6d..74c11e7 100644 --- a/account/extra.py +++ b/account/extra.py @@ -46,9 +46,9 @@ class ContentTypeRestrictedFileField(models.FileField): #raise forms.ValidationError(_("Invalid filetype."), code='invalid') if content_type in self.content_types: if file._size > self.max_upload_size: - raise forms.ValidationError(_('Please keep filesize under %s. Current filesize %s') % (filesizeformat(self.max_upload_size), filesizeformat(file._size)), code='invalid') + raise forms.ValidationError(_('Please keep filesize under %(maxsize)s. Current filesize %(filesize)s') % {'maxsize':filesizeformat(self.max_upload_size), 'filesize':filesizeformat(file._size)}, code='invalid') else: - raise forms.ValidationError(_("Invalid filetype."), code='invalid') + raise forms.ValidationError(_("Unsupported filetype"), code='invalid') except AttributeError: pass # diff --git a/account/models.py b/account/models.py index 1816c62..87ae0b5 100644 --- a/account/models.py +++ b/account/models.py @@ -72,7 +72,7 @@ class UserProfile(models.Model): # transcript: needed if undergraudate (junior and below) transcript = ContentTypeRestrictedFileField(upload_to=lambda instance, filename: u'account/{0}/{1}'.format(instance.user.username, filename), verbose_name=_("Transcript"), blank=True, null=True, - help_text=_("Undergraduate (junior and below) required to upload transcript."), + help_text=_("Undergraduate (junior and below) required to upload transcript. PDF format is recommended."), storage=OverwriteStorage(), content_types=settings.ALLOWED_CONTENT_TYPES, max_upload_size=settings.ALLOWED_MAX_UPLOAD_SIZE) diff --git a/account/templates/account/profile.html b/account/templates/account/profile.html index a615db5..0eb70d2 100644 --- a/account/templates/account/profile.html +++ b/account/templates/account/profile.html @@ -125,6 +125,7 @@ 更新个人信息 修改密码

+
{% endblock %} diff --git a/account/templates/account/profile_update.html b/account/templates/account/profile_update.html index 2023aa9..608f581 100644 --- a/account/templates/account/profile_update.html +++ b/account/templates/account/profile_update.html @@ -44,6 +44,7 @@ {% endfor %} {% buttons submit='提交' reset='重置' layout='horizontal' %}{% endbuttons %} +
{% endblock %} diff --git a/notice/models.py b/notice/models.py index 02780ec..e2b9533 100644 --- a/notice/models.py +++ b/notice/models.py @@ -56,4 +56,8 @@ class NoticeAttachment(models.Model): object_id = models.PositiveIntegerField() content_object = generic.GenericForeignKey("content_type", "object_id") + class Meta: + verbose_name = _('notice attachment') + verbose_name_plural = _('notice attachments') + -- cgit v1.2.2