Remove model field verbose names. Move help texts.

This commit is contained in:
Norman Jäckel 2016-01-09 13:32:56 +01:00
parent 4b69c57c78
commit e406b92745
14 changed files with 343 additions and 78 deletions

View File

@ -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),
),
]

View File

@ -160,25 +160,24 @@ class Item(RESTModelMixin, models.Model):
(AGENDA_ITEM, ugettext_lazy('Agenda item')), (AGENDA_ITEM, ugettext_lazy('Agenda item')),
(HIDDEN_ITEM, ugettext_lazy('Hidden 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. 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. 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. Flag, if the item is finished.
""" """
type = models.IntegerField( type = models.IntegerField(
choices=ITEM_TYPE, choices=ITEM_TYPE,
default=AGENDA_ITEM, default=AGENDA_ITEM)
verbose_name=ugettext_lazy("Type"))
""" """
Type of the agenda item. Type of the agenda item.
@ -200,7 +199,7 @@ class Item(RESTModelMixin, models.Model):
The parent item in the agenda tree. 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. Weight to sort the item in the agenda.
""" """
@ -225,7 +224,7 @@ class Item(RESTModelMixin, models.Model):
""" """
speaker_list_closed = models.BooleanField( 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. True, if the list of speakers is closed.
""" """

View File

@ -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),
),
]

View File

@ -72,29 +72,25 @@ class Assignment(RESTModelMixin, models.Model):
) )
title = models.CharField( title = models.CharField(
max_length=100, max_length=100)
verbose_name=ugettext_lazy("Title"))
""" """
Title of the assignment. Title of the assignment.
""" """
description = models.TextField( description = models.TextField(
blank=True, blank=True)
verbose_name=ugettext_lazy("Description"))
""" """
Text to describe the assignment. Text to describe the assignment.
""" """
open_posts = models.PositiveSmallIntegerField( open_posts = models.PositiveSmallIntegerField()
verbose_name=ugettext_lazy("Number of members to be elected"))
""" """
The number of members to be elected. The number of members to be elected.
""" """
poll_description_default = models.CharField( poll_description_default = models.CharField(
max_length=79, max_length=79,
blank=True, blank=True)
verbose_name=ugettext_lazy("Default comment on the ballot paper"))
""" """
Default text for the poll description. Default text for the poll description.
""" """
@ -384,8 +380,7 @@ class AssignmentPoll(RESTModelMixin, CollectDefaultVotesMixin,
yesnoabstain = models.BooleanField(default=False) yesnoabstain = models.BooleanField(default=False)
description = models.CharField( description = models.CharField(
max_length=79, max_length=79,
blank=True, blank=True)
verbose_name=ugettext_lazy("Comment on the ballot paper"))
class Meta: class Meta:
default_permissions = () default_permissions = ()

View File

@ -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),
),
]

View File

@ -1,8 +1,7 @@
from django.conf import settings from django.conf import settings
from django.contrib.contenttypes.models import ContentType from django.contrib.contenttypes.models import ContentType
from django.db import models from django.db import models
from django.utils.translation import ugettext as _ from django.utils.translation import ugettext_noop
from django.utils.translation import ugettext_lazy, ugettext_noop
from jsonfield import JSONField from jsonfield import JSONField
from openslides.utils.models import RESTModelMixin from openslides.utils.models import RESTModelMixin
@ -87,7 +86,7 @@ class Projector(RESTModelMixin, models.Model):
result[key]['uuid'] = key result[key]['uuid'] = key
element = elements.get(value['name']) element = elements.get(value['name'])
if element is None: if element is None:
result[key]['error'] = _('Projector element does not exist.') result[key]['error'] = 'Projector element does not exist.'
else: else:
try: try:
result[key].update(element.get_data( result[key].update(element.get_data(
@ -122,13 +121,10 @@ class CustomSlide(RESTModelMixin, models.Model):
Model for slides with custom content. Model for slides with custom content.
""" """
title = models.CharField( title = models.CharField(
verbose_name=ugettext_lazy('Title'),
max_length=256) max_length=256)
text = models.TextField( text = models.TextField(
verbose_name=ugettext_lazy('Text'),
blank=True) blank=True)
weight = models.IntegerField( weight = models.IntegerField(
verbose_name=ugettext_lazy('Weight'),
default=0) default=0)
class Meta: class Meta:
@ -173,7 +169,6 @@ class Tag(RESTModelMixin, models.Model):
motions or assignments. motions or assignments.
""" """
name = models.CharField( name = models.CharField(
verbose_name=ugettext_lazy('Tag'),
max_length=255, max_length=255,
unique=True) unique=True)
@ -210,15 +205,13 @@ class ChatMessage(RESTModelMixin, models.Model):
At the moment we only have one global chat room for managers. At the moment we only have one global chat room for managers.
""" """
message = models.TextField( message = models.TextField()
verbose_name=ugettext_lazy('Message'))
timestamp = models.DateTimeField(auto_now_add=True) timestamp = models.DateTimeField(auto_now_add=True)
user = models.ForeignKey( user = models.ForeignKey(
settings.AUTH_USER_MODEL, settings.AUTH_USER_MODEL,
on_delete=models.CASCADE, on_delete=models.CASCADE)
verbose_name=ugettext_lazy('User'))
class Meta: class Meta:
default_permissions = () default_permissions = ()

View File

@ -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),
),
]

View File

@ -1,7 +1,7 @@
from django.conf import settings from django.conf import settings
from django.db import models from django.db import models
from django.utils.translation import ugettext as _ 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 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. 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 See https://docs.djangoproject.com/en/dev/ref/models/fields/#filefield
for more information. 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.""" """A string representing the title of the file."""
uploader = models.ForeignKey( uploader = models.ForeignKey(
settings.AUTH_USER_MODEL, settings.AUTH_USER_MODEL,
on_delete=models.SET_NULL, on_delete=models.SET_NULL,
null=True, null=True,
blank=True, blank=True)
verbose_name=ugettext_lazy('Uploaded by'))
"""A user the uploader of a file.""" """A user the uploader of a file."""
timestamp = models.DateTimeField(auto_now_add=True) timestamp = models.DateTimeField(auto_now_add=True)

View File

@ -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),
),
]

View File

@ -583,21 +583,18 @@ class MotionVersion(RESTModelMixin, models.Model):
Is unique for each motion. 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.""" """The title of a motion."""
text = models.TextField(verbose_name=ugettext_lazy("Text")) text = models.TextField()
"""The text of a motion.""" """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.""" """The reason for a motion."""
creation_time = models.DateTimeField(auto_now=True) creation_time = models.DateTimeField(auto_now=True)
"""Time when the version was saved.""" """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: class Meta:
default_permissions = () default_permissions = ()
unique_together = ("motion", "version_number") unique_together = ("motion", "version_number")
@ -620,10 +617,10 @@ class MotionVersion(RESTModelMixin, models.Model):
class Category(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.""" """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. """Prefix of the category.
Used to build the identifier of a motion. Used to build the identifier of a motion.

View File

@ -78,12 +78,9 @@ class CollectDefaultVotesMixin(models.Model):
Mixin for a poll to collect the default vote values for valid votes, Mixin for a poll to collect the default vote values for valid votes,
invalid votes and votes cast. invalid votes and votes cast.
""" """
votesvalid = MinMaxIntegerField(null=True, blank=True, min_value=-2, votesvalid = MinMaxIntegerField(null=True, blank=True, min_value=-2)
verbose_name=ugettext_lazy('Valid votes')) votesinvalid = 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)
verbose_name=ugettext_lazy('Invalid votes'))
votescast = MinMaxIntegerField(null=True, blank=True, min_value=-2,
verbose_name=ugettext_lazy('Votes cast'))
class Meta: class Meta:
abstract = True abstract = True

View File

@ -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),
),
]

View File

@ -8,7 +8,7 @@ from django.contrib.auth.models import (
PermissionsMixin, PermissionsMixin,
) )
from django.db import models 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 from openslides.utils.search import user_name_helper
@ -98,67 +98,48 @@ class User(RESTModelMixin, PermissionsMixin, AbstractBaseUser):
USERNAME_FIELD = 'username' USERNAME_FIELD = 'username'
username = models.CharField( username = models.CharField(
ugettext_lazy('Username'),
max_length=255, max_length=255,
unique=True, unique=True,
blank=True) blank=True)
first_name = models.CharField( first_name = models.CharField(
ugettext_lazy('First name'),
max_length=255, max_length=255,
blank=True) blank=True)
last_name = models.CharField( last_name = models.CharField(
ugettext_lazy('Last name'),
max_length=255, max_length=255,
blank=True) blank=True)
# TODO: Try to remove the default argument in the following fields. # TODO: Try to remove the default argument in the following fields.
structure_level = models.CharField( structure_level = models.CharField(
ugettext_lazy('Structure level'),
max_length=255, max_length=255,
blank=True, blank=True,
default='', default='')
help_text=ugettext_lazy('Will be shown after the name.'))
title = models.CharField( title = models.CharField(
ugettext_lazy('Title'),
max_length=50, max_length=50,
blank=True, blank=True,
default='', default='')
help_text=ugettext_lazy('Will be shown before the name.'))
about_me = models.TextField( about_me = models.TextField(
ugettext_lazy('About me'),
blank=True, blank=True,
default='', default='')
help_text=ugettext_lazy('Profile text.'))
comment = models.TextField( comment = models.TextField(
ugettext_lazy('Comment'),
blank=True, blank=True,
default='', default='')
help_text=ugettext_lazy('Only for notes.'))
default_password = models.CharField( default_password = models.CharField(
ugettext_lazy('Default password'),
max_length=100, max_length=100,
blank=True, blank=True,
default='') default='')
is_active = models.BooleanField( is_active = models.BooleanField(
ugettext_lazy('Active'), default=True)
default=True,
help_text=ugettext_lazy(
'Designates whether this user should be treated as '
'active. Unselect this instead of deleting the account.'))
is_present = models.BooleanField( is_present = models.BooleanField(
ugettext_lazy('Present'), default=False)
default=False,
help_text=ugettext_lazy(
'Designates whether this user is in the room or not.'))
objects = UserManager() objects = UserManager()

View File

@ -289,6 +289,7 @@ angular.module('OpenSlidesApp.users.site', ['OpenSlidesApp.users'])
type: 'input', type: 'input',
templateOptions: { templateOptions: {
label: gettextCatalog.getString('Title'), 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', key: 'structure_level',
type: 'input', type: 'input',
templateOptions: { 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', key: 'comment',
type: 'input', type: 'input',
templateOptions: { templateOptions: {
label: gettextCatalog.getString('Comment') label: gettextCatalog.getString('Comment'),
description: gettextCatalog.getString('Only for notes.')
} }
}, },
{ {
key: 'about_me', key: 'about_me',
type: 'textarea', type: 'textarea',
templateOptions: { templateOptions: {
label: gettextCatalog.getString('About me') label: gettextCatalog.getString('About me'),
description: gettextCatalog.getString('Profile text.')
}, },
ngModelElAttrs: {'ckeditor': 'CKEditorOptions'} ngModelElAttrs: {'ckeditor': 'CKEditorOptions'}
}, },
@ -356,14 +360,18 @@ angular.module('OpenSlidesApp.users.site', ['OpenSlidesApp.users'])
key: 'is_present', key: 'is_present',
type: 'checkbox', type: 'checkbox',
templateOptions: { 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', key: 'is_active',
type: 'checkbox', type: 'checkbox',
templateOptions: { 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.')
} }
}]; }];
} }