Fix field order in motion forms.
Add documentation for new attribute. Added .idea to .gitignore.
This commit is contained in:
parent
e2e16a4c34
commit
591d230cbb
3
.gitignore
vendored
3
.gitignore
vendored
@ -19,12 +19,13 @@ whoosh_index/*
|
||||
bower_components/*
|
||||
openslides/static/*
|
||||
|
||||
# Package building
|
||||
# Package building/IDE
|
||||
docs/_build/*
|
||||
*.egg-info
|
||||
build/*
|
||||
dist/*
|
||||
.DS_Store
|
||||
.idea
|
||||
|
||||
# Unit test and coverage reports
|
||||
.coverage
|
||||
|
1
AUTHORS
1
AUTHORS
@ -14,3 +14,4 @@ Authors of OpenSlides in chronological order of first contribution:
|
||||
Max Brauer <max@max-brauer.de>
|
||||
Marco A. G. Pinto <marcoagpinto@mail.telepac.pt> (Portuguese translation)
|
||||
Dominik Breu <dominikbreu@yahoo.de>
|
||||
André Böhlke <ab@bcoding.de>
|
||||
|
@ -189,8 +189,7 @@ class CustomSlideViewMixin(object):
|
||||
"""
|
||||
Mixin for for CustomSlide Views.
|
||||
"""
|
||||
fields = ('title', 'text', 'weight', )
|
||||
|
||||
fields = ('title', 'text', 'weight',)
|
||||
required_permission = 'core.can_manage_projector'
|
||||
template_name = 'core/customslide_update.html'
|
||||
model = CustomSlide
|
||||
|
@ -39,7 +39,6 @@ class MediafileViewMixin(object):
|
||||
A manager can set the uploader manually, else the request user is set as uploader.
|
||||
"""
|
||||
fields = ('mediafile', 'title', 'uploader', 'is_presentable',)
|
||||
|
||||
model = Mediafile
|
||||
success_url_name = 'mediafile_list'
|
||||
url_name_args = []
|
||||
|
@ -1,3 +1,5 @@
|
||||
import collections
|
||||
|
||||
from django import forms
|
||||
from django.utils.translation import ugettext_lazy
|
||||
|
||||
@ -51,6 +53,21 @@ class BaseMotionForm(CleanHtmlFormMixin, CssClassMixin, forms.ModelForm):
|
||||
required=False,
|
||||
label=ugettext_lazy('Tags'))
|
||||
|
||||
key_order = ('identifier',
|
||||
'title',
|
||||
'text',
|
||||
'reason',
|
||||
'submitter',
|
||||
'supporter',
|
||||
'category',
|
||||
'tags',
|
||||
'attachments',
|
||||
'workflow',
|
||||
'disable_versioning',)
|
||||
"""
|
||||
Order of fields, including optional fields from mixins (for example MotionSupporterMixin)
|
||||
"""
|
||||
|
||||
class Meta:
|
||||
model = Motion
|
||||
fields = ()
|
||||
@ -71,6 +88,11 @@ class BaseMotionForm(CleanHtmlFormMixin, CssClassMixin, forms.ModelForm):
|
||||
self.initial['tags'] = self.motion.tags.all()
|
||||
super(BaseMotionForm, self).__init__(*args, **kwargs)
|
||||
|
||||
keys = self.fields.keys()
|
||||
keys_order = [key for key in self.key_order if key in keys]
|
||||
keys_order.extend(set(keys) - set(keys_order))
|
||||
self.fields = collections.OrderedDict([(key, self.fields[key]) for key in keys_order])
|
||||
|
||||
|
||||
class MotionSubmitterMixin(forms.ModelForm):
|
||||
"""Mixin to append the submitter field to a MotionForm."""
|
||||
|
@ -793,7 +793,6 @@ class CategoryListView(ListView):
|
||||
|
||||
class CategoryCreateView(CreateView):
|
||||
fields = ("name", "prefix",)
|
||||
|
||||
required_permission = 'motion.can_manage_motion'
|
||||
model = Category
|
||||
success_url_name = 'motion_category_list'
|
||||
@ -802,7 +801,6 @@ class CategoryCreateView(CreateView):
|
||||
|
||||
class CategoryUpdateView(UpdateView):
|
||||
fields = ("name", "prefix",)
|
||||
|
||||
required_permission = 'motion.can_manage_motion'
|
||||
model = Category
|
||||
success_url_name = 'motion_category_list'
|
||||
|
Loading…
Reference in New Issue
Block a user