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/*
|
bower_components/*
|
||||||
openslides/static/*
|
openslides/static/*
|
||||||
|
|
||||||
# Package building
|
# Package building/IDE
|
||||||
docs/_build/*
|
docs/_build/*
|
||||||
*.egg-info
|
*.egg-info
|
||||||
build/*
|
build/*
|
||||||
dist/*
|
dist/*
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
.idea
|
||||||
|
|
||||||
# Unit test and coverage reports
|
# Unit test and coverage reports
|
||||||
.coverage
|
.coverage
|
||||||
|
1
AUTHORS
1
AUTHORS
@ -14,3 +14,4 @@ Authors of OpenSlides in chronological order of first contribution:
|
|||||||
Max Brauer <max@max-brauer.de>
|
Max Brauer <max@max-brauer.de>
|
||||||
Marco A. G. Pinto <marcoagpinto@mail.telepac.pt> (Portuguese translation)
|
Marco A. G. Pinto <marcoagpinto@mail.telepac.pt> (Portuguese translation)
|
||||||
Dominik Breu <dominikbreu@yahoo.de>
|
Dominik Breu <dominikbreu@yahoo.de>
|
||||||
|
André Böhlke <ab@bcoding.de>
|
||||||
|
@ -190,7 +190,6 @@ class CustomSlideViewMixin(object):
|
|||||||
Mixin for for CustomSlide Views.
|
Mixin for for CustomSlide Views.
|
||||||
"""
|
"""
|
||||||
fields = ('title', 'text', 'weight',)
|
fields = ('title', 'text', 'weight',)
|
||||||
|
|
||||||
required_permission = 'core.can_manage_projector'
|
required_permission = 'core.can_manage_projector'
|
||||||
template_name = 'core/customslide_update.html'
|
template_name = 'core/customslide_update.html'
|
||||||
model = CustomSlide
|
model = CustomSlide
|
||||||
|
@ -39,7 +39,6 @@ class MediafileViewMixin(object):
|
|||||||
A manager can set the uploader manually, else the request user is set as uploader.
|
A manager can set the uploader manually, else the request user is set as uploader.
|
||||||
"""
|
"""
|
||||||
fields = ('mediafile', 'title', 'uploader', 'is_presentable',)
|
fields = ('mediafile', 'title', 'uploader', 'is_presentable',)
|
||||||
|
|
||||||
model = Mediafile
|
model = Mediafile
|
||||||
success_url_name = 'mediafile_list'
|
success_url_name = 'mediafile_list'
|
||||||
url_name_args = []
|
url_name_args = []
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
import collections
|
||||||
|
|
||||||
from django import forms
|
from django import forms
|
||||||
from django.utils.translation import ugettext_lazy
|
from django.utils.translation import ugettext_lazy
|
||||||
|
|
||||||
@ -51,6 +53,21 @@ class BaseMotionForm(CleanHtmlFormMixin, CssClassMixin, forms.ModelForm):
|
|||||||
required=False,
|
required=False,
|
||||||
label=ugettext_lazy('Tags'))
|
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:
|
class Meta:
|
||||||
model = Motion
|
model = Motion
|
||||||
fields = ()
|
fields = ()
|
||||||
@ -71,6 +88,11 @@ class BaseMotionForm(CleanHtmlFormMixin, CssClassMixin, forms.ModelForm):
|
|||||||
self.initial['tags'] = self.motion.tags.all()
|
self.initial['tags'] = self.motion.tags.all()
|
||||||
super(BaseMotionForm, self).__init__(*args, **kwargs)
|
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):
|
class MotionSubmitterMixin(forms.ModelForm):
|
||||||
"""Mixin to append the submitter field to a MotionForm."""
|
"""Mixin to append the submitter field to a MotionForm."""
|
||||||
|
@ -793,7 +793,6 @@ class CategoryListView(ListView):
|
|||||||
|
|
||||||
class CategoryCreateView(CreateView):
|
class CategoryCreateView(CreateView):
|
||||||
fields = ("name", "prefix",)
|
fields = ("name", "prefix",)
|
||||||
|
|
||||||
required_permission = 'motion.can_manage_motion'
|
required_permission = 'motion.can_manage_motion'
|
||||||
model = Category
|
model = Category
|
||||||
success_url_name = 'motion_category_list'
|
success_url_name = 'motion_category_list'
|
||||||
@ -802,7 +801,6 @@ class CategoryCreateView(CreateView):
|
|||||||
|
|
||||||
class CategoryUpdateView(UpdateView):
|
class CategoryUpdateView(UpdateView):
|
||||||
fields = ("name", "prefix",)
|
fields = ("name", "prefix",)
|
||||||
|
|
||||||
required_permission = 'motion.can_manage_motion'
|
required_permission = 'motion.can_manage_motion'
|
||||||
model = Category
|
model = Category
|
||||||
success_url_name = 'motion_category_list'
|
success_url_name = 'motion_category_list'
|
||||||
|
Loading…
Reference in New Issue
Block a user