Merge pull request #1796 from normanjaeckel/MoveTranslations

Remove model field verbose names. Move help texts.
This commit is contained in:
Oskar Hahn 2016-01-09 14:25:42 +01:00
commit c2041dca6f
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

@ -164,25 +164,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.
@ -204,7 +203,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.
"""
@ -229,7 +228,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.
"""

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(
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 = ()

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.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 = ()

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.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)

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.
"""
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.

View File

@ -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

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,
)
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()

View File

@ -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.')
}
}];
}