From e406b9274560cfe7a0c4aa785fcddbc42c4f64b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Norman=20J=C3=A4ckel?= Date: Sat, 9 Jan 2016 13:32:56 +0100 Subject: [PATCH] Remove model field verbose names. Move help texts. --- .../migrations/0007_auto_20160109_1329.py | 44 +++++++++++++ openslides/agenda/models.py | 13 ++-- .../migrations/0004_auto_20160109_1329.py | 56 ++++++++++++++++ openslides/assignments/models.py | 15 ++--- .../migrations/0009_auto_20160109_1329.py | 45 +++++++++++++ openslides/core/models.py | 15 ++--- .../migrations/0006_auto_20160109_1329.py | 31 +++++++++ openslides/mediafiles/models.py | 9 ++- .../migrations/0007_auto_20160109_1329.py | 56 ++++++++++++++++ openslides/motions/models.py | 13 ++-- openslides/poll/models.py | 9 +-- .../migrations/0005_auto_20160109_1329.py | 64 +++++++++++++++++++ openslides/users/models.py | 33 ++-------- openslides/users/static/js/users/site.js | 18 ++++-- 14 files changed, 343 insertions(+), 78 deletions(-) create mode 100644 openslides/agenda/migrations/0007_auto_20160109_1329.py create mode 100644 openslides/assignments/migrations/0004_auto_20160109_1329.py create mode 100644 openslides/core/migrations/0009_auto_20160109_1329.py create mode 100644 openslides/mediafiles/migrations/0006_auto_20160109_1329.py create mode 100644 openslides/motions/migrations/0007_auto_20160109_1329.py create mode 100644 openslides/users/migrations/0005_auto_20160109_1329.py diff --git a/openslides/agenda/migrations/0007_auto_20160109_1329.py b/openslides/agenda/migrations/0007_auto_20160109_1329.py new file mode 100644 index 000000000..a4e577e47 --- /dev/null +++ b/openslides/agenda/migrations/0007_auto_20160109_1329.py @@ -0,0 +1,44 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('agenda', '0006_auto_20160109_1145'), + ] + + operations = [ + migrations.AlterField( + model_name='item', + name='closed', + field=models.BooleanField(default=False), + ), + migrations.AlterField( + model_name='item', + name='comment', + field=models.TextField(blank=True, null=True), + ), + migrations.AlterField( + model_name='item', + name='item_number', + field=models.CharField(max_length=255, blank=True), + ), + migrations.AlterField( + model_name='item', + name='speaker_list_closed', + field=models.BooleanField(default=False), + ), + migrations.AlterField( + model_name='item', + name='type', + field=models.IntegerField(default=1, choices=[(1, 'Agenda item'), (2, 'Hidden item')]), + ), + migrations.AlterField( + model_name='item', + name='weight', + field=models.IntegerField(default=0), + ), + ] diff --git a/openslides/agenda/models.py b/openslides/agenda/models.py index 4bd241d62..21efaf80e 100644 --- a/openslides/agenda/models.py +++ b/openslides/agenda/models.py @@ -160,25 +160,24 @@ class Item(RESTModelMixin, models.Model): (AGENDA_ITEM, ugettext_lazy('Agenda item')), (HIDDEN_ITEM, ugettext_lazy('Hidden item'))) - item_number = models.CharField(blank=True, max_length=255, verbose_name=ugettext_lazy("Number")) + item_number = models.CharField(blank=True, max_length=255) """ Number of agenda item. """ - comment = models.TextField(null=True, blank=True, verbose_name=ugettext_lazy("Comment")) + comment = models.TextField(null=True, blank=True) """ Optional comment to the agenda item. Will not be shoun to normal users. """ - closed = models.BooleanField(default=False, verbose_name=ugettext_lazy("Closed")) + closed = models.BooleanField(default=False) """ Flag, if the item is finished. """ type = models.IntegerField( choices=ITEM_TYPE, - default=AGENDA_ITEM, - verbose_name=ugettext_lazy("Type")) + default=AGENDA_ITEM) """ Type of the agenda item. @@ -200,7 +199,7 @@ class Item(RESTModelMixin, models.Model): The parent item in the agenda tree. """ - weight = models.IntegerField(default=0, verbose_name=ugettext_lazy("Weight")) + weight = models.IntegerField(default=0) """ Weight to sort the item in the agenda. """ @@ -225,7 +224,7 @@ class Item(RESTModelMixin, models.Model): """ speaker_list_closed = models.BooleanField( - default=False, verbose_name=ugettext_lazy("List of speakers is closed")) + default=False) """ True, if the list of speakers is closed. """ diff --git a/openslides/assignments/migrations/0004_auto_20160109_1329.py b/openslides/assignments/migrations/0004_auto_20160109_1329.py new file mode 100644 index 000000000..3f213686b --- /dev/null +++ b/openslides/assignments/migrations/0004_auto_20160109_1329.py @@ -0,0 +1,56 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations, models + +import openslides.utils.models + + +class Migration(migrations.Migration): + + dependencies = [ + ('assignments', '0003_auto_20151210_0016'), + ] + + operations = [ + migrations.AlterField( + model_name='assignment', + name='description', + field=models.TextField(blank=True), + ), + migrations.AlterField( + model_name='assignment', + name='open_posts', + field=models.PositiveSmallIntegerField(), + ), + migrations.AlterField( + model_name='assignment', + name='poll_description_default', + field=models.CharField(max_length=79, blank=True), + ), + migrations.AlterField( + model_name='assignment', + name='title', + field=models.CharField(max_length=100), + ), + migrations.AlterField( + model_name='assignmentpoll', + name='description', + field=models.CharField(max_length=79, blank=True), + ), + migrations.AlterField( + model_name='assignmentpoll', + name='votescast', + field=openslides.utils.models.MinMaxIntegerField(blank=True, null=True), + ), + migrations.AlterField( + model_name='assignmentpoll', + name='votesinvalid', + field=openslides.utils.models.MinMaxIntegerField(blank=True, null=True), + ), + migrations.AlterField( + model_name='assignmentpoll', + name='votesvalid', + field=openslides.utils.models.MinMaxIntegerField(blank=True, null=True), + ), + ] diff --git a/openslides/assignments/models.py b/openslides/assignments/models.py index 2131124ea..719f01edb 100644 --- a/openslides/assignments/models.py +++ b/openslides/assignments/models.py @@ -72,29 +72,25 @@ class Assignment(RESTModelMixin, models.Model): ) title = models.CharField( - max_length=100, - verbose_name=ugettext_lazy("Title")) + max_length=100) """ Title of the assignment. """ description = models.TextField( - blank=True, - verbose_name=ugettext_lazy("Description")) + blank=True) """ Text to describe the assignment. """ - open_posts = models.PositiveSmallIntegerField( - verbose_name=ugettext_lazy("Number of members to be elected")) + open_posts = models.PositiveSmallIntegerField() """ The number of members to be elected. """ poll_description_default = models.CharField( max_length=79, - blank=True, - verbose_name=ugettext_lazy("Default comment on the ballot paper")) + blank=True) """ Default text for the poll description. """ @@ -384,8 +380,7 @@ class AssignmentPoll(RESTModelMixin, CollectDefaultVotesMixin, yesnoabstain = models.BooleanField(default=False) description = models.CharField( max_length=79, - blank=True, - verbose_name=ugettext_lazy("Comment on the ballot paper")) + blank=True) class Meta: default_permissions = () diff --git a/openslides/core/migrations/0009_auto_20160109_1329.py b/openslides/core/migrations/0009_auto_20160109_1329.py new file mode 100644 index 000000000..21d20d267 --- /dev/null +++ b/openslides/core/migrations/0009_auto_20160109_1329.py @@ -0,0 +1,45 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.conf import settings +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('core', '0008_auto_20151210_0016'), + ] + + operations = [ + migrations.AlterField( + model_name='chatmessage', + name='message', + field=models.TextField(), + ), + migrations.AlterField( + model_name='chatmessage', + name='user', + field=models.ForeignKey(to=settings.AUTH_USER_MODEL), + ), + migrations.AlterField( + model_name='customslide', + name='text', + field=models.TextField(blank=True), + ), + migrations.AlterField( + model_name='customslide', + name='title', + field=models.CharField(max_length=256), + ), + migrations.AlterField( + model_name='customslide', + name='weight', + field=models.IntegerField(default=0), + ), + migrations.AlterField( + model_name='tag', + name='name', + field=models.CharField(max_length=255, unique=True), + ), + ] diff --git a/openslides/core/models.py b/openslides/core/models.py index 55683df37..e860cfdea 100644 --- a/openslides/core/models.py +++ b/openslides/core/models.py @@ -1,8 +1,7 @@ from django.conf import settings from django.contrib.contenttypes.models import ContentType from django.db import models -from django.utils.translation import ugettext as _ -from django.utils.translation import ugettext_lazy, ugettext_noop +from django.utils.translation import ugettext_noop from jsonfield import JSONField from openslides.utils.models import RESTModelMixin @@ -87,7 +86,7 @@ class Projector(RESTModelMixin, models.Model): result[key]['uuid'] = key element = elements.get(value['name']) if element is None: - result[key]['error'] = _('Projector element does not exist.') + result[key]['error'] = 'Projector element does not exist.' else: try: result[key].update(element.get_data( @@ -122,13 +121,10 @@ class CustomSlide(RESTModelMixin, models.Model): Model for slides with custom content. """ title = models.CharField( - verbose_name=ugettext_lazy('Title'), max_length=256) text = models.TextField( - verbose_name=ugettext_lazy('Text'), blank=True) weight = models.IntegerField( - verbose_name=ugettext_lazy('Weight'), default=0) class Meta: @@ -173,7 +169,6 @@ class Tag(RESTModelMixin, models.Model): motions or assignments. """ name = models.CharField( - verbose_name=ugettext_lazy('Tag'), max_length=255, unique=True) @@ -210,15 +205,13 @@ class ChatMessage(RESTModelMixin, models.Model): At the moment we only have one global chat room for managers. """ - message = models.TextField( - verbose_name=ugettext_lazy('Message')) + message = models.TextField() timestamp = models.DateTimeField(auto_now_add=True) user = models.ForeignKey( settings.AUTH_USER_MODEL, - on_delete=models.CASCADE, - verbose_name=ugettext_lazy('User')) + on_delete=models.CASCADE) class Meta: default_permissions = () diff --git a/openslides/mediafiles/migrations/0006_auto_20160109_1329.py b/openslides/mediafiles/migrations/0006_auto_20160109_1329.py new file mode 100644 index 000000000..716afae10 --- /dev/null +++ b/openslides/mediafiles/migrations/0006_auto_20160109_1329.py @@ -0,0 +1,31 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +import django.db.models.deletion +from django.conf import settings +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('mediafiles', '0005_auto_20160109_1145'), + ] + + operations = [ + migrations.AlterField( + model_name='mediafile', + name='mediafile', + field=models.FileField(upload_to='file'), + ), + migrations.AlterField( + model_name='mediafile', + name='title', + field=models.CharField(max_length=255, blank=True, unique=True), + ), + migrations.AlterField( + model_name='mediafile', + name='uploader', + field=models.ForeignKey(on_delete=django.db.models.deletion.SET_NULL, blank=True, to=settings.AUTH_USER_MODEL, null=True), + ), + ] diff --git a/openslides/mediafiles/models.py b/openslides/mediafiles/models.py index f7d479759..a59cd2177 100644 --- a/openslides/mediafiles/models.py +++ b/openslides/mediafiles/models.py @@ -1,7 +1,7 @@ from django.conf import settings from django.db import models from django.utils.translation import ugettext as _ -from django.utils.translation import ugettext_lazy, ugettext_noop +from django.utils.translation import ugettext_noop from openslides.utils.search import user_name_helper @@ -12,21 +12,20 @@ class Mediafile(RESTModelMixin, models.Model): """ Class for uploaded files which can be delivered under a certain url. """ - mediafile = models.FileField(upload_to='file', verbose_name=ugettext_lazy('File')) + mediafile = models.FileField(upload_to='file') """ See https://docs.djangoproject.com/en/dev/ref/models/fields/#filefield for more information. """ - title = models.CharField(max_length=255, unique=True, blank=True, verbose_name=ugettext_lazy('Title')) + title = models.CharField(max_length=255, unique=True, blank=True) """A string representing the title of the file.""" uploader = models.ForeignKey( settings.AUTH_USER_MODEL, on_delete=models.SET_NULL, null=True, - blank=True, - verbose_name=ugettext_lazy('Uploaded by')) + blank=True) """A user – the uploader of a file.""" timestamp = models.DateTimeField(auto_now_add=True) diff --git a/openslides/motions/migrations/0007_auto_20160109_1329.py b/openslides/motions/migrations/0007_auto_20160109_1329.py new file mode 100644 index 000000000..ef8aaccb2 --- /dev/null +++ b/openslides/motions/migrations/0007_auto_20160109_1329.py @@ -0,0 +1,56 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations, models + +import openslides.utils.models + + +class Migration(migrations.Migration): + + dependencies = [ + ('motions', '0006_auto_20160109_1145'), + ] + + operations = [ + migrations.AlterField( + model_name='category', + name='name', + field=models.CharField(max_length=255), + ), + migrations.AlterField( + model_name='category', + name='prefix', + field=models.CharField(max_length=32, blank=True), + ), + migrations.AlterField( + model_name='motionpoll', + name='votescast', + field=openslides.utils.models.MinMaxIntegerField(blank=True, null=True), + ), + migrations.AlterField( + model_name='motionpoll', + name='votesinvalid', + field=openslides.utils.models.MinMaxIntegerField(blank=True, null=True), + ), + migrations.AlterField( + model_name='motionpoll', + name='votesvalid', + field=openslides.utils.models.MinMaxIntegerField(blank=True, null=True), + ), + migrations.AlterField( + model_name='motionversion', + name='reason', + field=models.TextField(blank=True, null=True), + ), + migrations.AlterField( + model_name='motionversion', + name='text', + field=models.TextField(), + ), + migrations.AlterField( + model_name='motionversion', + name='title', + field=models.CharField(max_length=255), + ), + ] diff --git a/openslides/motions/models.py b/openslides/motions/models.py index 76fc8d261..32ea653d3 100644 --- a/openslides/motions/models.py +++ b/openslides/motions/models.py @@ -583,21 +583,18 @@ class MotionVersion(RESTModelMixin, models.Model): Is unique for each motion. """ - title = models.CharField(max_length=255, verbose_name=ugettext_lazy("Title")) + title = models.CharField(max_length=255) """The title of a motion.""" - text = models.TextField(verbose_name=ugettext_lazy("Text")) + text = models.TextField() """The text of a motion.""" - reason = models.TextField(null=True, blank=True, verbose_name=ugettext_lazy("Reason")) + reason = models.TextField(null=True, blank=True) """The reason for a motion.""" creation_time = models.DateTimeField(auto_now=True) """Time when the version was saved.""" - # identifier = models.CharField(max_length=255, verbose_name=ugettext_lazy("Version identifier")) - # note = models.TextField(null=True, blank=True) - class Meta: default_permissions = () unique_together = ("motion", "version_number") @@ -620,10 +617,10 @@ class MotionVersion(RESTModelMixin, models.Model): class Category(RESTModelMixin, models.Model): - name = models.CharField(max_length=255, verbose_name=ugettext_lazy("Category name")) + name = models.CharField(max_length=255) """Name of the category.""" - prefix = models.CharField(blank=True, max_length=32, verbose_name=ugettext_lazy("Prefix")) + prefix = models.CharField(blank=True, max_length=32) """Prefix of the category. Used to build the identifier of a motion. diff --git a/openslides/poll/models.py b/openslides/poll/models.py index 327881f87..51bb4db22 100644 --- a/openslides/poll/models.py +++ b/openslides/poll/models.py @@ -78,12 +78,9 @@ class CollectDefaultVotesMixin(models.Model): Mixin for a poll to collect the default vote values for valid votes, invalid votes and votes cast. """ - votesvalid = MinMaxIntegerField(null=True, blank=True, min_value=-2, - verbose_name=ugettext_lazy('Valid votes')) - votesinvalid = MinMaxIntegerField(null=True, blank=True, min_value=-2, - verbose_name=ugettext_lazy('Invalid votes')) - votescast = MinMaxIntegerField(null=True, blank=True, min_value=-2, - verbose_name=ugettext_lazy('Votes cast')) + votesvalid = MinMaxIntegerField(null=True, blank=True, min_value=-2) + votesinvalid = MinMaxIntegerField(null=True, blank=True, min_value=-2) + votescast = MinMaxIntegerField(null=True, blank=True, min_value=-2) class Meta: abstract = True diff --git a/openslides/users/migrations/0005_auto_20160109_1329.py b/openslides/users/migrations/0005_auto_20160109_1329.py new file mode 100644 index 000000000..c6de866de --- /dev/null +++ b/openslides/users/migrations/0005_auto_20160109_1329.py @@ -0,0 +1,64 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('users', '0004_auto_20151210_0016'), + ] + + operations = [ + migrations.AlterField( + model_name='user', + name='about_me', + field=models.TextField(default='', blank=True), + ), + migrations.AlterField( + model_name='user', + name='comment', + field=models.TextField(default='', blank=True), + ), + migrations.AlterField( + model_name='user', + name='default_password', + field=models.CharField(default='', max_length=100, blank=True), + ), + migrations.AlterField( + model_name='user', + name='first_name', + field=models.CharField(max_length=255, blank=True), + ), + migrations.AlterField( + model_name='user', + name='is_active', + field=models.BooleanField(default=True), + ), + migrations.AlterField( + model_name='user', + name='is_present', + field=models.BooleanField(default=False), + ), + migrations.AlterField( + model_name='user', + name='last_name', + field=models.CharField(max_length=255, blank=True), + ), + migrations.AlterField( + model_name='user', + name='structure_level', + field=models.CharField(default='', max_length=255, blank=True), + ), + migrations.AlterField( + model_name='user', + name='title', + field=models.CharField(default='', max_length=50, blank=True), + ), + migrations.AlterField( + model_name='user', + name='username', + field=models.CharField(max_length=255, blank=True, unique=True), + ), + ] diff --git a/openslides/users/models.py b/openslides/users/models.py index 37d04a944..fa00eede8 100644 --- a/openslides/users/models.py +++ b/openslides/users/models.py @@ -8,7 +8,7 @@ from django.contrib.auth.models import ( PermissionsMixin, ) from django.db import models -from django.utils.translation import ugettext_lazy, ugettext_noop +from django.utils.translation import ugettext_noop from openslides.utils.search import user_name_helper @@ -98,67 +98,48 @@ class User(RESTModelMixin, PermissionsMixin, AbstractBaseUser): USERNAME_FIELD = 'username' username = models.CharField( - ugettext_lazy('Username'), max_length=255, unique=True, blank=True) first_name = models.CharField( - ugettext_lazy('First name'), max_length=255, blank=True) last_name = models.CharField( - ugettext_lazy('Last name'), max_length=255, blank=True) # TODO: Try to remove the default argument in the following fields. structure_level = models.CharField( - ugettext_lazy('Structure level'), max_length=255, blank=True, - default='', - help_text=ugettext_lazy('Will be shown after the name.')) + default='') title = models.CharField( - ugettext_lazy('Title'), max_length=50, blank=True, - default='', - help_text=ugettext_lazy('Will be shown before the name.')) + default='') about_me = models.TextField( - ugettext_lazy('About me'), blank=True, - default='', - help_text=ugettext_lazy('Profile text.')) + default='') comment = models.TextField( - ugettext_lazy('Comment'), blank=True, - default='', - help_text=ugettext_lazy('Only for notes.')) + default='') default_password = models.CharField( - ugettext_lazy('Default password'), max_length=100, blank=True, default='') is_active = models.BooleanField( - ugettext_lazy('Active'), - default=True, - help_text=ugettext_lazy( - 'Designates whether this user should be treated as ' - 'active. Unselect this instead of deleting the account.')) + default=True) is_present = models.BooleanField( - ugettext_lazy('Present'), - default=False, - help_text=ugettext_lazy( - 'Designates whether this user is in the room or not.')) + default=False) objects = UserManager() diff --git a/openslides/users/static/js/users/site.js b/openslides/users/static/js/users/site.js index c353f1c28..a829a34c4 100644 --- a/openslides/users/static/js/users/site.js +++ b/openslides/users/static/js/users/site.js @@ -289,6 +289,7 @@ angular.module('OpenSlidesApp.users.site', ['OpenSlidesApp.users']) type: 'input', templateOptions: { label: gettextCatalog.getString('Title'), + description: gettextCatalog.getString('Will be shown before the name.') } }, { @@ -309,7 +310,8 @@ angular.module('OpenSlidesApp.users.site', ['OpenSlidesApp.users']) key: 'structure_level', type: 'input', templateOptions: { - label: gettextCatalog.getString('Structure level') + label: gettextCatalog.getString('Structure level'), + description: gettextCatalog.getString('Will be shown after the name.') } }, { @@ -341,14 +343,16 @@ angular.module('OpenSlidesApp.users.site', ['OpenSlidesApp.users']) key: 'comment', type: 'input', templateOptions: { - label: gettextCatalog.getString('Comment') + label: gettextCatalog.getString('Comment'), + description: gettextCatalog.getString('Only for notes.') } }, { key: 'about_me', type: 'textarea', templateOptions: { - label: gettextCatalog.getString('About me') + label: gettextCatalog.getString('About me'), + description: gettextCatalog.getString('Profile text.') }, ngModelElAttrs: {'ckeditor': 'CKEditorOptions'} }, @@ -356,14 +360,18 @@ angular.module('OpenSlidesApp.users.site', ['OpenSlidesApp.users']) key: 'is_present', type: 'checkbox', templateOptions: { - label: gettextCatalog.getString('Is present') + label: gettextCatalog.getString('Is present'), + description: gettextCatalog.getString('Designates whether this user is in the room or not.') } }, { key: 'is_active', type: 'checkbox', templateOptions: { - label: gettextCatalog.getString('Is active') + label: gettextCatalog.getString('Is active'), + description: gettextCatalog.getString( + 'Designates whether this user should be treated as ' + 'active. Unselect this instead of deleting the account.') } }]; }