Use flake8 instead of pep8. Orderd the imports with isort
* changed the fab-command pep8 to check * checked and fixed any code with flake8. Also the urls.py * checkt the projector app with pylint
This commit is contained in:
parent
840ac34c80
commit
d937262d28
10
fabfile.py
vendored
10
fabfile.py
vendored
@ -45,12 +45,12 @@ def coverage():
|
|||||||
webbrowser.open(os.path.join(os.path.dirname(__file__), 'htmlcov', 'index.html'))
|
webbrowser.open(os.path.join(os.path.dirname(__file__), 'htmlcov', 'index.html'))
|
||||||
|
|
||||||
|
|
||||||
def pep8():
|
def check():
|
||||||
"""
|
"""
|
||||||
Checks for PEP 8 errors in openslides and in tests.
|
Checks for PEP 8 errors in openslides and in tests.
|
||||||
"""
|
"""
|
||||||
local('pep8 --max-line-length=150 --exclude="urls.py," --statistics openslides')
|
local('flake8 --max-line-length=150 --statistics openslides')
|
||||||
local('pep8 --max-line-length=150 --statistics tests')
|
local('flake8 --max-line-length=150 --statistics tests')
|
||||||
|
|
||||||
|
|
||||||
def prepare_commit():
|
def prepare_commit():
|
||||||
@ -60,7 +60,7 @@ def prepare_commit():
|
|||||||
At the moment it is running the tests and check for PEP 8 errors.
|
At the moment it is running the tests and check for PEP 8 errors.
|
||||||
"""
|
"""
|
||||||
test()
|
test()
|
||||||
pep8()
|
check()
|
||||||
|
|
||||||
|
|
||||||
def travis_ci():
|
def travis_ci():
|
||||||
@ -68,7 +68,7 @@ def travis_ci():
|
|||||||
Command that is run by Travis CI.
|
Command that is run by Travis CI.
|
||||||
"""
|
"""
|
||||||
coverage_report_plain()
|
coverage_report_plain()
|
||||||
pep8()
|
check()
|
||||||
|
|
||||||
|
|
||||||
def run_script(script):
|
def run_script(script):
|
||||||
|
@ -10,8 +10,8 @@
|
|||||||
:license: GNU GPL, see LICENSE for more details.
|
:license: GNU GPL, see LICENSE for more details.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from django.utils.translation import ugettext as _
|
|
||||||
from django.contrib.auth.models import AnonymousUser
|
from django.contrib.auth.models import AnonymousUser
|
||||||
|
from django.utils.translation import ugettext as _
|
||||||
|
|
||||||
from openslides.config.api import config
|
from openslides.config.api import config
|
||||||
from openslides.projector.projector import Widget
|
from openslides.projector.projector import Widget
|
||||||
|
@ -12,4 +12,4 @@
|
|||||||
:license: GNU GPL, see LICENSE for more details.
|
:license: GNU GPL, see LICENSE for more details.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from . import signals, slides
|
from . import signals, slides # noqa
|
||||||
|
@ -18,6 +18,7 @@ from mptt.forms import TreeNodeChoiceField
|
|||||||
|
|
||||||
from openslides.utils.forms import CssClassMixin
|
from openslides.utils.forms import CssClassMixin
|
||||||
from openslides.utils.person.forms import PersonFormField
|
from openslides.utils.person.forms import PersonFormField
|
||||||
|
|
||||||
from .models import Item, Speaker
|
from .models import Item, Speaker
|
||||||
|
|
||||||
|
|
||||||
|
@ -12,21 +12,20 @@
|
|||||||
|
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
||||||
from django.db import models
|
|
||||||
from django.contrib.auth.models import AnonymousUser
|
from django.contrib.auth.models import AnonymousUser
|
||||||
from django.contrib.contenttypes.models import ContentType
|
|
||||||
from django.contrib.contenttypes import generic
|
from django.contrib.contenttypes import generic
|
||||||
|
from django.contrib.contenttypes.models import ContentType
|
||||||
from django.core.urlresolvers import reverse
|
from django.core.urlresolvers import reverse
|
||||||
from django.utils.translation import ugettext_lazy, ugettext_noop, ugettext as _
|
from django.db import models
|
||||||
|
from django.utils.translation import ugettext as _
|
||||||
|
from django.utils.translation import ugettext_lazy, ugettext_noop
|
||||||
from mptt.models import MPTTModel, TreeForeignKey
|
from mptt.models import MPTTModel, TreeForeignKey
|
||||||
|
|
||||||
from openslides.utils.exceptions import OpenSlidesError
|
from openslides.projector.api import (get_active_slide, update_projector,
|
||||||
from openslides.config.api import config
|
update_projector_overlay)
|
||||||
from openslides.utils.person.models import PersonField
|
|
||||||
from openslides.projector.api import (
|
|
||||||
update_projector, get_active_slide, update_projector_overlay)
|
|
||||||
from openslides.projector.models import SlideMixin
|
from openslides.projector.models import SlideMixin
|
||||||
|
from openslides.utils.exceptions import OpenSlidesError
|
||||||
|
from openslides.utils.person.models import PersonField
|
||||||
|
|
||||||
|
|
||||||
class Item(SlideMixin, MPTTModel):
|
class Item(SlideMixin, MPTTModel):
|
||||||
|
@ -12,22 +12,22 @@
|
|||||||
|
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
||||||
|
from django import forms
|
||||||
from django.contrib.contenttypes.models import ContentType
|
from django.contrib.contenttypes.models import ContentType
|
||||||
|
from django.core.exceptions import ValidationError
|
||||||
from django.db.models.signals import pre_delete
|
from django.db.models.signals import pre_delete
|
||||||
from django.dispatch import receiver
|
from django.dispatch import receiver
|
||||||
from django import forms
|
|
||||||
from django.utils.translation import ugettext_lazy, ugettext_noop, ugettext as _
|
|
||||||
from django.template.loader import render_to_string
|
from django.template.loader import render_to_string
|
||||||
from django.core.exceptions import ValidationError
|
from django.utils.translation import ugettext as _
|
||||||
|
from django.utils.translation import ugettext_lazy, ugettext_noop
|
||||||
|
|
||||||
|
from openslides.config.api import config, ConfigPage, ConfigVariable
|
||||||
from openslides.config.signals import config_signal
|
from openslides.config.signals import config_signal
|
||||||
from openslides.config.api import config, ConfigVariable, ConfigPage
|
|
||||||
|
|
||||||
from openslides.projector.signals import projector_overlays
|
|
||||||
from openslides.projector.projector import Overlay
|
|
||||||
from openslides.projector.api import get_active_slide
|
from openslides.projector.api import get_active_slide
|
||||||
|
from openslides.projector.projector import Overlay
|
||||||
|
from openslides.projector.signals import projector_overlays
|
||||||
|
|
||||||
from .models import Speaker, Item
|
from .models import Item
|
||||||
|
|
||||||
|
|
||||||
def validate_start_time(value):
|
def validate_start_time(value):
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
from django.template.loader import render_to_string
|
from django.template.loader import render_to_string
|
||||||
|
|
||||||
from openslides.config.api import config
|
from openslides.config.api import config
|
||||||
from openslides.projector.api import register_slide, get_projector_content
|
from openslides.projector.api import get_projector_content, register_slide
|
||||||
|
|
||||||
from .models import Item
|
from .models import Item
|
||||||
|
|
||||||
|
@ -10,114 +10,92 @@
|
|||||||
:license: GNU GPL, see LICENSE for more details.
|
:license: GNU GPL, see LICENSE for more details.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from django.conf.urls import url, patterns
|
from django.conf.urls import patterns, url
|
||||||
from openslides.agenda.views import (
|
|
||||||
Overview, AgendaItemView, SetClosed, ItemUpdate, SpeakerSpeakView, SpeakerEndSpeachView,
|
from . import views
|
||||||
ItemCreate, ItemDelete, AgendaPDF, SpeakerAppendView, SpeakerDeleteView,
|
|
||||||
SpeakerListCloseView, SpeakerChangeOrderView, CurrentListOfSpeakersView)
|
|
||||||
|
|
||||||
urlpatterns = patterns(
|
urlpatterns = patterns(
|
||||||
'',
|
'',
|
||||||
url(r'^$',
|
url(r'^$',
|
||||||
Overview.as_view(),
|
views.Overview.as_view(),
|
||||||
name='item_overview',
|
name='item_overview'),
|
||||||
),
|
|
||||||
|
|
||||||
url(r'^(?P<pk>\d+)/$',
|
url(r'^(?P<pk>\d+)/$',
|
||||||
AgendaItemView.as_view(),
|
views.AgendaItemView.as_view(),
|
||||||
name='item_view',
|
name='item_view'),
|
||||||
),
|
|
||||||
|
|
||||||
url(r'^(?P<pk>\d+)/close/$',
|
url(r'^(?P<pk>\d+)/close/$',
|
||||||
SetClosed.as_view(),
|
views.SetClosed.as_view(),
|
||||||
{'closed': True},
|
{'closed': True},
|
||||||
name='item_close',
|
name='item_close'),
|
||||||
),
|
|
||||||
|
|
||||||
url(r'^(?P<pk>\d+)/open/$',
|
url(r'^(?P<pk>\d+)/open/$',
|
||||||
SetClosed.as_view(),
|
views.SetClosed.as_view(),
|
||||||
{'closed': False},
|
{'closed': False},
|
||||||
name='item_open',
|
name='item_open'),
|
||||||
),
|
|
||||||
|
|
||||||
url(r'^(?P<pk>\d+)/edit/$',
|
url(r'^(?P<pk>\d+)/edit/$',
|
||||||
ItemUpdate.as_view(),
|
views.ItemUpdate.as_view(),
|
||||||
name='item_edit',
|
name='item_edit'),
|
||||||
),
|
|
||||||
|
|
||||||
url(r'^new/$',
|
url(r'^new/$',
|
||||||
ItemCreate.as_view(),
|
views.ItemCreate.as_view(),
|
||||||
name='item_new',
|
name='item_new'),
|
||||||
),
|
|
||||||
|
|
||||||
url(r'^(?P<pk>\d+)/del/$',
|
url(r'^(?P<pk>\d+)/del/$',
|
||||||
ItemDelete.as_view(),
|
views.ItemDelete.as_view(),
|
||||||
name='item_delete',
|
name='item_delete'),
|
||||||
),
|
|
||||||
|
|
||||||
url(r'^print/$',
|
url(r'^print/$',
|
||||||
AgendaPDF.as_view(),
|
views.AgendaPDF.as_view(),
|
||||||
name='print_agenda',
|
name='print_agenda'),
|
||||||
),
|
|
||||||
|
|
||||||
# List of speakers
|
# List of speakers
|
||||||
url(r'^(?P<pk>\d+)/speaker/$',
|
url(r'^(?P<pk>\d+)/speaker/$',
|
||||||
SpeakerAppendView.as_view(),
|
views.SpeakerAppendView.as_view(),
|
||||||
name='agenda_speaker_append',
|
name='agenda_speaker_append'),
|
||||||
),
|
|
||||||
|
|
||||||
url(r'^(?P<pk>\d+)/speaker/close/$',
|
url(r'^(?P<pk>\d+)/speaker/close/$',
|
||||||
SpeakerListCloseView.as_view(),
|
views.SpeakerListCloseView.as_view(),
|
||||||
name='agenda_speaker_close',
|
name='agenda_speaker_close'),
|
||||||
),
|
|
||||||
|
|
||||||
url(r'^(?P<pk>\d+)/speaker/reopen/$',
|
url(r'^(?P<pk>\d+)/speaker/reopen/$',
|
||||||
SpeakerListCloseView.as_view(reopen=True),
|
views.SpeakerListCloseView.as_view(reopen=True),
|
||||||
name='agenda_speaker_reopen',
|
name='agenda_speaker_reopen'),
|
||||||
),
|
|
||||||
|
|
||||||
url(r'^(?P<pk>\d+)/speaker/del/$',
|
url(r'^(?P<pk>\d+)/speaker/del/$',
|
||||||
SpeakerDeleteView.as_view(),
|
views.SpeakerDeleteView.as_view(),
|
||||||
name='agenda_speaker_delete',
|
name='agenda_speaker_delete'),
|
||||||
),
|
|
||||||
|
|
||||||
url(r'^(?P<pk>\d+)/speaker/(?P<speaker>\d+)/del/$',
|
url(r'^(?P<pk>\d+)/speaker/(?P<speaker>\d+)/del/$',
|
||||||
SpeakerDeleteView.as_view(),
|
views.SpeakerDeleteView.as_view(),
|
||||||
name='agenda_speaker_delete',
|
name='agenda_speaker_delete'),
|
||||||
),
|
|
||||||
|
|
||||||
url(r'^(?P<pk>\d+)/speaker/(?P<person_id>[^/]+)/speak/$',
|
url(r'^(?P<pk>\d+)/speaker/(?P<person_id>[^/]+)/speak/$',
|
||||||
SpeakerSpeakView.as_view(),
|
views.SpeakerSpeakView.as_view(),
|
||||||
name='agenda_speaker_speak',
|
name='agenda_speaker_speak'),
|
||||||
),
|
|
||||||
|
|
||||||
url(r'^(?P<pk>\d+)/speaker/end_speach/$',
|
url(r'^(?P<pk>\d+)/speaker/end_speach/$',
|
||||||
SpeakerEndSpeachView.as_view(),
|
views.SpeakerEndSpeachView.as_view(),
|
||||||
name='agenda_speaker_end_speach',
|
name='agenda_speaker_end_speach'),
|
||||||
),
|
|
||||||
|
|
||||||
url(r'^(?P<pk>\d+)/speaker/change_order/$',
|
url(r'^(?P<pk>\d+)/speaker/change_order/$',
|
||||||
SpeakerChangeOrderView.as_view(),
|
views.SpeakerChangeOrderView.as_view(),
|
||||||
name='agenda_speaker_change_order',
|
name='agenda_speaker_change_order'),
|
||||||
),
|
|
||||||
|
|
||||||
url(r'^list_of_speakers/$',
|
url(r'^list_of_speakers/$',
|
||||||
CurrentListOfSpeakersView.as_view(),
|
views.CurrentListOfSpeakersView.as_view(),
|
||||||
name='agenda_current_list_of_speakers',
|
name='agenda_current_list_of_speakers'),
|
||||||
),
|
|
||||||
|
|
||||||
url(r'^list_of_speakers/add/$',
|
url(r'^list_of_speakers/add/$',
|
||||||
CurrentListOfSpeakersView.as_view(set_speaker=True),
|
views.CurrentListOfSpeakersView.as_view(set_speaker=True),
|
||||||
name='agenda_add_to_current_list_of_speakers',
|
name='agenda_add_to_current_list_of_speakers'),
|
||||||
),
|
|
||||||
|
|
||||||
url(r'^list_of_speakers/next/$',
|
url(r'^list_of_speakers/next/$',
|
||||||
CurrentListOfSpeakersView.as_view(next_speaker=True),
|
views.CurrentListOfSpeakersView.as_view(next_speaker=True),
|
||||||
name='agenda_next_on_current_list_of_speakers',
|
name='agenda_next_on_current_list_of_speakers'),
|
||||||
),
|
|
||||||
|
|
||||||
url(r'^list_of_speakers/end_speach/$',
|
url(r'^list_of_speakers/end_speach/$',
|
||||||
CurrentListOfSpeakersView.as_view(end_speach=True),
|
views.CurrentListOfSpeakersView.as_view(end_speach=True),
|
||||||
name='agenda_end_speach_on_current_list_of_speakers',
|
name='agenda_end_speach_on_current_list_of_speakers')
|
||||||
)
|
|
||||||
)
|
)
|
||||||
|
@ -11,28 +11,29 @@
|
|||||||
"""
|
"""
|
||||||
# TODO: Rename all views and template names
|
# TODO: Rename all views and template names
|
||||||
|
|
||||||
from reportlab.platypus import Paragraph
|
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
|
|
||||||
from django.core.urlresolvers import reverse
|
|
||||||
from django.contrib import messages
|
from django.contrib import messages
|
||||||
|
from django.core.urlresolvers import reverse
|
||||||
from django.db import transaction
|
from django.db import transaction
|
||||||
from django.db.models import Model
|
from django.db.models import Model
|
||||||
from django.utils.translation import ugettext as _, ugettext_lazy
|
from django.utils.translation import ugettext as _
|
||||||
from django.views.generic.detail import SingleObjectMixin
|
from django.utils.translation import ugettext_lazy
|
||||||
|
from reportlab.platypus import Paragraph
|
||||||
|
|
||||||
from openslides.config.api import config
|
from openslides.config.api import config
|
||||||
from openslides.utils.pdf import stylesheet
|
|
||||||
from openslides.utils.exceptions import OpenSlidesError
|
|
||||||
from openslides.utils.views import (
|
|
||||||
TemplateView, RedirectView, UpdateView, CreateView, DeleteView, PDFView,
|
|
||||||
DetailView, FormView, SingleObjectMixin)
|
|
||||||
from openslides.utils.template import Tab
|
|
||||||
from openslides.utils.utils import html_strong
|
|
||||||
from openslides.projector.api import get_active_slide, update_projector
|
from openslides.projector.api import get_active_slide, update_projector
|
||||||
from openslides.projector.projector import Widget
|
from openslides.projector.projector import Widget
|
||||||
|
from openslides.utils.exceptions import OpenSlidesError
|
||||||
|
from openslides.utils.pdf import stylesheet
|
||||||
|
from openslides.utils.template import Tab
|
||||||
|
from openslides.utils.utils import html_strong
|
||||||
|
from openslides.utils.views import (CreateView, DeleteView, FormView, PDFView,
|
||||||
|
RedirectView, SingleObjectMixin,
|
||||||
|
TemplateView, UpdateView)
|
||||||
|
|
||||||
|
from .forms import AppendSpeakerForm, ItemForm, ItemOrderForm, RelatedItemForm
|
||||||
from .models import Item, Speaker
|
from .models import Item, Speaker
|
||||||
from .forms import ItemOrderForm, ItemForm, AppendSpeakerForm, RelatedItemForm
|
|
||||||
|
|
||||||
|
|
||||||
class Overview(TemplateView):
|
class Overview(TemplateView):
|
||||||
@ -106,6 +107,7 @@ class Overview(TemplateView):
|
|||||||
messages.error(
|
messages.error(
|
||||||
request,
|
request,
|
||||||
_('You are not authorized to manage the agenda.'))
|
_('You are not authorized to manage the agenda.'))
|
||||||
|
context = self.get_context_data(**kwargs)
|
||||||
return self.render_to_response(context)
|
return self.render_to_response(context)
|
||||||
|
|
||||||
transaction.commit()
|
transaction.commit()
|
||||||
|
@ -10,5 +10,4 @@
|
|||||||
:license: GNU GPL, see LICENSE for more details.
|
:license: GNU GPL, see LICENSE for more details.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from . import signals
|
from . import signals, slides # noqa
|
||||||
from . import slides
|
|
||||||
|
@ -16,7 +16,7 @@ from django.utils.translation import ugettext_lazy
|
|||||||
from openslides.utils.forms import CssClassMixin
|
from openslides.utils.forms import CssClassMixin
|
||||||
from openslides.utils.person import PersonFormField
|
from openslides.utils.person import PersonFormField
|
||||||
|
|
||||||
from openslides.assignment.models import Assignment
|
from .models import Assignment
|
||||||
|
|
||||||
|
|
||||||
class AssignmentForm(forms.ModelForm, CssClassMixin):
|
class AssignmentForm(forms.ModelForm, CssClassMixin):
|
||||||
|
@ -12,15 +12,17 @@
|
|||||||
|
|
||||||
from django.core.urlresolvers import reverse
|
from django.core.urlresolvers import reverse
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.utils.translation import ugettext as _, ugettext_lazy, ugettext_noop
|
|
||||||
from django.utils.datastructures import SortedDict
|
from django.utils.datastructures import SortedDict
|
||||||
|
from django.utils.translation import ugettext as _
|
||||||
|
from django.utils.translation import ugettext_lazy, ugettext_noop
|
||||||
|
|
||||||
|
from openslides.config.api import config
|
||||||
|
from openslides.poll.models import (BaseOption, BasePoll, BaseVote,
|
||||||
|
CountInvalid, CountVotesCast,
|
||||||
|
PublishPollMixin)
|
||||||
|
from openslides.projector.models import RelatedModelMixin, SlideMixin
|
||||||
from openslides.utils.person import PersonField
|
from openslides.utils.person import PersonField
|
||||||
from openslides.utils.utils import html_strong
|
from openslides.utils.utils import html_strong
|
||||||
from openslides.config.api import config
|
|
||||||
from openslides.projector.models import SlideMixin, RelatedModelMixin
|
|
||||||
from openslides.poll.models import (
|
|
||||||
BasePoll, CountInvalid, CountVotesCast, BaseOption, PublishPollMixin, BaseVote)
|
|
||||||
|
|
||||||
|
|
||||||
class AssignmentCandidate(RelatedModelMixin, models.Model):
|
class AssignmentCandidate(RelatedModelMixin, models.Model):
|
||||||
|
@ -10,12 +10,13 @@
|
|||||||
:license: GNU GPL, see LICENSE for more details.
|
:license: GNU GPL, see LICENSE for more details.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from django.dispatch import receiver
|
|
||||||
from django import forms
|
from django import forms
|
||||||
from django.utils.translation import ugettext as _, ugettext_lazy, ugettext_noop
|
from django.dispatch import receiver
|
||||||
|
from django.utils.translation import ugettext as _
|
||||||
|
from django.utils.translation import ugettext_lazy, ugettext_noop
|
||||||
|
|
||||||
|
from openslides.config.api import ConfigPage, ConfigVariable
|
||||||
from openslides.config.signals import config_signal
|
from openslides.config.signals import config_signal
|
||||||
from openslides.config.api import ConfigVariable, ConfigPage
|
|
||||||
|
|
||||||
|
|
||||||
@receiver(config_signal, dispatch_uid='setup_assignment_config_page')
|
@receiver(config_signal, dispatch_uid='setup_assignment_config_page')
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
from openslides.projector.api import register_slide_model
|
from openslides.projector.api import register_slide_model
|
||||||
|
|
||||||
from .models import Assignment
|
from .models import Assignment
|
||||||
|
|
||||||
|
|
||||||
register_slide_model(Assignment, 'assignment/slide.html')
|
register_slide_model(Assignment, 'assignment/slide.html')
|
||||||
|
@ -10,111 +10,89 @@
|
|||||||
:license: GNU GPL, see LICENSE for more details.
|
:license: GNU GPL, see LICENSE for more details.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from django.conf.urls import url, patterns
|
from django.conf.urls import patterns, url
|
||||||
|
|
||||||
from openslides.assignment.views import (AssignmentListView, AssignmentDetail,
|
from . import views
|
||||||
AssignmentCreateView, AssignmentUpdateView, AssignmentDeleteView,
|
|
||||||
AssignmentSetStatusView, AssignmentRunView, AssignmentRunDeleteView,
|
|
||||||
AssignmentRunOtherDeleteView, PollCreateView, PollUpdateView, AssignmentPDF,
|
|
||||||
AssignmentPollPDF, AssignmentPollDeleteView, SetPublishStatusView,
|
|
||||||
SetElectedView, CreateRelatedAgendaItemView)
|
|
||||||
|
|
||||||
urlpatterns = patterns('openslides.assignment.views',
|
urlpatterns = patterns(
|
||||||
|
'',
|
||||||
url(r'^$',
|
url(r'^$',
|
||||||
AssignmentListView.as_view(),
|
views.AssignmentListView.as_view(),
|
||||||
name='assignment_list',
|
name='assignment_list'),
|
||||||
),
|
|
||||||
|
|
||||||
url(r'^(?P<pk>\d+)/$',
|
url(r'^(?P<pk>\d+)/$',
|
||||||
AssignmentDetail.as_view(),
|
views.AssignmentDetail.as_view(),
|
||||||
name='assignment_detail'),
|
name='assignment_detail'),
|
||||||
|
|
||||||
url(r'^new/$',
|
url(r'^new/$',
|
||||||
AssignmentCreateView.as_view(),
|
views.AssignmentCreateView.as_view(),
|
||||||
name='assignment_create',
|
name='assignment_create'),
|
||||||
),
|
|
||||||
|
|
||||||
url(r'^(?P<pk>\d+)/edit/$',
|
url(r'^(?P<pk>\d+)/edit/$',
|
||||||
AssignmentUpdateView.as_view(),
|
views.AssignmentUpdateView.as_view(),
|
||||||
name='assignment_update',
|
name='assignment_update'),
|
||||||
),
|
|
||||||
|
|
||||||
url(r'^(?P<pk>\d+)/del/$',
|
url(r'^(?P<pk>\d+)/del/$',
|
||||||
AssignmentDeleteView.as_view(),
|
views.AssignmentDeleteView.as_view(),
|
||||||
name='assignment_delete',
|
name='assignment_delete'),
|
||||||
),
|
|
||||||
|
|
||||||
url(r'^(?P<pk>\d+)/setstatus/(?P<status>[a-z]{3})/$',
|
url(r'^(?P<pk>\d+)/setstatus/(?P<status>[a-z]{3})/$',
|
||||||
AssignmentSetStatusView.as_view(),
|
views.AssignmentSetStatusView.as_view(),
|
||||||
name='assignment_set_status',
|
name='assignment_set_status'),
|
||||||
),
|
|
||||||
|
|
||||||
url(r'^(?P<pk>\d+)/run/$',
|
url(r'^(?P<pk>\d+)/run/$',
|
||||||
AssignmentRunView.as_view(),
|
views.AssignmentRunView.as_view(),
|
||||||
name='assignment_run',
|
name='assignment_run'),
|
||||||
),
|
|
||||||
|
|
||||||
url(r'^(?P<pk>\d+)/delrun/$',
|
url(r'^(?P<pk>\d+)/delrun/$',
|
||||||
AssignmentRunDeleteView.as_view(),
|
views.AssignmentRunDeleteView.as_view(),
|
||||||
name='assignment_delrun',
|
name='assignment_delrun'),
|
||||||
),
|
|
||||||
|
|
||||||
url(r'^(?P<pk>\d+)/delother/(?P<user_id>[^/]+)/$',
|
url(r'^(?P<pk>\d+)/delother/(?P<user_id>[^/]+)/$',
|
||||||
AssignmentRunOtherDeleteView.as_view(),
|
views.AssignmentRunOtherDeleteView.as_view(),
|
||||||
name='assignment_delother',
|
name='assignment_delother'),
|
||||||
),
|
|
||||||
|
|
||||||
url(r'^poll/(?P<poll_id>\d+)/print/$',
|
url(r'^poll/(?P<poll_id>\d+)/print/$',
|
||||||
AssignmentPollPDF.as_view(),
|
views.AssignmentPollPDF.as_view(),
|
||||||
name='assignment_poll_pdf',
|
name='assignment_poll_pdf'),
|
||||||
),
|
|
||||||
|
|
||||||
url(r'^(?P<pk>\d+)/agenda/$',
|
url(r'^(?P<pk>\d+)/agenda/$',
|
||||||
CreateRelatedAgendaItemView.as_view(),
|
views.CreateRelatedAgendaItemView.as_view(),
|
||||||
name='assignment_create_agenda',
|
name='assignment_create_agenda'),
|
||||||
),
|
|
||||||
|
|
||||||
url(r'^print/$',
|
url(r'^print/$',
|
||||||
AssignmentPDF.as_view(),
|
views.AssignmentPDF.as_view(),
|
||||||
name='assignment_list_pdf',
|
name='assignment_list_pdf'),
|
||||||
),
|
|
||||||
|
|
||||||
url(r'^(?P<pk>\d+)/print/$',
|
url(r'^(?P<pk>\d+)/print/$',
|
||||||
AssignmentPDF.as_view(),
|
views.AssignmentPDF.as_view(),
|
||||||
name='assignment_pdf',
|
name='assignment_pdf'),
|
||||||
),
|
|
||||||
|
|
||||||
url(r'^(?P<pk>\d+)/gen_poll/$',
|
url(r'^(?P<pk>\d+)/gen_poll/$',
|
||||||
PollCreateView.as_view(),
|
views.PollCreateView.as_view(),
|
||||||
name='assignment_poll_create',
|
name='assignment_poll_create'),
|
||||||
),
|
|
||||||
|
|
||||||
url(r'^poll/(?P<poll_id>\d+)/$',
|
url(r'^poll/(?P<poll_id>\d+)/$',
|
||||||
PollUpdateView.as_view(),
|
views.PollUpdateView.as_view(),
|
||||||
name='assignment_poll_view',
|
name='assignment_poll_view'),
|
||||||
),
|
|
||||||
|
|
||||||
url(r'^poll/(?P<pk>\d+)/del/$',
|
url(r'^poll/(?P<pk>\d+)/del/$',
|
||||||
AssignmentPollDeleteView.as_view(),
|
views.AssignmentPollDeleteView.as_view(),
|
||||||
name='assignment_poll_delete',
|
name='assignment_poll_delete'),
|
||||||
),
|
|
||||||
|
|
||||||
# TODO: use seperate urls to publish and unpublish the poll
|
# TODO: use seperate urls to publish and unpublish the poll
|
||||||
# see assignment_user_elected
|
# see assignment_user_elected
|
||||||
url(r'^poll/(?P<pk>\d+)/pub/$',
|
url(r'^poll/(?P<pk>\d+)/pub/$',
|
||||||
SetPublishStatusView.as_view(),
|
views.SetPublishStatusView.as_view(),
|
||||||
name='assignment_poll_publish_status',
|
name='assignment_poll_publish_status'),
|
||||||
),
|
|
||||||
|
|
||||||
url(r'^(?P<pk>\d+)/elected/(?P<user_id>[^/]+)/$',
|
url(r'^(?P<pk>\d+)/elected/(?P<user_id>[^/]+)/$',
|
||||||
SetElectedView.as_view(),
|
views.SetElectedView.as_view(),
|
||||||
{'elected': True},
|
{'elected': True},
|
||||||
name='assignment_user_elected',
|
name='assignment_user_elected'),
|
||||||
),
|
|
||||||
|
|
||||||
url(r'^(?P<pk>\d+)/notelected/(?P<user_id>[^/]+)/$',
|
url(r'^(?P<pk>\d+)/notelected/(?P<user_id>[^/]+)/$',
|
||||||
SetElectedView.as_view(),
|
views.SetElectedView.as_view(),
|
||||||
{'elected': False},
|
{'elected': False},
|
||||||
name='assignment_user_not_elected',
|
name='assignment_user_not_elected')
|
||||||
),
|
|
||||||
)
|
)
|
||||||
|
@ -12,32 +12,33 @@
|
|||||||
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
from reportlab.lib import colors
|
|
||||||
from reportlab.platypus import (
|
|
||||||
SimpleDocTemplate, PageBreak, Paragraph, Spacer, Table, TableStyle)
|
|
||||||
from reportlab.lib.units import cm
|
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.core.urlresolvers import reverse
|
|
||||||
from django.contrib import messages
|
from django.contrib import messages
|
||||||
|
from django.core.urlresolvers import reverse
|
||||||
from django.shortcuts import redirect
|
from django.shortcuts import redirect
|
||||||
from django.utils.translation import ungettext, ugettext as _
|
from django.utils.translation import ugettext as _
|
||||||
|
from django.utils.translation import ungettext
|
||||||
|
from reportlab.lib import colors
|
||||||
|
from reportlab.lib.units import cm
|
||||||
|
from reportlab.platypus import (PageBreak, Paragraph, SimpleDocTemplate, Spacer,
|
||||||
|
Table, TableStyle)
|
||||||
|
|
||||||
from openslides.utils.pdf import stylesheet
|
|
||||||
from openslides.utils.template import Tab
|
|
||||||
|
|
||||||
from openslides.utils.views import (
|
|
||||||
CreateView, DeleteView, RedirectView, UpdateView, ListView, PDFView,
|
|
||||||
DetailView, View, PermissionMixin, SingleObjectMixin, QuestionView)
|
|
||||||
from openslides.utils.person import get_person
|
|
||||||
from openslides.utils.utils import html_strong
|
|
||||||
from openslides.config.api import config
|
|
||||||
from openslides.participant.models import User, Group
|
|
||||||
from openslides.projector.projector import Widget
|
|
||||||
from openslides.poll.views import PollFormView
|
|
||||||
from openslides.agenda.views import CreateRelatedAgendaItemView as _CreateRelatedAgendaItemView
|
from openslides.agenda.views import CreateRelatedAgendaItemView as _CreateRelatedAgendaItemView
|
||||||
from openslides.assignment.models import Assignment, AssignmentPoll
|
from openslides.config.api import config
|
||||||
from openslides.assignment.forms import AssignmentForm, AssignmentRunForm
|
from openslides.participant.models import Group, User
|
||||||
|
from openslides.poll.views import PollFormView
|
||||||
|
from openslides.projector.projector import Widget
|
||||||
|
from openslides.utils.pdf import stylesheet
|
||||||
|
from openslides.utils.person import get_person
|
||||||
|
from openslides.utils.template import Tab
|
||||||
|
from openslides.utils.utils import html_strong
|
||||||
|
from openslides.utils.views import (CreateView, DeleteView, DetailView,
|
||||||
|
ListView, PDFView, PermissionMixin,
|
||||||
|
QuestionView, RedirectView,
|
||||||
|
SingleObjectMixin, UpdateView, View)
|
||||||
|
|
||||||
|
from .forms import AssignmentForm, AssignmentRunForm
|
||||||
|
from .models import Assignment, AssignmentPoll
|
||||||
|
|
||||||
|
|
||||||
class AssignmentListView(ListView):
|
class AssignmentListView(ListView):
|
||||||
|
@ -10,8 +10,8 @@
|
|||||||
:license: GNU GPL, see LICENSE for more details.
|
:license: GNU GPL, see LICENSE for more details.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from .models import ConfigStore
|
|
||||||
from .exceptions import ConfigError, ConfigNotFound
|
from .exceptions import ConfigError, ConfigNotFound
|
||||||
|
from .models import ConfigStore
|
||||||
from .signals import config_signal
|
from .signals import config_signal
|
||||||
|
|
||||||
|
|
||||||
|
@ -12,6 +12,5 @@
|
|||||||
|
|
||||||
from django.dispatch import Signal
|
from django.dispatch import Signal
|
||||||
|
|
||||||
|
|
||||||
config_signal = Signal(providing_args=[])
|
config_signal = Signal(providing_args=[])
|
||||||
"""Signal to get all config tabs from all apps."""
|
"""Signal to get all config tabs from all apps."""
|
||||||
|
@ -13,15 +13,15 @@
|
|||||||
from django.conf.urls import patterns, url
|
from django.conf.urls import patterns, url
|
||||||
|
|
||||||
from openslides.utils.views import RedirectView
|
from openslides.utils.views import RedirectView
|
||||||
|
|
||||||
from .signals import config_signal
|
from .signals import config_signal
|
||||||
from .views import ConfigView
|
from .views import ConfigView
|
||||||
|
|
||||||
|
urlpatterns = patterns(
|
||||||
urlpatterns = patterns('',
|
'',
|
||||||
url(r'^$',
|
url(r'^$',
|
||||||
RedirectView.as_view(url_name='config_general'),
|
RedirectView.as_view(url_name='config_general'),
|
||||||
name='config_first_config_page',
|
name='config_first_config_page')
|
||||||
),
|
|
||||||
)
|
)
|
||||||
|
|
||||||
for receiver, config_page in config_signal.send(sender='config_urls'):
|
for receiver, config_page in config_signal.send(sender='config_urls'):
|
||||||
|
@ -11,12 +11,13 @@
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
from django import forms
|
from django import forms
|
||||||
from django.core.urlresolvers import reverse
|
|
||||||
from django.contrib import messages
|
from django.contrib import messages
|
||||||
from django.utils.translation import ugettext as _, ugettext_lazy
|
from django.core.urlresolvers import reverse
|
||||||
|
from django.utils.translation import ugettext as _
|
||||||
|
|
||||||
from openslides.utils.views import FormView
|
|
||||||
from openslides.utils.template import Tab
|
from openslides.utils.template import Tab
|
||||||
|
from openslides.utils.views import FormView
|
||||||
|
|
||||||
from .api import config
|
from .api import config
|
||||||
from .signals import config_signal
|
from .signals import config_signal
|
||||||
|
|
||||||
|
@ -10,4 +10,4 @@
|
|||||||
:license: GNU GPL, see LICENSE for more details.
|
:license: GNU GPL, see LICENSE for more details.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from . import signals
|
from . import signals # noqa
|
||||||
|
@ -4,7 +4,7 @@ from optparse import make_option
|
|||||||
import django.conf
|
import django.conf
|
||||||
import django.db
|
import django.db
|
||||||
import django.db.transaction
|
import django.db.transaction
|
||||||
from django.core.management.base import NoArgsCommand, CommandError
|
from django.core.management.base import CommandError, NoArgsCommand
|
||||||
|
|
||||||
|
|
||||||
class Command(NoArgsCommand):
|
class Command(NoArgsCommand):
|
||||||
|
@ -10,13 +10,13 @@
|
|||||||
:license: GNU GPL, see LICENSE for more details.
|
:license: GNU GPL, see LICENSE for more details.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from django.dispatch import Signal, receiver
|
|
||||||
from django import forms
|
from django import forms
|
||||||
from django.utils.translation import ugettext as _, ugettext_lazy, ugettext_noop
|
from django.dispatch import receiver, Signal
|
||||||
|
from django.utils.translation import ugettext as _
|
||||||
|
from django.utils.translation import ugettext_lazy, ugettext_noop
|
||||||
|
|
||||||
|
from openslides.config.api import ConfigGroup, ConfigGroupedPage, ConfigVariable
|
||||||
from openslides.config.signals import config_signal
|
from openslides.config.signals import config_signal
|
||||||
from openslides.config.api import ConfigVariable, ConfigGroup, ConfigGroupedPage
|
|
||||||
|
|
||||||
|
|
||||||
post_database_setup = Signal()
|
post_database_setup = Signal()
|
||||||
|
|
||||||
|
@ -14,18 +14,19 @@ import warnings
|
|||||||
|
|
||||||
from django import template
|
from django import template
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import ugettext as _
|
||||||
from openslides.config.api import config
|
|
||||||
|
|
||||||
|
from openslides.config.api import config
|
||||||
|
|
||||||
register = template.Library()
|
register = template.Library()
|
||||||
|
|
||||||
|
|
||||||
|
# TODO: remove the tag get_config
|
||||||
@register.simple_tag
|
@register.simple_tag
|
||||||
def get_config(key):
|
def get_config(key):
|
||||||
return config[key]
|
return config[key]
|
||||||
|
|
||||||
|
|
||||||
@register.filter
|
@register.filter # noqa
|
||||||
def get_config(key):
|
def get_config(key):
|
||||||
return config[key]
|
return config[key]
|
||||||
|
|
||||||
|
@ -13,17 +13,17 @@
|
|||||||
from django.conf.urls import patterns, url
|
from django.conf.urls import patterns, url
|
||||||
|
|
||||||
from openslides.utils.views import RedirectView
|
from openslides.utils.views import RedirectView
|
||||||
from .views import VersionView
|
|
||||||
|
|
||||||
|
from . import views
|
||||||
|
|
||||||
urlpatterns = patterns('',
|
urlpatterns = patterns(
|
||||||
|
'',
|
||||||
# Redirect to dashboard URL
|
# Redirect to dashboard URL
|
||||||
url(r'^$',
|
url(r'^$',
|
||||||
RedirectView.as_view(url='projector/dashboard/'),
|
RedirectView.as_view(url='projector/dashboard/'),
|
||||||
name='home',),
|
name='home',),
|
||||||
|
|
||||||
url(r'^version/$',
|
url(r'^version/$',
|
||||||
VersionView.as_view(),
|
views.VersionView.as_view(),
|
||||||
name='core_version',),
|
name='core_version',),
|
||||||
)
|
)
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.utils.importlib import import_module
|
from django.utils.importlib import import_module
|
||||||
|
|
||||||
from openslides import get_version, get_git_commit_id, RELEASE
|
from openslides import get_git_commit_id, get_version, RELEASE
|
||||||
from openslides.utils.views import TemplateView
|
from openslides.utils.views import TemplateView
|
||||||
|
|
||||||
|
|
||||||
|
@ -11,8 +11,6 @@
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
|
||||||
|
|
||||||
from openslides.main import fs2unicode
|
from openslides.main import fs2unicode
|
||||||
|
|
||||||
|
|
||||||
|
@ -34,6 +34,7 @@ CONFIG_TEMPLATE = """#!/usr/bin/env python
|
|||||||
import openslides.main
|
import openslides.main
|
||||||
from openslides.global_settings import *
|
from openslides.global_settings import *
|
||||||
|
|
||||||
|
|
||||||
# Use 'DEBUG = True' to get more details for server errors
|
# Use 'DEBUG = True' to get more details for server errors
|
||||||
# (Default for releases: 'False')
|
# (Default for releases: 'False')
|
||||||
DEBUG = False
|
DEBUG = False
|
||||||
|
@ -10,31 +10,25 @@
|
|||||||
:license: GNU GPL, see LICENSE for more details.
|
:license: GNU GPL, see LICENSE for more details.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from django.conf.urls import url, patterns
|
from django.conf.urls import patterns, url
|
||||||
|
|
||||||
from .models import Mediafile
|
from . import views
|
||||||
from .views import (MediafileListView, MediafileCreateView,
|
|
||||||
MediafileUpdateView, MediafileDeleteView)
|
|
||||||
|
|
||||||
|
urlpatterns = patterns(
|
||||||
urlpatterns = patterns('',
|
'',
|
||||||
url(r'^$',
|
url(r'^$',
|
||||||
MediafileListView.as_view(),
|
views.MediafileListView.as_view(),
|
||||||
name='mediafile_list',
|
name='mediafile_list'),
|
||||||
),
|
|
||||||
|
|
||||||
url(r'^new/$',
|
url(r'^new/$',
|
||||||
MediafileCreateView.as_view(),
|
views.MediafileCreateView.as_view(),
|
||||||
name='mediafile_create',
|
name='mediafile_create'),
|
||||||
),
|
|
||||||
|
|
||||||
url(r'^(?P<pk>\d+)/edit/$',
|
url(r'^(?P<pk>\d+)/edit/$',
|
||||||
MediafileUpdateView.as_view(),
|
views.MediafileUpdateView.as_view(),
|
||||||
name='mediafile_update',
|
name='mediafile_update'),
|
||||||
),
|
|
||||||
|
|
||||||
url(r'^(?P<pk>\d+)/del/$',
|
url(r'^(?P<pk>\d+)/del/$',
|
||||||
MediafileDeleteView.as_view(),
|
views.MediafileDeleteView.as_view(),
|
||||||
name='mediafile_delete',
|
name='mediafile_delete'),
|
||||||
),
|
|
||||||
)
|
)
|
||||||
|
@ -14,10 +14,10 @@ from django.core.urlresolvers import reverse
|
|||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import ugettext as _
|
||||||
|
|
||||||
from openslides.utils.template import Tab
|
from openslides.utils.template import Tab
|
||||||
from openslides.utils.views import ListView, CreateView, UpdateView, DeleteView
|
from openslides.utils.views import CreateView, DeleteView, ListView, UpdateView
|
||||||
|
|
||||||
from .models import Mediafile
|
|
||||||
from .forms import MediafileNormalUserCreateForm, MediafileUpdateForm
|
from .forms import MediafileNormalUserCreateForm, MediafileUpdateForm
|
||||||
|
from .models import Mediafile
|
||||||
|
|
||||||
|
|
||||||
class MediafileListView(ListView):
|
class MediafileListView(ListView):
|
||||||
|
@ -11,4 +11,4 @@
|
|||||||
:license: GNU GPL, see LICENSE for more details.
|
:license: GNU GPL, see LICENSE for more details.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from . import signals, slides
|
from . import signals, slides # noqa
|
||||||
|
@ -17,13 +17,14 @@
|
|||||||
import csv
|
import csv
|
||||||
|
|
||||||
from django.db import transaction
|
from django.db import transaction
|
||||||
from django.utils.translation import ugettext as _, ugettext_noop
|
from django.utils.translation import ugettext as _
|
||||||
|
from django.utils.translation import ugettext_noop
|
||||||
|
|
||||||
from openslides.utils import csv_ext
|
from openslides.utils import csv_ext
|
||||||
from openslides.utils.person.api import Persons
|
from openslides.utils.person.api import Persons
|
||||||
from openslides.utils.utils import html_strong
|
from openslides.utils.utils import html_strong
|
||||||
|
|
||||||
from .models import Motion, Category
|
from .models import Category, Motion
|
||||||
|
|
||||||
|
|
||||||
def import_motions(csv_file, default_submitter, override=False, importing_person=None):
|
def import_motions(csv_file, default_submitter, override=False, importing_person=None):
|
||||||
|
@ -13,11 +13,6 @@
|
|||||||
from openslides.utils.exceptions import OpenSlidesError
|
from openslides.utils.exceptions import OpenSlidesError
|
||||||
|
|
||||||
|
|
||||||
class MotionError(OpenSlidesError):
|
|
||||||
"""Exception raised when errors in the motion accure."""
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
class WorkflowError(OpenSlidesError):
|
class WorkflowError(OpenSlidesError):
|
||||||
"""Exception raised when errors in a workflow or state accure."""
|
"""Exception raised when errors in a workflow or state accure."""
|
||||||
pass
|
pass
|
||||||
|
@ -11,12 +11,14 @@
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
from django import forms
|
from django import forms
|
||||||
from django.utils.translation import ugettext as _, ugettext_lazy
|
from django.utils.translation import ugettext_lazy
|
||||||
|
|
||||||
from openslides.config.api import config
|
from openslides.config.api import config
|
||||||
from openslides.utils.forms import CssClassMixin, CleanHtmlFormMixin, LocalizedModelChoiceField
|
from openslides.utils.forms import (CleanHtmlFormMixin, CssClassMixin,
|
||||||
from openslides.utils.person import PersonFormField, MultiplePersonFormField
|
LocalizedModelChoiceField)
|
||||||
from .models import Motion, Category, Workflow
|
from openslides.utils.person import MultiplePersonFormField, PersonFormField
|
||||||
|
|
||||||
|
from .models import Category, Motion, Workflow
|
||||||
|
|
||||||
|
|
||||||
class BaseMotionForm(CleanHtmlFormMixin, CssClassMixin, forms.ModelForm):
|
class BaseMotionForm(CleanHtmlFormMixin, CssClassMixin, forms.ModelForm):
|
||||||
|
@ -13,27 +13,21 @@
|
|||||||
:license: GNU GPL, see LICENSE for more details.
|
:license: GNU GPL, see LICENSE for more details.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from datetime import datetime
|
|
||||||
|
|
||||||
from django.core.urlresolvers import reverse
|
from django.core.urlresolvers import reverse
|
||||||
from django.db import models, IntegrityError
|
from django.db import models
|
||||||
from django.db.models import Max
|
from django.db.models import Max
|
||||||
from django.dispatch import receiver
|
|
||||||
from django.utils import formats
|
from django.utils import formats
|
||||||
from django.utils.translation import pgettext
|
from django.utils.translation import ugettext as _
|
||||||
from django.utils.translation import ugettext as _, ugettext_lazy, ugettext_noop
|
from django.utils.translation import ugettext_lazy, ugettext_noop
|
||||||
|
|
||||||
from openslides.agenda.models import Item
|
|
||||||
from openslides.config.api import config
|
from openslides.config.api import config
|
||||||
from openslides.participant.models import User
|
from openslides.poll.models import (BaseOption, BasePoll, BaseVote,
|
||||||
from openslides.poll.models import (
|
CountInvalid, CountVotesCast)
|
||||||
BaseOption, BasePoll, CountVotesCast, CountInvalid, BaseVote)
|
from openslides.projector.models import RelatedModelMixin, SlideMixin
|
||||||
from openslides.projector.models import SlideMixin, RelatedModelMixin
|
|
||||||
from openslides.projector.api import (update_projector, get_active_slide)
|
|
||||||
from openslides.utils.jsonfield import JSONField
|
from openslides.utils.jsonfield import JSONField
|
||||||
from openslides.utils.person import PersonField
|
from openslides.utils.person import PersonField
|
||||||
|
|
||||||
from .exceptions import MotionError, WorkflowError
|
from .exceptions import WorkflowError
|
||||||
|
|
||||||
|
|
||||||
class Motion(SlideMixin, models.Model):
|
class Motion(SlideMixin, models.Model):
|
||||||
|
@ -10,24 +10,24 @@
|
|||||||
:license: GNU GPL, see LICENSE for more details.
|
:license: GNU GPL, see LICENSE for more details.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import random
|
|
||||||
import os
|
import os
|
||||||
from bs4 import BeautifulSoup
|
import random
|
||||||
|
|
||||||
|
from bs4 import BeautifulSoup
|
||||||
|
from django.conf import settings
|
||||||
|
from django.utils.translation import ugettext as _
|
||||||
from reportlab.lib import colors
|
from reportlab.lib import colors
|
||||||
from reportlab.lib.units import cm
|
from reportlab.lib.units import cm
|
||||||
from reportlab.platypus import (
|
from reportlab.platypus import PageBreak, Paragraph, Spacer, Table, TableStyle
|
||||||
SimpleDocTemplate, PageBreak, Paragraph, Spacer, Table, TableStyle)
|
|
||||||
from django.utils.translation import ugettext as _
|
|
||||||
from django.conf import settings
|
|
||||||
|
|
||||||
from openslides.config.api import config
|
from openslides.config.api import config
|
||||||
|
from openslides.participant.models import Group, User
|
||||||
from openslides.utils.pdf import stylesheet
|
from openslides.utils.pdf import stylesheet
|
||||||
from .models import Motion, Category
|
|
||||||
|
from .models import Category, Motion
|
||||||
|
|
||||||
# Needed to count the delegates
|
# Needed to count the delegates
|
||||||
# TODO: find another way to do this.
|
# TODO: find another way to do this.
|
||||||
from openslides.participant.models import User, Group
|
|
||||||
|
|
||||||
|
|
||||||
def motions_to_pdf(pdf):
|
def motions_to_pdf(pdf):
|
||||||
|
@ -10,15 +10,16 @@
|
|||||||
:license: GNU GPL, see LICENSE for more details.
|
:license: GNU GPL, see LICENSE for more details.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from django.dispatch import receiver
|
|
||||||
from django import forms
|
from django import forms
|
||||||
from django.utils.translation import ugettext as _, ugettext_lazy, ugettext_noop
|
from django.dispatch import receiver
|
||||||
|
from django.utils.translation import ugettext as _
|
||||||
|
from django.utils.translation import ugettext_lazy, ugettext_noop
|
||||||
|
|
||||||
|
from openslides.config.api import ConfigPage, ConfigVariable
|
||||||
from openslides.config.signals import config_signal
|
from openslides.config.signals import config_signal
|
||||||
from openslides.config.api import ConfigVariable, ConfigPage
|
|
||||||
from openslides.core.signals import post_database_setup
|
from openslides.core.signals import post_database_setup
|
||||||
|
|
||||||
from .models import Workflow, State
|
from .models import State, Workflow
|
||||||
|
|
||||||
|
|
||||||
@receiver(config_signal, dispatch_uid='setup_motion_config_page')
|
@receiver(config_signal, dispatch_uid='setup_motion_config_page')
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
from openslides.projector.api import register_slide_model
|
from openslides.projector.api import register_slide_model
|
||||||
|
|
||||||
from .models import Motion
|
from .models import Motion
|
||||||
|
|
||||||
register_slide_model(Motion, 'motion/slide.html')
|
register_slide_model(Motion, 'motion/slide.html')
|
||||||
|
@ -10,133 +10,109 @@
|
|||||||
:license: GNU GPL, see LICENSE for more details.
|
:license: GNU GPL, see LICENSE for more details.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from django.conf.urls import url, patterns
|
from django.conf.urls import patterns, url
|
||||||
|
|
||||||
|
# TODO: define the Views inhere
|
||||||
urlpatterns = patterns('openslides.motion.views',
|
urlpatterns = patterns(
|
||||||
|
'openslides.motion.views',
|
||||||
url(r'^$',
|
url(r'^$',
|
||||||
'motion_list',
|
'motion_list',
|
||||||
name='motion_list',
|
name='motion_list'),
|
||||||
),
|
|
||||||
|
|
||||||
url(r'^new/$',
|
url(r'^new/$',
|
||||||
'motion_create',
|
'motion_create',
|
||||||
# TODO: rename to motion_create
|
# TODO: rename to motion_create
|
||||||
name='motion_new',
|
name='motion_new'),
|
||||||
),
|
|
||||||
|
|
||||||
url(r'^(?P<pk>\d+)/$',
|
url(r'^(?P<pk>\d+)/$',
|
||||||
'motion_detail',
|
'motion_detail',
|
||||||
name='motion_detail',
|
name='motion_detail'),
|
||||||
),
|
|
||||||
|
|
||||||
url(r'^(?P<pk>\d+)/edit/$',
|
url(r'^(?P<pk>\d+)/edit/$',
|
||||||
'motion_update',
|
'motion_update',
|
||||||
name='motion_update',
|
name='motion_update'),
|
||||||
),
|
|
||||||
|
|
||||||
url(r'^(?P<pk>\d+)/del/$',
|
url(r'^(?P<pk>\d+)/del/$',
|
||||||
'motion_delete',
|
'motion_delete',
|
||||||
name='motion_delete',
|
name='motion_delete'),
|
||||||
),
|
|
||||||
|
|
||||||
url(r'^(?P<pk>\d+)/version/(?P<version_number>\d+)/$',
|
url(r'^(?P<pk>\d+)/version/(?P<version_number>\d+)/$',
|
||||||
'motion_detail',
|
'motion_detail',
|
||||||
name='motion_version_detail',
|
name='motion_version_detail'),
|
||||||
),
|
|
||||||
|
|
||||||
url(r'^(?P<pk>\d+)/version/(?P<version_number>\d+)/permit/$',
|
url(r'^(?P<pk>\d+)/version/(?P<version_number>\d+)/permit/$',
|
||||||
'version_permit',
|
'version_permit',
|
||||||
name='motion_version_permit',
|
name='motion_version_permit'),
|
||||||
),
|
|
||||||
|
|
||||||
url(r'^(?P<pk>\d+)/version/(?P<version_number>\d+)/del/$',
|
url(r'^(?P<pk>\d+)/version/(?P<version_number>\d+)/del/$',
|
||||||
'version_delete',
|
'version_delete',
|
||||||
name='motion_version_delete',
|
name='motion_version_delete'),
|
||||||
),
|
|
||||||
|
|
||||||
url(r'^(?P<pk>\d+)/diff/$',
|
url(r'^(?P<pk>\d+)/diff/$',
|
||||||
'version_diff',
|
'version_diff',
|
||||||
name='motion_version_diff',
|
name='motion_version_diff'),
|
||||||
),
|
|
||||||
|
|
||||||
url(r'^(?P<pk>\d+)/support/$',
|
url(r'^(?P<pk>\d+)/support/$',
|
||||||
'motion_support',
|
'motion_support',
|
||||||
name='motion_support',
|
name='motion_support'),
|
||||||
),
|
|
||||||
|
|
||||||
url(r'^(?P<pk>\d+)/unsupport/$',
|
url(r'^(?P<pk>\d+)/unsupport/$',
|
||||||
'motion_unsupport',
|
'motion_unsupport',
|
||||||
name='motion_unsupport',
|
name='motion_unsupport'),
|
||||||
),
|
|
||||||
|
|
||||||
url(r'^(?P<pk>\d+)/create_poll/$',
|
url(r'^(?P<pk>\d+)/create_poll/$',
|
||||||
'poll_create',
|
'poll_create',
|
||||||
name='motion_poll_create',
|
name='motion_poll_create'),
|
||||||
),
|
|
||||||
|
|
||||||
url(r'^(?P<pk>\d+)/poll/(?P<poll_number>\d+)/edit/$',
|
url(r'^(?P<pk>\d+)/poll/(?P<poll_number>\d+)/edit/$',
|
||||||
'poll_update',
|
'poll_update',
|
||||||
name='motion_poll_update',
|
name='motion_poll_update'),
|
||||||
),
|
|
||||||
|
|
||||||
url(r'^(?P<pk>\d+)/poll/(?P<poll_number>\d+)/del/$',
|
url(r'^(?P<pk>\d+)/poll/(?P<poll_number>\d+)/del/$',
|
||||||
'poll_delete',
|
'poll_delete',
|
||||||
name='motion_poll_delete',
|
name='motion_poll_delete'),
|
||||||
),
|
|
||||||
|
|
||||||
url(r'^(?P<pk>\d+)/poll/(?P<poll_number>\d+)/pdf/$',
|
url(r'^(?P<pk>\d+)/poll/(?P<poll_number>\d+)/pdf/$',
|
||||||
'poll_pdf',
|
'poll_pdf',
|
||||||
name='motion_poll_pdf',
|
name='motion_poll_pdf'),
|
||||||
),
|
|
||||||
|
|
||||||
url(r'^(?P<pk>\d+)/set_state/(?P<state>\d+)/$',
|
url(r'^(?P<pk>\d+)/set_state/(?P<state>\d+)/$',
|
||||||
'set_state',
|
'set_state',
|
||||||
name='motion_set_state',
|
name='motion_set_state'),
|
||||||
),
|
|
||||||
|
|
||||||
url(r'^(?P<pk>\d+)/reset_state/$',
|
url(r'^(?P<pk>\d+)/reset_state/$',
|
||||||
'reset_state',
|
'reset_state',
|
||||||
name='motion_reset_state',
|
name='motion_reset_state'),
|
||||||
),
|
|
||||||
|
|
||||||
url(r'^(?P<pk>\d+)/agenda/$',
|
url(r'^(?P<pk>\d+)/agenda/$',
|
||||||
'create_agenda_item',
|
'create_agenda_item',
|
||||||
name='motion_create_agenda',
|
name='motion_create_agenda'),
|
||||||
),
|
|
||||||
|
|
||||||
url(r'^pdf/$',
|
url(r'^pdf/$',
|
||||||
'motion_list_pdf',
|
'motion_list_pdf',
|
||||||
name='motion_list_pdf',
|
name='motion_list_pdf'),
|
||||||
),
|
|
||||||
|
|
||||||
url(r'^(?P<pk>\d+)/pdf/$',
|
url(r'^(?P<pk>\d+)/pdf/$',
|
||||||
'motion_detail_pdf',
|
'motion_detail_pdf',
|
||||||
name='motion_detail_pdf',
|
name='motion_detail_pdf'),
|
||||||
),
|
|
||||||
|
|
||||||
url(r'^category/$',
|
url(r'^category/$',
|
||||||
'category_list',
|
'category_list',
|
||||||
name='motion_category_list',
|
name='motion_category_list'),
|
||||||
),
|
|
||||||
|
|
||||||
url(r'^category/new/$',
|
url(r'^category/new/$',
|
||||||
'category_create',
|
'category_create',
|
||||||
name='motion_category_create',
|
name='motion_category_create'),
|
||||||
),
|
|
||||||
|
|
||||||
url(r'^category/(?P<pk>\d+)/edit/$',
|
url(r'^category/(?P<pk>\d+)/edit/$',
|
||||||
'category_update',
|
'category_update',
|
||||||
name='motion_category_update',
|
name='motion_category_update'),
|
||||||
),
|
|
||||||
|
|
||||||
url(r'^category/(?P<pk>\d+)/del/$',
|
url(r'^category/(?P<pk>\d+)/del/$',
|
||||||
'category_delete',
|
'category_delete',
|
||||||
name='motion_category_delete',
|
name='motion_category_delete'),
|
||||||
),
|
|
||||||
|
|
||||||
url(r'^csv_import/$',
|
url(r'^csv_import/$',
|
||||||
'motion_csv_import',
|
'motion_csv_import',
|
||||||
name='motion_csv_import',
|
name='motion_csv_import'),
|
||||||
),
|
|
||||||
)
|
)
|
||||||
|
@ -12,34 +12,33 @@
|
|||||||
:license: GNU GPL, see LICENSE for more details.
|
:license: GNU GPL, see LICENSE for more details.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from django.core.urlresolvers import reverse
|
|
||||||
from django.contrib import messages
|
from django.contrib import messages
|
||||||
from django.db import transaction
|
from django.core.urlresolvers import reverse
|
||||||
from django.db.models import Model
|
|
||||||
from django.http import Http404, HttpResponseRedirect
|
from django.http import Http404, HttpResponseRedirect
|
||||||
from django.utils.text import slugify
|
from django.utils.text import slugify
|
||||||
from django.utils.translation import ugettext as _, ugettext_lazy, ugettext_noop
|
from django.utils.translation import ugettext as _
|
||||||
|
from django.utils.translation import ugettext_lazy, ugettext_noop
|
||||||
from reportlab.platypus import SimpleDocTemplate
|
from reportlab.platypus import SimpleDocTemplate
|
||||||
|
|
||||||
from openslides.utils.pdf import stylesheet
|
from openslides.agenda.views import CreateRelatedAgendaItemView as _CreateRelatedAgendaItemView
|
||||||
from openslides.utils.views import (
|
from openslides.config.api import config
|
||||||
TemplateView, RedirectView, UpdateView, CreateView, DeleteView, PDFView,
|
from openslides.poll.views import PollFormView
|
||||||
DetailView, ListView, FormView, QuestionView, SingleObjectMixin)
|
from openslides.projector.api import get_active_slide, update_projector
|
||||||
|
from openslides.projector.projector import Widget
|
||||||
from openslides.utils.template import Tab
|
from openslides.utils.template import Tab
|
||||||
from openslides.utils.utils import html_strong, htmldiff
|
from openslides.utils.utils import html_strong, htmldiff
|
||||||
from openslides.poll.views import PollFormView
|
from openslides.utils.views import (CreateView, DeleteView, DetailView,
|
||||||
from openslides.projector.api import get_active_slide
|
FormView, ListView, PDFView, QuestionView,
|
||||||
from openslides.projector.projector import Widget
|
RedirectView, SingleObjectMixin, UpdateView)
|
||||||
from openslides.config.api import config
|
|
||||||
from openslides.agenda.views import CreateRelatedAgendaItemView as _CreateRelatedAgendaItemView
|
|
||||||
|
|
||||||
from .csv_import import import_motions
|
from .csv_import import import_motions
|
||||||
from .models import (Motion, MotionSubmitter, MotionSupporter, MotionPoll,
|
from .forms import (BaseMotionForm, MotionCategoryMixin,
|
||||||
MotionVersion, State, WorkflowError, Category)
|
MotionDisableVersioningMixin, MotionIdentifierMixin,
|
||||||
from .forms import (BaseMotionForm, MotionSubmitterMixin, MotionSupporterMixin,
|
MotionImportForm, MotionSubmitterMixin,
|
||||||
MotionDisableVersioningMixin, MotionCategoryMixin,
|
MotionSupporterMixin, MotionWorkflowMixin)
|
||||||
MotionIdentifierMixin, MotionWorkflowMixin, MotionImportForm)
|
from .models import (Category, Motion, MotionPoll, MotionSubmitter,
|
||||||
from .pdf import motions_to_pdf, motion_to_pdf, motion_poll_to_pdf
|
MotionSupporter, MotionVersion, WorkflowError)
|
||||||
|
from .pdf import motion_poll_to_pdf, motion_to_pdf, motions_to_pdf
|
||||||
|
|
||||||
|
|
||||||
class MotionListView(ListView):
|
class MotionListView(ListView):
|
||||||
|
@ -10,10 +10,4 @@
|
|||||||
:license: GNU GPL, see LICENSE for more details.
|
:license: GNU GPL, see LICENSE for more details.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from django.utils.translation import ugettext_noop
|
from . import signals, slides # noqa
|
||||||
|
|
||||||
from . import signals
|
|
||||||
from . import slides
|
|
||||||
|
|
||||||
|
|
||||||
NAME = ugettext_noop('Participant')
|
|
||||||
|
@ -10,15 +10,15 @@
|
|||||||
:license: GNU GPL, see LICENSE for more details.
|
:license: GNU GPL, see LICENSE for more details.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from random import choice
|
|
||||||
import csv
|
import csv
|
||||||
|
from random import choice
|
||||||
|
|
||||||
from django.db import transaction
|
from django.db import transaction
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import ugettext as _
|
||||||
|
|
||||||
from openslides.utils import csv_ext
|
from openslides.utils import csv_ext
|
||||||
|
|
||||||
from openslides.participant.models import User, Group
|
from .models import Group, User
|
||||||
|
|
||||||
|
|
||||||
def gen_password():
|
def gen_password():
|
||||||
|
@ -11,15 +11,16 @@
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
from django import forms
|
from django import forms
|
||||||
from django.contrib import messages
|
|
||||||
from django.contrib.auth.models import Permission
|
|
||||||
from django.utils.translation import ugettext as _, ugettext_lazy
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
from django.contrib.auth.models import Permission
|
||||||
|
from django.utils.translation import ugettext as _
|
||||||
|
from django.utils.translation import ugettext_lazy
|
||||||
|
|
||||||
from openslides.utils.forms import CssClassMixin, LocalizedModelMultipleChoiceField
|
|
||||||
from openslides.participant.models import User, Group, get_protected_perm
|
|
||||||
from openslides.participant.api import get_registered_group
|
|
||||||
from openslides.config.api import config
|
from openslides.config.api import config
|
||||||
|
from openslides.utils.forms import (CssClassMixin,
|
||||||
|
LocalizedModelMultipleChoiceField)
|
||||||
|
|
||||||
|
from .models import get_protected_perm, Group, User
|
||||||
|
|
||||||
|
|
||||||
class UserCreateForm(CssClassMixin, forms.ModelForm):
|
class UserCreateForm(CssClassMixin, forms.ModelForm):
|
||||||
|
@ -10,18 +10,20 @@
|
|||||||
:license: GNU GPL, see LICENSE for more details.
|
:license: GNU GPL, see LICENSE for more details.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from django.core.urlresolvers import reverse
|
from django.contrib.auth.models import Group as DjangoGroup
|
||||||
from django.contrib.auth.models import User as DjangoUser, Group as DjangoGroup, Permission
|
from django.contrib.auth.models import User as DjangoUser
|
||||||
|
from django.contrib.auth.models import Permission
|
||||||
from django.contrib.contenttypes.models import ContentType
|
from django.contrib.contenttypes.models import ContentType
|
||||||
|
from django.core.urlresolvers import reverse
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.db.models import signals
|
from django.db.models import signals
|
||||||
from django.dispatch import receiver
|
from django.dispatch import receiver
|
||||||
from django.utils.translation import ugettext_lazy, ugettext_noop
|
from django.utils.translation import ugettext_lazy, ugettext_noop
|
||||||
|
|
||||||
from openslides.utils.person import PersonMixin, Person
|
|
||||||
from openslides.utils.person.signals import receive_persons
|
|
||||||
from openslides.config.api import config
|
from openslides.config.api import config
|
||||||
from openslides.projector.models import SlideMixin
|
from openslides.projector.models import SlideMixin
|
||||||
|
from openslides.utils.person import Person, PersonMixin
|
||||||
|
from openslides.utils.person.signals import receive_persons
|
||||||
|
|
||||||
|
|
||||||
class User(SlideMixin, PersonMixin, Person, DjangoUser):
|
class User(SlideMixin, PersonMixin, Person, DjangoUser):
|
||||||
|
@ -10,18 +10,19 @@
|
|||||||
:license: GNU GPL, see LICENSE for more details.
|
:license: GNU GPL, see LICENSE for more details.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from django.dispatch import receiver
|
|
||||||
from django import forms
|
from django import forms
|
||||||
from django.utils.translation import ugettext as _, ugettext_lazy, ugettext_noop
|
|
||||||
from django.contrib.contenttypes.models import ContentType
|
|
||||||
from django.contrib.auth.models import Permission
|
from django.contrib.auth.models import Permission
|
||||||
|
from django.contrib.contenttypes.models import ContentType
|
||||||
|
from django.dispatch import receiver
|
||||||
|
from django.utils.translation import ugettext as _
|
||||||
|
from django.utils.translation import ugettext_lazy, ugettext_noop
|
||||||
|
|
||||||
from openslides.core.signals import post_database_setup
|
from openslides.config.api import ConfigPage, ConfigVariable
|
||||||
from openslides.config.signals import config_signal
|
from openslides.config.signals import config_signal
|
||||||
from openslides.config.api import ConfigVariable, ConfigPage
|
from openslides.core.signals import post_database_setup
|
||||||
|
|
||||||
from .models import Group
|
|
||||||
from .api import create_or_reset_admin_user
|
from .api import create_or_reset_admin_user
|
||||||
|
from .models import Group
|
||||||
|
|
||||||
|
|
||||||
@receiver(config_signal, dispatch_uid='setup_participant_config_page')
|
@receiver(config_signal, dispatch_uid='setup_participant_config_page')
|
||||||
|
@ -11,7 +11,8 @@
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
from openslides.projector.api import register_slide_model
|
from openslides.projector.api import register_slide_model
|
||||||
from .models import User, Group
|
|
||||||
|
from .models import Group, User
|
||||||
|
|
||||||
register_slide_model(User, 'participant/user_slide.html')
|
register_slide_model(User, 'participant/user_slide.html')
|
||||||
register_slide_model(Group, 'participant/group_slide.html')
|
register_slide_model(Group, 'participant/group_slide.html')
|
||||||
|
@ -10,104 +10,83 @@
|
|||||||
:license: GNU GPL, see LICENSE for more details.
|
:license: GNU GPL, see LICENSE for more details.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from django.conf.urls import url, patterns
|
from django.conf.urls import patterns, url
|
||||||
|
|
||||||
from openslides.participant.views import (
|
from . import views
|
||||||
UserOverview, UserCreateView, UserDetailView, UserUpdateView,
|
|
||||||
UserDeleteView, ResetPasswordView, SetUserStatusView, UserImportView,
|
|
||||||
GroupOverview, GroupCreateView, GroupDetailView, GroupUpdateView, GroupDeleteView,
|
|
||||||
ParticipantsListPDF, ParticipantsPasswordsPDF)
|
|
||||||
|
|
||||||
urlpatterns = patterns('',
|
|
||||||
|
|
||||||
|
urlpatterns = patterns(
|
||||||
|
'',
|
||||||
# User
|
# User
|
||||||
url(r'^$',
|
url(r'^$',
|
||||||
UserOverview.as_view(),
|
views.UserOverview.as_view(),
|
||||||
name='user_overview',
|
name='user_overview'),
|
||||||
),
|
|
||||||
|
|
||||||
url(r'^new/$',
|
url(r'^new/$',
|
||||||
UserCreateView.as_view(),
|
views.UserCreateView.as_view(),
|
||||||
name='user_new',
|
name='user_new'),
|
||||||
),
|
|
||||||
|
|
||||||
url(r'^(?P<pk>\d+)/$',
|
url(r'^(?P<pk>\d+)/$',
|
||||||
UserDetailView.as_view(),
|
views.UserDetailView.as_view(),
|
||||||
name='user_view',
|
name='user_view'),
|
||||||
),
|
|
||||||
|
|
||||||
url(r'^(?P<pk>\d+)/edit/$',
|
url(r'^(?P<pk>\d+)/edit/$',
|
||||||
UserUpdateView.as_view(),
|
views.UserUpdateView.as_view(),
|
||||||
name='user_edit',
|
name='user_edit'),
|
||||||
),
|
|
||||||
|
|
||||||
url(r'^(?P<pk>\d+)/del/$',
|
url(r'^(?P<pk>\d+)/del/$',
|
||||||
UserDeleteView.as_view(),
|
views.UserDeleteView.as_view(),
|
||||||
name='user_delete',
|
name='user_delete'),
|
||||||
),
|
|
||||||
|
|
||||||
url(r'^(?P<pk>\d+)/reset_password/$',
|
url(r'^(?P<pk>\d+)/reset_password/$',
|
||||||
ResetPasswordView.as_view(),
|
views.ResetPasswordView.as_view(),
|
||||||
name='user_reset_password',
|
name='user_reset_password'),
|
||||||
),
|
|
||||||
|
|
||||||
url(r'^(?P<pk>\d+)/status/activate/$',
|
url(r'^(?P<pk>\d+)/status/activate/$',
|
||||||
SetUserStatusView.as_view(),
|
views.SetUserStatusView.as_view(),
|
||||||
{'action': 'activate'},
|
{'action': 'activate'},
|
||||||
name='user_status_activate',
|
name='user_status_activate'),
|
||||||
),
|
|
||||||
|
|
||||||
url(r'^(?P<pk>\d+)/status/deactivate/$',
|
url(r'^(?P<pk>\d+)/status/deactivate/$',
|
||||||
SetUserStatusView.as_view(),
|
views.SetUserStatusView.as_view(),
|
||||||
{'action': 'deactivate'},
|
{'action': 'deactivate'},
|
||||||
name='user_status_deactivate',
|
name='user_status_deactivate'),
|
||||||
),
|
|
||||||
|
|
||||||
url(r'^(?P<pk>\d+)/status/toggle/$',
|
url(r'^(?P<pk>\d+)/status/toggle/$',
|
||||||
SetUserStatusView.as_view(),
|
views.SetUserStatusView.as_view(),
|
||||||
{'action': 'toggle'},
|
{'action': 'toggle'},
|
||||||
name='user_status_toggle',
|
name='user_status_toggle'),
|
||||||
),
|
|
||||||
|
|
||||||
url(r'^import/$',
|
url(r'^import/$',
|
||||||
UserImportView.as_view(),
|
views.UserImportView.as_view(),
|
||||||
name='user_import',
|
name='user_import'),
|
||||||
),
|
|
||||||
|
|
||||||
# Group
|
# Group
|
||||||
url(r'^group/$',
|
url(r'^group/$',
|
||||||
GroupOverview.as_view(),
|
views.GroupOverview.as_view(),
|
||||||
name='user_group_overview',
|
name='user_group_overview'),
|
||||||
),
|
|
||||||
|
|
||||||
url(r'^group/new/$',
|
url(r'^group/new/$',
|
||||||
GroupCreateView.as_view(),
|
views.GroupCreateView.as_view(),
|
||||||
name='user_group_new',
|
name='user_group_new'),
|
||||||
),
|
|
||||||
|
|
||||||
url(r'^group/(?P<pk>\d+)/$',
|
url(r'^group/(?P<pk>\d+)/$',
|
||||||
GroupDetailView.as_view(),
|
views.GroupDetailView.as_view(),
|
||||||
name='user_group_view',
|
name='user_group_view'),
|
||||||
),
|
|
||||||
|
|
||||||
url(r'^group/(?P<pk>\d+)/edit/$',
|
url(r'^group/(?P<pk>\d+)/edit/$',
|
||||||
GroupUpdateView.as_view(),
|
views.GroupUpdateView.as_view(),
|
||||||
name='user_group_edit',
|
name='user_group_edit'),
|
||||||
),
|
|
||||||
|
|
||||||
url(r'^group/(?P<pk>\d+)/del/$',
|
url(r'^group/(?P<pk>\d+)/del/$',
|
||||||
GroupDeleteView.as_view(),
|
views.GroupDeleteView.as_view(),
|
||||||
name='user_group_delete',
|
name='user_group_delete'),
|
||||||
),
|
|
||||||
|
|
||||||
# PDF
|
# PDF
|
||||||
url(r'^print/$',
|
url(r'^print/$',
|
||||||
ParticipantsListPDF.as_view(),
|
views.ParticipantsListPDF.as_view(),
|
||||||
name='user_print',
|
name='user_print'),
|
||||||
),
|
|
||||||
|
|
||||||
url(r'^passwords/print/$',
|
url(r'^passwords/print/$',
|
||||||
ParticipantsPasswordsPDF.as_view(),
|
views.ParticipantsPasswordsPDF.as_view(),
|
||||||
name='print_passwords',
|
name='print_passwords'),
|
||||||
),
|
|
||||||
)
|
)
|
||||||
|
@ -18,13 +18,6 @@ else:
|
|||||||
draw_qrcode = True
|
draw_qrcode = True
|
||||||
|
|
||||||
from cStringIO import StringIO
|
from cStringIO import StringIO
|
||||||
from urllib import urlencode
|
|
||||||
from urlparse import parse_qs
|
|
||||||
|
|
||||||
from reportlab.lib import colors
|
|
||||||
from reportlab.lib.units import cm
|
|
||||||
from reportlab.platypus import (
|
|
||||||
SimpleDocTemplate, Paragraph, LongTable, Spacer, Table, TableStyle, Image)
|
|
||||||
|
|
||||||
from django.contrib import messages
|
from django.contrib import messages
|
||||||
from django.contrib.auth.decorators import login_required
|
from django.contrib.auth.decorators import login_required
|
||||||
@ -32,23 +25,28 @@ from django.contrib.auth.forms import PasswordChangeForm
|
|||||||
from django.contrib.auth.views import login as django_login
|
from django.contrib.auth.views import login as django_login
|
||||||
from django.core.urlresolvers import reverse
|
from django.core.urlresolvers import reverse
|
||||||
from django.shortcuts import redirect
|
from django.shortcuts import redirect
|
||||||
from django.utils.translation import ugettext as _, ugettext_lazy, activate
|
from django.utils.translation import ugettext as _
|
||||||
|
from django.utils.translation import activate, ugettext_lazy
|
||||||
|
from reportlab.lib import colors
|
||||||
|
from reportlab.lib.units import cm
|
||||||
|
from reportlab.platypus import (Image, LongTable, Paragraph, SimpleDocTemplate,
|
||||||
|
Spacer, Table, TableStyle)
|
||||||
|
|
||||||
from openslides.utils.pdf import stylesheet
|
|
||||||
from openslides.utils.template import Tab
|
|
||||||
from openslides.utils.utils import (
|
|
||||||
template, delete_default_permissions, html_strong)
|
|
||||||
from openslides.utils.views import (
|
|
||||||
FormView, PDFView, CreateView, UpdateView, DeleteView, PermissionMixin,
|
|
||||||
RedirectView, SingleObjectMixin, ListView, QuestionView, DetailView)
|
|
||||||
from openslides.config.api import config
|
from openslides.config.api import config
|
||||||
from openslides.projector.projector import Widget
|
from openslides.projector.projector import Widget
|
||||||
|
from openslides.utils.pdf import stylesheet
|
||||||
|
from openslides.utils.template import Tab
|
||||||
|
from openslides.utils.utils import (delete_default_permissions, html_strong,
|
||||||
|
template)
|
||||||
|
from openslides.utils.views import (CreateView, DeleteView, DetailView,
|
||||||
|
FormView, ListView, PDFView,
|
||||||
|
PermissionMixin, QuestionView,
|
||||||
|
RedirectView, SingleObjectMixin, UpdateView)
|
||||||
|
|
||||||
from .api import gen_username, gen_password, import_users
|
from .api import gen_password, gen_username, import_users
|
||||||
from .forms import (
|
from .forms import (GroupForm, UserCreateForm, UserImportForm, UsersettingsForm,
|
||||||
UserCreateForm, UserUpdateForm, UsersettingsForm,
|
UserUpdateForm)
|
||||||
UserImportForm, GroupForm)
|
from .models import get_protected_perm, Group, User
|
||||||
from .models import User, Group, get_protected_perm
|
|
||||||
|
|
||||||
|
|
||||||
class UserOverview(ListView):
|
class UserOverview(ListView):
|
||||||
@ -448,7 +446,7 @@ class GroupDeleteView(DeleteView):
|
|||||||
Checks whether the group is protected.
|
Checks whether the group is protected.
|
||||||
"""
|
"""
|
||||||
if self.object.pk in [1, 2]:
|
if self.object.pk in [1, 2]:
|
||||||
messages.error(request, _('You can not delete this group.'))
|
messages.error(self.request, _('You can not delete this group.'))
|
||||||
return True
|
return True
|
||||||
if (not self.request.user.is_superuser and
|
if (not self.request.user.is_superuser and
|
||||||
get_protected_perm() in self.object.permissions.all() and
|
get_protected_perm() in self.object.permissions.all() and
|
||||||
|
@ -12,7 +12,8 @@
|
|||||||
|
|
||||||
from django.core.exceptions import ObjectDoesNotExist
|
from django.core.exceptions import ObjectDoesNotExist
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.utils.translation import ugettext_lazy as _, ugettext_noop
|
from django.utils.translation import ugettext_lazy as _
|
||||||
|
from django.utils.translation import ugettext_noop
|
||||||
|
|
||||||
from openslides.utils.models import MinMaxIntegerField
|
from openslides.utils.models import MinMaxIntegerField
|
||||||
|
|
||||||
|
@ -10,9 +10,9 @@
|
|||||||
:license: GNU GPL, see LICENSE for more details.
|
:license: GNU GPL, see LICENSE for more details.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from django.http import HttpResponseRedirect
|
|
||||||
from django.forms.models import modelform_factory
|
|
||||||
from django.core.exceptions import ImproperlyConfigured
|
from django.core.exceptions import ImproperlyConfigured
|
||||||
|
from django.forms.models import modelform_factory
|
||||||
|
from django.http import HttpResponseRedirect
|
||||||
|
|
||||||
from openslides.utils.views import TemplateView, FormMixin
|
from openslides.utils.views import TemplateView, FormMixin
|
||||||
|
|
||||||
|
@ -10,4 +10,4 @@
|
|||||||
:license: GNU GPL, see LICENSE for more details.
|
:license: GNU GPL, see LICENSE for more details.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from . import signals, slides
|
from . import signals, slides # noqa
|
||||||
|
@ -13,15 +13,14 @@
|
|||||||
import json
|
import json
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.core.cache import cache
|
from django.template.loader import render_to_string
|
||||||
from django.utils.datastructures import SortedDict
|
from django.utils.datastructures import SortedDict
|
||||||
from django.utils.importlib import import_module
|
from django.utils.importlib import import_module
|
||||||
from django.template.loader import render_to_string
|
|
||||||
|
|
||||||
from openslides.config.api import config
|
from openslides.config.api import config
|
||||||
from openslides.utils.tornado_webserver import ProjectorSocketHandler
|
from openslides.utils.tornado_webserver import ProjectorSocketHandler
|
||||||
from .signals import projector_overlays
|
|
||||||
|
|
||||||
|
from .signals import projector_overlays
|
||||||
|
|
||||||
slide_callback = {}
|
slide_callback = {}
|
||||||
"""
|
"""
|
||||||
@ -48,7 +47,7 @@ def update_projector_overlay(overlay):
|
|||||||
ovleray or None. If it is None, all overlays will be updated.
|
ovleray or None. If it is None, all overlays will be updated.
|
||||||
"""
|
"""
|
||||||
if overlay is None:
|
if overlay is None:
|
||||||
overlays = [overlay for overlay in get_overlays().values()]
|
overlays = [item for item in get_overlays().values()]
|
||||||
elif isinstance(overlay, basestring):
|
elif isinstance(overlay, basestring):
|
||||||
overlays = [get_overlays()[overlay]]
|
overlays = [get_overlays()[overlay]]
|
||||||
else:
|
else:
|
||||||
@ -115,13 +114,13 @@ def get_projector_overlays_js():
|
|||||||
|
|
||||||
The retuned value is a list of json objects.
|
The retuned value is a list of json objects.
|
||||||
"""
|
"""
|
||||||
js = []
|
javascript = []
|
||||||
for key, overlay in get_overlays().items():
|
for overlay in get_overlays().values():
|
||||||
if overlay.is_active():
|
if overlay.is_active():
|
||||||
overlay_js = overlay.get_javascript()
|
overlay_js = overlay.get_javascript()
|
||||||
if overlay_js:
|
if overlay_js:
|
||||||
js.append(json.dumps(overlay_js))
|
javascript.append(json.dumps(overlay_js))
|
||||||
return js
|
return javascript
|
||||||
|
|
||||||
|
|
||||||
def register_slide(name, callback):
|
def register_slide(name, callback):
|
||||||
@ -158,13 +157,14 @@ def register_slide_model(SlideModel, template):
|
|||||||
register_slide(SlideModel.slide_callback_name, model_slide)
|
register_slide(SlideModel.slide_callback_name, model_slide)
|
||||||
|
|
||||||
|
|
||||||
def set_active_slide(callback, kwargs={}):
|
def set_active_slide(callback, kwargs=None):
|
||||||
"""
|
"""
|
||||||
Set the active Slide.
|
Set the active Slide.
|
||||||
|
|
||||||
callback: The name of the slide callback.
|
callback: The name of the slide callback.
|
||||||
kwargs: Keyword arguments for the slide callback.
|
kwargs: Keyword arguments for the slide callback.
|
||||||
"""
|
"""
|
||||||
|
kwargs = kwargs or {}
|
||||||
kwargs.update(callback=callback)
|
kwargs.update(callback=callback)
|
||||||
config['projector_active_slide'] = kwargs
|
config['projector_active_slide'] = kwargs
|
||||||
update_projector()
|
update_projector()
|
||||||
|
@ -15,7 +15,7 @@ from django import forms
|
|||||||
from openslides.utils.forms import CssClassMixin
|
from openslides.utils.forms import CssClassMixin
|
||||||
|
|
||||||
|
|
||||||
class SelectWidgetsForm(forms.Form, CssClassMixin):
|
class SelectWidgetsForm(CssClassMixin, forms.Form):
|
||||||
"""
|
"""
|
||||||
Form to select the widgets.
|
Form to select the widgets.
|
||||||
"""
|
"""
|
||||||
|
@ -10,11 +10,10 @@
|
|||||||
:license: GNU GPL, see LICENSE for more details.
|
:license: GNU GPL, see LICENSE for more details.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from django.db import models
|
|
||||||
from django.dispatch import receiver
|
|
||||||
from django.utils.translation import ugettext_lazy, ugettext_noop
|
|
||||||
from django.core.exceptions import ImproperlyConfigured
|
from django.core.exceptions import ImproperlyConfigured
|
||||||
from django.core.urlresolvers import reverse
|
from django.core.urlresolvers import reverse
|
||||||
|
from django.db import models
|
||||||
|
from django.utils.translation import ugettext_lazy, ugettext_noop
|
||||||
|
|
||||||
from openslides.utils.utils import int_or_none
|
from openslides.utils.utils import int_or_none
|
||||||
|
|
||||||
@ -64,7 +63,7 @@ class SlideMixin(object):
|
|||||||
|
|
||||||
def save(self, *args, **kwargs):
|
def save(self, *args, **kwargs):
|
||||||
"""
|
"""
|
||||||
Updates the projector, if 'self' is the active slide.
|
Updates the projector, if the object is on the projector and changed.
|
||||||
"""
|
"""
|
||||||
from openslides.projector.api import update_projector
|
from openslides.projector.api import update_projector
|
||||||
value = super(SlideMixin, self).save(*args, **kwargs)
|
value = super(SlideMixin, self).save(*args, **kwargs)
|
||||||
@ -73,6 +72,9 @@ class SlideMixin(object):
|
|||||||
return value
|
return value
|
||||||
|
|
||||||
def delete(self, *args, **kwargs):
|
def delete(self, *args, **kwargs):
|
||||||
|
"""
|
||||||
|
Updates the projector, if the object is on the projector and is deleted.
|
||||||
|
"""
|
||||||
from openslides.projector.api import update_projector
|
from openslides.projector.api import update_projector
|
||||||
value = super(SlideMixin, self).delete(*args, **kwargs)
|
value = super(SlideMixin, self).delete(*args, **kwargs)
|
||||||
if self.is_active_slide():
|
if self.is_active_slide():
|
||||||
@ -100,9 +102,9 @@ class SlideMixin(object):
|
|||||||
"""
|
"""
|
||||||
from openslides.projector.api import get_active_slide
|
from openslides.projector.api import get_active_slide
|
||||||
active_slide = get_active_slide()
|
active_slide = get_active_slide()
|
||||||
pk = int_or_none(active_slide.get('pk', None))
|
slide_pk = int_or_none(active_slide.get('pk', None))
|
||||||
return (active_slide['callback'] == self.slide_callback_name and
|
return (active_slide['callback'] == self.slide_callback_name and
|
||||||
self.pk == pk)
|
self.pk == slide_pk)
|
||||||
|
|
||||||
def get_slide_context(self, **context):
|
def get_slide_context(self, **context):
|
||||||
"""
|
"""
|
||||||
|
@ -10,13 +10,10 @@
|
|||||||
:license: GNU GPL, see LICENSE for more details.
|
:license: GNU GPL, see LICENSE for more details.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from time import time
|
from django.template import RequestContext
|
||||||
|
|
||||||
from django.dispatch import receiver
|
|
||||||
from django.template.loader import render_to_string
|
from django.template.loader import render_to_string
|
||||||
|
|
||||||
from openslides.config.api import config
|
from openslides.config.api import config
|
||||||
from django.template import RequestContext
|
|
||||||
from openslides.utils.exceptions import OpenSlidesError
|
from openslides.utils.exceptions import OpenSlidesError
|
||||||
|
|
||||||
|
|
||||||
@ -24,7 +21,7 @@ class Widget(object):
|
|||||||
"""
|
"""
|
||||||
Class for a Widget for the Projector-Tab.
|
Class for a Widget for the Projector-Tab.
|
||||||
"""
|
"""
|
||||||
def __init__(self, request, name, html=None, template=None, context={},
|
def __init__(self, request, name, html=None, template=None, context=None,
|
||||||
permission_required=None, display_name=None, default_column=1,
|
permission_required=None, display_name=None, default_column=1,
|
||||||
default_weight=0):
|
default_weight=0):
|
||||||
self.name = name
|
self.name = name
|
||||||
@ -38,7 +35,7 @@ class Widget(object):
|
|||||||
elif template is not None:
|
elif template is not None:
|
||||||
self.html = render_to_string(
|
self.html = render_to_string(
|
||||||
template_name=template,
|
template_name=template,
|
||||||
dictionary=context,
|
dictionary=context or {},
|
||||||
context_instance=RequestContext(request))
|
context_instance=RequestContext(request))
|
||||||
else:
|
else:
|
||||||
raise OpenSlidesError('A Widget must have either a html or a template argument.')
|
raise OpenSlidesError('A Widget must have either a html or a template argument.')
|
||||||
@ -47,12 +44,21 @@ class Widget(object):
|
|||||||
self.default_weight = default_weight
|
self.default_weight = default_weight
|
||||||
|
|
||||||
def get_name(self):
|
def get_name(self):
|
||||||
|
"""
|
||||||
|
Returns the lower case of the widget name.
|
||||||
|
"""
|
||||||
return self.name.lower()
|
return self.name.lower()
|
||||||
|
|
||||||
def get_html(self):
|
def get_html(self):
|
||||||
|
"""
|
||||||
|
Returns the html code of the widget.
|
||||||
|
"""
|
||||||
return self.html
|
return self.html
|
||||||
|
|
||||||
def get_title(self):
|
def get_title(self):
|
||||||
|
"""
|
||||||
|
Returns the title of the widget.
|
||||||
|
"""
|
||||||
return self.display_name
|
return self.display_name
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
@ -76,15 +82,26 @@ class Overlay(object):
|
|||||||
self.allways_active = allways_active
|
self.allways_active = allways_active
|
||||||
|
|
||||||
def get_widget_html(self):
|
def get_widget_html(self):
|
||||||
|
"""
|
||||||
|
Returns the html code for the overlay widget.
|
||||||
|
|
||||||
|
Can return None, if the widget does not want to be in the widget.
|
||||||
|
"""
|
||||||
value = None
|
value = None
|
||||||
if self.widget_html_callback is not None:
|
if self.widget_html_callback is not None:
|
||||||
value = self.widget_html_callback()
|
value = self.widget_html_callback()
|
||||||
return value
|
return value
|
||||||
|
|
||||||
def get_projector_html(self):
|
def get_projector_html(self):
|
||||||
|
"""
|
||||||
|
Returns the html code for the projector.
|
||||||
|
"""
|
||||||
return self.get_html_wrapper(self.projector_html_callback())
|
return self.get_html_wrapper(self.projector_html_callback())
|
||||||
|
|
||||||
def get_javascript(self):
|
def get_javascript(self):
|
||||||
|
"""
|
||||||
|
Returns the java-script code for the projector.
|
||||||
|
"""
|
||||||
if self.javascript_callback is None:
|
if self.javascript_callback is None:
|
||||||
value = {}
|
value = {}
|
||||||
else:
|
else:
|
||||||
@ -92,12 +109,20 @@ class Overlay(object):
|
|||||||
return value
|
return value
|
||||||
|
|
||||||
def get_html_wrapper(self, inner_html):
|
def get_html_wrapper(self, inner_html):
|
||||||
|
"""
|
||||||
|
Returns the inner_html wrapped in a div.
|
||||||
|
|
||||||
|
The html-id of the div is "overlay_OVERLAYNAME"
|
||||||
|
"""
|
||||||
full_html = ''
|
full_html = ''
|
||||||
if inner_html is not None:
|
if inner_html is not None:
|
||||||
full_html = '<div id="overlay_%s">%s</div>' % (self.name, inner_html)
|
full_html = '<div id="overlay_%s">%s</div>' % (self.name, inner_html)
|
||||||
return full_html
|
return full_html
|
||||||
|
|
||||||
def is_active(self):
|
def is_active(self):
|
||||||
|
"""
|
||||||
|
Returns True if the overlay is activated. False in other case.
|
||||||
|
"""
|
||||||
return self.allways_active or self.name in config['projector_active_overlays']
|
return self.allways_active or self.name in config['projector_active_overlays']
|
||||||
|
|
||||||
def set_active(self, active):
|
def set_active(self, active):
|
||||||
@ -115,4 +140,7 @@ class Overlay(object):
|
|||||||
config['projector_active_overlays'] = list(active_overlays)
|
config['projector_active_overlays'] = list(active_overlays)
|
||||||
|
|
||||||
def show_on_projector(self):
|
def show_on_projector(self):
|
||||||
|
"""
|
||||||
|
Retruns True if the overlay should be shoun on the projector.
|
||||||
|
"""
|
||||||
return self.is_active() and self.get_projector_html() is not None
|
return self.is_active() and self.get_projector_html() is not None
|
||||||
|
@ -9,37 +9,31 @@
|
|||||||
:copyright: 2011–2013 by OpenSlides team, see AUTHORS.
|
:copyright: 2011–2013 by OpenSlides team, see AUTHORS.
|
||||||
:license: GNU GPL, see LICENSE for more details.
|
:license: GNU GPL, see LICENSE for more details.
|
||||||
"""
|
"""
|
||||||
from time import time
|
|
||||||
|
|
||||||
from django.dispatch import Signal, receiver
|
|
||||||
from django import forms
|
|
||||||
from django.template.loader import render_to_string
|
|
||||||
from django.core.context_processors import csrf
|
|
||||||
from django.contrib.staticfiles.templatetags.staticfiles import static
|
from django.contrib.staticfiles.templatetags.staticfiles import static
|
||||||
|
from django.core.context_processors import csrf
|
||||||
|
from django.dispatch import receiver, Signal
|
||||||
|
from django.template.loader import render_to_string
|
||||||
|
|
||||||
from openslides.config.api import config, ConfigVariable, ConfigPage
|
from openslides.config.api import config, ConfigPage, ConfigVariable
|
||||||
from openslides.config.signals import config_signal
|
from openslides.config.signals import config_signal
|
||||||
|
|
||||||
from .projector import Overlay
|
from .projector import Overlay
|
||||||
|
|
||||||
|
|
||||||
projector_overlays = Signal(providing_args=['request'])
|
projector_overlays = Signal(providing_args=['request'])
|
||||||
|
|
||||||
|
|
||||||
@receiver(config_signal, dispatch_uid='setup_projector_config_variables')
|
@receiver(config_signal, dispatch_uid='setup_projector_config_variables')
|
||||||
def setup_projector_config_variables(sender, **kwargs):
|
def config_variables(sender, **kwargs):
|
||||||
"""
|
"""
|
||||||
Projector config variables for OpenSlides. They are not shown on a
|
Projector config variables for OpenSlides. They are not shown on a
|
||||||
config page.
|
config page.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
# The active slide. The config-value is a dictonary with at least the entry
|
||||||
|
# 'callback'.
|
||||||
projector = ConfigVariable(
|
projector = ConfigVariable(
|
||||||
name='projector_active_slide',
|
name='projector_active_slide',
|
||||||
default_value={'callback': None})
|
default_value={'callback': None})
|
||||||
"""
|
|
||||||
The active slide. The config-value is a dictonary with at least the entrie
|
|
||||||
'callback'.
|
|
||||||
"""
|
|
||||||
|
|
||||||
projector_message = ConfigVariable(
|
projector_message = ConfigVariable(
|
||||||
name='projector_message',
|
name='projector_message',
|
||||||
@ -65,7 +59,7 @@ def setup_projector_config_variables(sender, **kwargs):
|
|||||||
name='bigger',
|
name='bigger',
|
||||||
default_value=100)
|
default_value=100)
|
||||||
|
|
||||||
up = ConfigVariable(
|
projector_up = ConfigVariable(
|
||||||
name='up',
|
name='up',
|
||||||
default_value=0)
|
default_value=0)
|
||||||
|
|
||||||
@ -77,7 +71,7 @@ def setup_projector_config_variables(sender, **kwargs):
|
|||||||
title='No title here', url='bar', required_permission=None, variables=(
|
title='No title here', url='bar', required_permission=None, variables=(
|
||||||
projector, projector_message,
|
projector, projector_message,
|
||||||
countdown_time, countdown_start_stamp, countdown_pause_stamp,
|
countdown_time, countdown_start_stamp, countdown_pause_stamp,
|
||||||
countdown_state, bigger, up, projector_active_overlays))
|
countdown_state, bigger, projector_up, projector_active_overlays))
|
||||||
|
|
||||||
|
|
||||||
@receiver(projector_overlays, dispatch_uid="projector_countdown")
|
@receiver(projector_overlays, dispatch_uid="projector_countdown")
|
||||||
@ -124,8 +118,8 @@ def countdown(sender, **kwargs):
|
|||||||
return Overlay(name, get_widget_html, get_projector_html, get_projector_js)
|
return Overlay(name, get_widget_html, get_projector_html, get_projector_js)
|
||||||
|
|
||||||
|
|
||||||
@receiver(projector_overlays, dispatch_uid="projector_message")
|
@receiver(projector_overlays, dispatch_uid="projector_overlay_message")
|
||||||
def projector_message(sender, **kwargs):
|
def projector_overlay_message(sender, **kwargs):
|
||||||
"""
|
"""
|
||||||
Receiver to show the overlay_message on the projector or the form in the
|
Receiver to show the overlay_message on the projector or the form in the
|
||||||
overlay-widget on the dashboard.
|
overlay-widget on the dashboard.
|
||||||
|
@ -14,5 +14,4 @@ from openslides.projector.api import register_slide_model
|
|||||||
|
|
||||||
from .models import ProjectorSlide
|
from .models import ProjectorSlide
|
||||||
|
|
||||||
|
|
||||||
register_slide_model(ProjectorSlide, 'projector/slide_projectorslide.html')
|
register_slide_model(ProjectorSlide, 'projector/slide_projectorslide.html')
|
||||||
|
@ -12,127 +12,103 @@
|
|||||||
|
|
||||||
from django.conf.urls import patterns, url
|
from django.conf.urls import patterns, url
|
||||||
|
|
||||||
from openslides.projector.views import (DashboardView, ActivateView,
|
from . import views
|
||||||
CustomSlideCreateView, CustomSlideUpdateView, CustomSlideDeleteView,
|
|
||||||
CountdownEdit, ProjectorEdit, Projector, ActivateOverlay, SelectWidgetsView,
|
|
||||||
OverlayMessageView)
|
|
||||||
|
|
||||||
|
urlpatterns = patterns(
|
||||||
urlpatterns = patterns('',
|
'',
|
||||||
url(r'^$',
|
url(r'^$',
|
||||||
Projector.as_view(),
|
views.Projector.as_view(),
|
||||||
name='projector_show',
|
name='projector_show'),
|
||||||
),
|
|
||||||
|
|
||||||
url(r'^preview/$',
|
url(r'^preview/$',
|
||||||
Projector.as_view(),
|
views.Projector.as_view(),
|
||||||
{'callback': None},
|
{'callback': None},
|
||||||
name='projctor_preview_welcomepage',
|
name='projctor_preview_welcomepage'),
|
||||||
),
|
|
||||||
|
|
||||||
url(r'^preview/(?P<callback>[^/]*)/$',
|
url(r'^preview/(?P<callback>[^/]*)/$',
|
||||||
Projector.as_view(),
|
views.Projector.as_view(),
|
||||||
name='projector_preview',
|
name='projector_preview'),
|
||||||
),
|
|
||||||
|
|
||||||
url(r'^activate/(?P<callback>[^/]*)/$',
|
url(r'^activate/(?P<callback>[^/]*)/$',
|
||||||
ActivateView.as_view(),
|
views.ActivateView.as_view(),
|
||||||
name='projector_activate_slide',
|
name='projector_activate_slide'),
|
||||||
),
|
|
||||||
|
|
||||||
url(r'^dashboard/$',
|
url(r'^dashboard/$',
|
||||||
DashboardView.as_view(),
|
views.DashboardView.as_view(),
|
||||||
name='dashboard',
|
name='dashboard'),
|
||||||
),
|
|
||||||
|
|
||||||
url(r'^widgets/$',
|
url(r'^widgets/$',
|
||||||
SelectWidgetsView.as_view(),
|
views.SelectWidgetsView.as_view(),
|
||||||
name='projector_select_widgets',
|
name='projector_select_widgets'),
|
||||||
),
|
|
||||||
|
|
||||||
url(r'^overlay_message/$',
|
url(r'^overlay_message/$',
|
||||||
OverlayMessageView.as_view(),
|
views.OverlayMessageView.as_view(),
|
||||||
name='projector_overlay_message',
|
name='projector_overlay_message'),
|
||||||
),
|
|
||||||
|
|
||||||
url(r'^new/$',
|
url(r'^new/$',
|
||||||
CustomSlideCreateView.as_view(),
|
views.CustomSlideCreateView.as_view(),
|
||||||
name='customslide_new',
|
name='customslide_new'),
|
||||||
),
|
|
||||||
|
|
||||||
url(r'^(?P<pk>\d+)/edit/$',
|
url(r'^(?P<pk>\d+)/edit/$',
|
||||||
CustomSlideUpdateView.as_view(),
|
views.CustomSlideUpdateView.as_view(),
|
||||||
name='customslide_edit',
|
name='customslide_edit'),
|
||||||
),
|
|
||||||
|
|
||||||
url(r'^(?P<pk>\d+)/del/$',
|
url(r'^(?P<pk>\d+)/del/$',
|
||||||
CustomSlideDeleteView.as_view(),
|
views.CustomSlideDeleteView.as_view(),
|
||||||
name='customslide_delete',
|
name='customslide_delete'),
|
||||||
),
|
|
||||||
|
|
||||||
url(r'^bigger/$',
|
url(r'^bigger/$',
|
||||||
ProjectorEdit.as_view(),
|
views.ProjectorEdit.as_view(),
|
||||||
{'direction': 'bigger'},
|
{'direction': 'bigger'},
|
||||||
name='projector_bigger',
|
name='projector_bigger'),
|
||||||
),
|
|
||||||
|
|
||||||
url(r'^smaller/$',
|
url(r'^smaller/$',
|
||||||
ProjectorEdit.as_view(),
|
views.ProjectorEdit.as_view(),
|
||||||
{'direction': 'smaller'},
|
{'direction': 'smaller'},
|
||||||
name='projector_smaller',
|
name='projector_smaller'),
|
||||||
),
|
|
||||||
|
|
||||||
url(r'^up/$',
|
url(r'^up/$',
|
||||||
ProjectorEdit.as_view(),
|
views.ProjectorEdit.as_view(),
|
||||||
{'direction': 'up'},
|
{'direction': 'up'},
|
||||||
name='projector_up',
|
name='projector_up'),
|
||||||
),
|
|
||||||
|
|
||||||
url(r'^down/$',
|
url(r'^down/$',
|
||||||
ProjectorEdit.as_view(),
|
views.ProjectorEdit.as_view(),
|
||||||
{'direction': 'down'},
|
{'direction': 'down'},
|
||||||
name='projector_down',
|
name='projector_down'),
|
||||||
),
|
|
||||||
|
|
||||||
url(r'^clean/$',
|
url(r'^clean/$',
|
||||||
ProjectorEdit.as_view(),
|
views.ProjectorEdit.as_view(),
|
||||||
{'direction': 'clean'},
|
{'direction': 'clean'},
|
||||||
name='projector_clean',
|
name='projector_clean'),
|
||||||
),
|
|
||||||
|
|
||||||
url(r'^countdown/reset/$',
|
url(r'^countdown/reset/$',
|
||||||
CountdownEdit.as_view(),
|
views.CountdownEdit.as_view(),
|
||||||
{'command': 'reset'},
|
{'command': 'reset'},
|
||||||
name='countdown_reset',
|
name='countdown_reset'),
|
||||||
),
|
|
||||||
|
|
||||||
url(r'^countdown/start/$',
|
url(r'^countdown/start/$',
|
||||||
CountdownEdit.as_view(),
|
views.CountdownEdit.as_view(),
|
||||||
{'command': 'start'},
|
{'command': 'start'},
|
||||||
name='countdown_start',
|
name='countdown_start'),
|
||||||
),
|
|
||||||
|
|
||||||
url(r'^countdown/stop/$',
|
url(r'^countdown/stop/$',
|
||||||
CountdownEdit.as_view(),
|
views.CountdownEdit.as_view(),
|
||||||
{'command': 'stop'},
|
{'command': 'stop'},
|
||||||
name='countdown_stop',
|
name='countdown_stop'),
|
||||||
),
|
|
||||||
|
|
||||||
url(r'^countdown/set-default/$',
|
url(r'^countdown/set-default/$',
|
||||||
CountdownEdit.as_view(),
|
views.CountdownEdit.as_view(),
|
||||||
{'command': 'set-default'},
|
{'command': 'set-default'},
|
||||||
name='countdown_set_default',
|
name='countdown_set_default'),
|
||||||
),
|
|
||||||
|
|
||||||
url('^overlay/(?P<name>[^/]*)/activate/$',
|
url('^overlay/(?P<name>[^/]*)/activate/$',
|
||||||
ActivateOverlay.as_view(),
|
views.ActivateOverlay.as_view(),
|
||||||
{'activate': True},
|
{'activate': True},
|
||||||
name='projector_overlay_activate',
|
name='projector_overlay_activate'),
|
||||||
),
|
|
||||||
|
|
||||||
url('^overlay/(?P<name>[^/]*)/deactivate/$',
|
url('^overlay/(?P<name>[^/]*)/deactivate/$',
|
||||||
ActivateOverlay.as_view(),
|
views.ActivateOverlay.as_view(),
|
||||||
{'activate': False},
|
{'activate': False},
|
||||||
name='projector_overlay_deactivate',
|
name='projector_overlay_deactivate'),
|
||||||
),
|
|
||||||
)
|
)
|
||||||
|
@ -10,27 +10,24 @@
|
|||||||
:license: GNU GPL, see LICENSE for more details.
|
:license: GNU GPL, see LICENSE for more details.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from datetime import datetime
|
|
||||||
from time import time
|
from time import time
|
||||||
|
|
||||||
from django.contrib import messages
|
from django.contrib import messages
|
||||||
from django.core.cache import cache
|
|
||||||
from django.core.context_processors import csrf
|
from django.core.context_processors import csrf
|
||||||
from django.core.urlresolvers import reverse
|
from django.core.urlresolvers import reverse
|
||||||
from django.db import transaction
|
from django.db import transaction
|
||||||
from django.db.models import Q
|
|
||||||
from django.shortcuts import redirect
|
from django.shortcuts import redirect
|
||||||
from django.template import RequestContext
|
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import ugettext as _
|
||||||
|
|
||||||
from openslides.utils.template import Tab
|
|
||||||
from openslides.utils.views import (
|
|
||||||
TemplateView, RedirectView, CreateView, UpdateView, DeleteView, AjaxMixin)
|
|
||||||
from openslides.config.api import config
|
from openslides.config.api import config
|
||||||
from .api import (
|
from openslides.utils.template import Tab
|
||||||
get_projector_content, get_projector_overlays, get_all_widgets,
|
from openslides.utils.views import (AjaxMixin, CreateView, DeleteView,
|
||||||
set_active_slide, update_projector, get_active_slide, update_projector_overlay,
|
RedirectView, TemplateView, UpdateView)
|
||||||
get_overlays, get_projector_overlays_js)
|
|
||||||
|
from .api import (get_active_slide, get_all_widgets, get_overlays,
|
||||||
|
get_projector_content, get_projector_overlays,
|
||||||
|
get_projector_overlays_js, set_active_slide,
|
||||||
|
update_projector_overlay)
|
||||||
from .forms import SelectWidgetsForm
|
from .forms import SelectWidgetsForm
|
||||||
from .models import ProjectorSlide
|
from .models import ProjectorSlide
|
||||||
from .projector import Widget
|
from .projector import Widget
|
||||||
@ -118,6 +115,9 @@ class SelectWidgetsView(TemplateView):
|
|||||||
|
|
||||||
@transaction.commit_manually
|
@transaction.commit_manually
|
||||||
def post(self, request, *args, **kwargs):
|
def post(self, request, *args, **kwargs):
|
||||||
|
"""
|
||||||
|
Activates or deactivates the widgets in a post request.
|
||||||
|
"""
|
||||||
context = self.get_context_data(**kwargs)
|
context = self.get_context_data(**kwargs)
|
||||||
activated_widgets = self.request.session.get('widgets', {})
|
activated_widgets = self.request.session.get('widgets', {})
|
||||||
|
|
||||||
|
@ -11,13 +11,13 @@
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.conf.urls import patterns, url, include
|
from django.conf.urls import include, patterns, url
|
||||||
from django.utils.importlib import import_module
|
from django.utils.importlib import import_module
|
||||||
|
|
||||||
|
|
||||||
handler500 = 'openslides.utils.views.server_error'
|
handler500 = 'openslides.utils.views.server_error'
|
||||||
|
|
||||||
urlpatterns = patterns('',
|
urlpatterns = patterns(
|
||||||
|
'',
|
||||||
(r'^agenda/', include('openslides.agenda.urls')),
|
(r'^agenda/', include('openslides.agenda.urls')),
|
||||||
(r'^motion/', include('openslides.motion.urls')),
|
(r'^motion/', include('openslides.motion.urls')),
|
||||||
(r'^assignment/', include('openslides.assignment.urls')),
|
(r'^assignment/', include('openslides.assignment.urls')),
|
||||||
@ -28,7 +28,7 @@ urlpatterns = patterns('',
|
|||||||
(r'^i18n/', include('django.conf.urls.i18n')),
|
(r'^i18n/', include('django.conf.urls.i18n')),
|
||||||
)
|
)
|
||||||
|
|
||||||
js_info_dict = {'packages': [],}
|
js_info_dict = {'packages': []}
|
||||||
|
|
||||||
for plugin in settings.INSTALLED_PLUGINS:
|
for plugin in settings.INSTALLED_PLUGINS:
|
||||||
try:
|
try:
|
||||||
@ -41,30 +41,29 @@ for plugin in settings.INSTALLED_PLUGINS:
|
|||||||
% plugin)))
|
% plugin)))
|
||||||
js_info_dict['packages'].append(plugin)
|
js_info_dict['packages'].append(plugin)
|
||||||
|
|
||||||
urlpatterns += patterns('',
|
# TODO: move this patterns into core or the participant app
|
||||||
|
urlpatterns += patterns(
|
||||||
|
'',
|
||||||
(r'^jsi18n/$', 'django.views.i18n.javascript_catalog', js_info_dict),
|
(r'^jsi18n/$', 'django.views.i18n.javascript_catalog', js_info_dict),
|
||||||
|
|
||||||
url(r'^login/$',
|
url(r'^login/$',
|
||||||
'openslides.participant.views.login',
|
'openslides.participant.views.login',
|
||||||
name='user_login',
|
name='user_login'),
|
||||||
),
|
|
||||||
|
|
||||||
url(r'^logout/$',
|
url(r'^logout/$',
|
||||||
'django.contrib.auth.views.logout_then_login',
|
'django.contrib.auth.views.logout_then_login',
|
||||||
name='user_logout',
|
name='user_logout'),
|
||||||
),
|
|
||||||
|
|
||||||
url(r'^usersettings/$',
|
url(r'^usersettings/$',
|
||||||
'openslides.participant.views.user_settings',
|
'openslides.participant.views.user_settings',
|
||||||
name='user_settings',
|
name='user_settings'),
|
||||||
),
|
|
||||||
|
|
||||||
url(r'^usersettings/changepassword/$',
|
url(r'^usersettings/changepassword/$',
|
||||||
'openslides.participant.views.user_settings_password',
|
'openslides.participant.views.user_settings_password',
|
||||||
name='password_change',
|
name='password_change'),
|
||||||
),
|
|
||||||
)
|
)
|
||||||
|
|
||||||
urlpatterns += patterns('',
|
urlpatterns += patterns(
|
||||||
|
'',
|
||||||
(r'^', include('openslides.core.urls')),
|
(r'^', include('openslides.core.urls')),
|
||||||
)
|
)
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
from django.contrib.auth.models import Permission
|
from django.contrib.auth.models import Permission
|
||||||
|
|
||||||
from openslides.config.api import config
|
from openslides.config.api import config
|
||||||
|
|
||||||
|
|
||||||
|
@ -5,4 +5,4 @@
|
|||||||
:license: GNU GPL, see LICENSE for more details.
|
:license: GNU GPL, see LICENSE for more details.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from AnonymousAuth import *
|
from AnonymousAuth import * # noqa
|
||||||
|
@ -11,10 +11,9 @@
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
import bleach
|
import bleach
|
||||||
|
|
||||||
from django import forms
|
from django import forms
|
||||||
from django.utils.translation import ugettext as _, ugettext_lazy
|
from django.utils.translation import ugettext as _
|
||||||
|
from django.utils.translation import ugettext_lazy
|
||||||
|
|
||||||
# Allowed tags, attributes and styles allowed in textareas edited with a JS
|
# Allowed tags, attributes and styles allowed in textareas edited with a JS
|
||||||
# editor. Everything not in these whitelists is stripped.
|
# editor. Everything not in these whitelists is stripped.
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
import json
|
import json
|
||||||
|
|
||||||
from django.db import models
|
|
||||||
from django.core.serializers.json import DjangoJSONEncoder
|
from django.core.serializers.json import DjangoJSONEncoder
|
||||||
from django.utils.translation import ugettext as _
|
from django.db import models
|
||||||
from django.forms.fields import Field
|
from django.forms.fields import Field
|
||||||
from django.forms.util import ValidationError as FormValidationError
|
from django.forms.util import ValidationError as FormValidationError
|
||||||
|
from django.utils.translation import ugettext as _
|
||||||
|
|
||||||
|
|
||||||
class JSONFormField(Field):
|
class JSONFormField(Field):
|
||||||
|
@ -13,20 +13,18 @@
|
|||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from os.path import join as path_join
|
from os.path import join as path_join
|
||||||
|
|
||||||
|
from django.conf import settings
|
||||||
|
from django.utils import formats
|
||||||
|
from django.utils.translation import ugettext as _
|
||||||
from reportlab.lib import colors
|
from reportlab.lib import colors
|
||||||
from reportlab.lib.styles import StyleSheet1, ParagraphStyle
|
from reportlab.lib.styles import ParagraphStyle, StyleSheet1
|
||||||
from reportlab.lib.units import cm
|
from reportlab.lib.units import cm
|
||||||
from reportlab.pdfbase import pdfmetrics
|
from reportlab.pdfbase import pdfmetrics
|
||||||
from reportlab.pdfbase.ttfonts import TTFont
|
from reportlab.pdfbase.ttfonts import TTFont
|
||||||
from reportlab.rl_config import defaultPageSize
|
from reportlab.rl_config import defaultPageSize
|
||||||
|
|
||||||
from django.conf import settings
|
|
||||||
from django.utils import formats
|
|
||||||
from django.utils.translation import ugettext as _
|
|
||||||
|
|
||||||
from openslides.config.api import config
|
from openslides.config.api import config
|
||||||
|
|
||||||
|
|
||||||
# register new truetype fonts
|
# register new truetype fonts
|
||||||
pdfmetrics.registerFont(TTFont(
|
pdfmetrics.registerFont(TTFont(
|
||||||
'Ubuntu', path_join(settings.SITE_ROOT, 'static/fonts/Ubuntu-R.ttf')))
|
'Ubuntu', path_join(settings.SITE_ROOT, 'static/fonts/Ubuntu-R.ttf')))
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
|
|
||||||
from django import forms
|
from django import forms
|
||||||
|
|
||||||
from openslides.utils.person.api import Persons, get_person
|
from openslides.utils.person.api import get_person, Persons
|
||||||
|
|
||||||
|
|
||||||
class PersonChoices(object):
|
class PersonChoices(object):
|
||||||
|
@ -9,13 +9,13 @@
|
|||||||
:copyright: 2011, 2012 by OpenSlides team, see AUTHORS.
|
:copyright: 2011, 2012 by OpenSlides team, see AUTHORS.
|
||||||
:license: GNU GPL, see LICENSE for more details.
|
:license: GNU GPL, see LICENSE for more details.
|
||||||
"""
|
"""
|
||||||
from django.db import models
|
|
||||||
from django.contrib.auth.models import AnonymousUser
|
from django.contrib.auth.models import AnonymousUser
|
||||||
|
from django.db import models
|
||||||
|
|
||||||
from openslides.utils.exceptions import OpenSlidesError
|
from openslides.utils.exceptions import OpenSlidesError
|
||||||
|
|
||||||
|
from .api import generate_person_id, get_person
|
||||||
from .forms import PersonFormField
|
from .forms import PersonFormField
|
||||||
from .api import get_person, generate_person_id
|
|
||||||
|
|
||||||
|
|
||||||
class PersonField(models.fields.Field):
|
class PersonField(models.fields.Field):
|
||||||
|
@ -13,8 +13,8 @@
|
|||||||
|
|
||||||
from django.test import TestCase as _TestCase
|
from django.test import TestCase as _TestCase
|
||||||
|
|
||||||
from openslides.core.signals import post_database_setup
|
|
||||||
from openslides.config.api import config
|
from openslides.config.api import config
|
||||||
|
from openslides.core.signals import post_database_setup
|
||||||
|
|
||||||
|
|
||||||
class TestCase(_TestCase):
|
class TestCase(_TestCase):
|
||||||
|
@ -11,16 +11,15 @@
|
|||||||
import posixpath
|
import posixpath
|
||||||
from urllib import unquote
|
from urllib import unquote
|
||||||
|
|
||||||
|
from django.conf import settings
|
||||||
|
from django.core.handlers.wsgi import WSGIHandler as Django_WSGIHandler
|
||||||
|
from django.utils.translation import ugettext as _
|
||||||
from tornado.httpserver import HTTPServer
|
from tornado.httpserver import HTTPServer
|
||||||
from tornado.ioloop import IOLoop
|
from tornado.ioloop import IOLoop
|
||||||
from tornado.web import FallbackHandler, Application, StaticFileHandler
|
from tornado.options import parse_command_line
|
||||||
|
from tornado.web import Application, FallbackHandler, StaticFileHandler
|
||||||
from tornado.websocket import WebSocketHandler
|
from tornado.websocket import WebSocketHandler
|
||||||
from tornado.wsgi import WSGIContainer
|
from tornado.wsgi import WSGIContainer
|
||||||
from tornado.options import parse_command_line
|
|
||||||
|
|
||||||
from django.core.handlers.wsgi import WSGIHandler as Django_WSGIHandler
|
|
||||||
from django.conf import settings
|
|
||||||
from django.utils.translation import ugettext as _
|
|
||||||
|
|
||||||
|
|
||||||
class DjangoStaticFileHandler(StaticFileHandler):
|
class DjangoStaticFileHandler(StaticFileHandler):
|
||||||
|
@ -12,8 +12,6 @@
|
|||||||
|
|
||||||
import json
|
import json
|
||||||
from cStringIO import StringIO
|
from cStringIO import StringIO
|
||||||
from reportlab.platypus import SimpleDocTemplate, Spacer
|
|
||||||
from reportlab.lib.units import cm
|
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.contrib import messages
|
from django.contrib import messages
|
||||||
@ -32,7 +30,6 @@ from django.utils.translation import ugettext as _
|
|||||||
from django.utils.translation import ugettext_lazy
|
from django.utils.translation import ugettext_lazy
|
||||||
from django.views import generic as django_views
|
from django.views import generic as django_views
|
||||||
from django.views.generic.detail import SingleObjectMixin
|
from django.views.generic.detail import SingleObjectMixin
|
||||||
from django.views.generic.list import TemplateResponseMixin
|
|
||||||
from reportlab.lib.units import cm
|
from reportlab.lib.units import cm
|
||||||
from reportlab.platypus import SimpleDocTemplate, Spacer
|
from reportlab.platypus import SimpleDocTemplate, Spacer
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
Fabric==1.6.1
|
Fabric==1.6.1
|
||||||
coverage==3.6
|
coverage==3.6
|
||||||
django-discover-runner==0.4
|
django-discover-runner==0.4
|
||||||
pep8==1.4.5
|
flake8==2.0
|
||||||
|
|
||||||
# Requirements for OpenSlides handbook/documentation
|
# Requirements for OpenSlides handbook/documentation
|
||||||
Sphinx==1.2b1
|
Sphinx==1.2b1
|
||||||
|
@ -10,9 +10,9 @@
|
|||||||
|
|
||||||
from django.test.client import Client
|
from django.test.client import Client
|
||||||
|
|
||||||
from openslides.utils.test import TestCase
|
|
||||||
from openslides.config.api import config
|
from openslides.config.api import config
|
||||||
from openslides.participant.models import User
|
from openslides.participant.models import User
|
||||||
|
from openslides.utils.test import TestCase
|
||||||
|
|
||||||
|
|
||||||
class PersonalInfoWidget(TestCase):
|
class PersonalInfoWidget(TestCase):
|
||||||
@ -79,8 +79,8 @@ class PersonalInfoWidget(TestCase):
|
|||||||
if motion:
|
if motion:
|
||||||
motion_1 = motion.models.Motion.objects.create(title='My Motion Title pa8aeNohYai0ahge', text='My Motion Text')
|
motion_1 = motion.models.Motion.objects.create(title='My Motion Title pa8aeNohYai0ahge', text='My Motion Text')
|
||||||
motion_2 = motion.models.Motion.objects.create(title='My Motion Title quielohL7vah1weochai', text='My Motion Text')
|
motion_2 = motion.models.Motion.objects.create(title='My Motion Title quielohL7vah1weochai', text='My Motion Text')
|
||||||
submitter_1 = motion.models.MotionSubmitter.objects.create(motion=motion_1, person=self.user)
|
motion.models.MotionSubmitter.objects.create(motion=motion_1, person=self.user)
|
||||||
submitter_2 = motion.models.MotionSubmitter.objects.create(motion=motion_2, person=self.user)
|
motion.models.MotionSubmitter.objects.create(motion=motion_2, person=self.user)
|
||||||
response = self.client.get('/projector/dashboard/')
|
response = self.client.get('/projector/dashboard/')
|
||||||
self.assertContains(response, 'I submitted the following motions:', status_code=200)
|
self.assertContains(response, 'I submitted the following motions:', status_code=200)
|
||||||
self.assertContains(response, 'My Motion Title pa8aeNohYai0ahge', status_code=200)
|
self.assertContains(response, 'My Motion Title pa8aeNohYai0ahge', status_code=200)
|
||||||
@ -91,8 +91,8 @@ class PersonalInfoWidget(TestCase):
|
|||||||
if motion:
|
if motion:
|
||||||
motion_1 = motion.models.Motion.objects.create(title='My Motion Title jahN9phaiThae5ooKubu', text='My Motion Text')
|
motion_1 = motion.models.Motion.objects.create(title='My Motion Title jahN9phaiThae5ooKubu', text='My Motion Text')
|
||||||
motion_2 = motion.models.Motion.objects.create(title='My Motion Title vech9ash8aeh9eej2Ga2', text='My Motion Text')
|
motion_2 = motion.models.Motion.objects.create(title='My Motion Title vech9ash8aeh9eej2Ga2', text='My Motion Text')
|
||||||
supporter_1 = motion.models.MotionSupporter.objects.create(motion=motion_1, person=self.user)
|
motion.models.MotionSupporter.objects.create(motion=motion_1, person=self.user)
|
||||||
supporter_2 = motion.models.MotionSupporter.objects.create(motion=motion_2, person=self.user)
|
motion.models.MotionSupporter.objects.create(motion=motion_2, person=self.user)
|
||||||
config['motion_min_supporters'] = 1
|
config['motion_min_supporters'] = 1
|
||||||
response = self.client.get('/projector/dashboard/')
|
response = self.client.get('/projector/dashboard/')
|
||||||
self.assertContains(response, 'I support the following motions:', status_code=200)
|
self.assertContains(response, 'I support the following motions:', status_code=200)
|
||||||
|
@ -9,12 +9,11 @@
|
|||||||
|
|
||||||
from django.test.client import Client
|
from django.test.client import Client
|
||||||
|
|
||||||
|
from openslides.agenda.models import Item, Speaker
|
||||||
|
from openslides.participant.models import Group, User
|
||||||
|
from openslides.projector.api import set_active_slide
|
||||||
from openslides.utils.exceptions import OpenSlidesError
|
from openslides.utils.exceptions import OpenSlidesError
|
||||||
from openslides.utils.test import TestCase
|
from openslides.utils.test import TestCase
|
||||||
from openslides.participant.models import User, Group
|
|
||||||
from openslides.agenda.models import Item, Speaker
|
|
||||||
from openslides.config.api import config
|
|
||||||
from openslides.projector.api import set_active_slide
|
|
||||||
|
|
||||||
|
|
||||||
class ListOfSpeakerModelTests(TestCase):
|
class ListOfSpeakerModelTests(TestCase):
|
||||||
@ -151,7 +150,7 @@ class TestAgendaItemView(SpeakerViewTestCase):
|
|||||||
group = Group.objects.create(name='test', group_as_person=True)
|
group = Group.objects.create(name='test', group_as_person=True)
|
||||||
Speaker.objects.add(group, self.item1)
|
Speaker.objects.add(group, self.item1)
|
||||||
self.assertTrue(Speaker.objects.filter(person=group.person_id, item=self.item1).exists())
|
self.assertTrue(Speaker.objects.filter(person=group.person_id, item=self.item1).exists())
|
||||||
response = self.admin_client.get('/agenda/1/')
|
self.admin_client.get('/agenda/1/')
|
||||||
|
|
||||||
|
|
||||||
class TestSpeakerDeleteView(SpeakerViewTestCase):
|
class TestSpeakerDeleteView(SpeakerViewTestCase):
|
||||||
@ -167,7 +166,7 @@ class TestSpeakerDeleteView(SpeakerViewTestCase):
|
|||||||
self.assertFalse(Speaker.objects.filter(person=self.speaker1, item=self.item1).exists())
|
self.assertFalse(Speaker.objects.filter(person=self.speaker1, item=self.item1).exists())
|
||||||
|
|
||||||
def test_post_as_user(self):
|
def test_post_as_user(self):
|
||||||
speaker = Speaker.objects.add(self.speaker1, self.item1)
|
Speaker.objects.add(self.speaker1, self.item1)
|
||||||
|
|
||||||
response = self.speaker1_client.post(
|
response = self.speaker1_client.post(
|
||||||
'/agenda/1/speaker/del/', {'yes': 'yes'})
|
'/agenda/1/speaker/del/', {'yes': 'yes'})
|
||||||
@ -204,11 +203,11 @@ class TestSpeakerEndSpeachView(SpeakerViewTestCase):
|
|||||||
|
|
||||||
class SpeakerListOpenView(SpeakerViewTestCase):
|
class SpeakerListOpenView(SpeakerViewTestCase):
|
||||||
def test_get(self):
|
def test_get(self):
|
||||||
response = self.check_url('/agenda/1/speaker/close/', self.admin_client, 302)
|
self.check_url('/agenda/1/speaker/close/', self.admin_client, 302)
|
||||||
item = Item.objects.get(pk=self.item1.pk)
|
item = Item.objects.get(pk=self.item1.pk)
|
||||||
self.assertTrue(item.speaker_list_closed)
|
self.assertTrue(item.speaker_list_closed)
|
||||||
|
|
||||||
response = self.check_url('/agenda/1/speaker/reopen/', self.admin_client, 302)
|
self.check_url('/agenda/1/speaker/reopen/', self.admin_client, 302)
|
||||||
item = Item.objects.get(pk=self.item1.pk)
|
item = Item.objects.get(pk=self.item1.pk)
|
||||||
self.assertFalse(item.speaker_list_closed)
|
self.assertFalse(item.speaker_list_closed)
|
||||||
|
|
||||||
|
@ -10,16 +10,14 @@
|
|||||||
:license: GNU GPL, see LICENSE for more details.
|
:license: GNU GPL, see LICENSE for more details.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from django.test.client import Client
|
|
||||||
from django.db.models.query import EmptyQuerySet
|
from django.db.models.query import EmptyQuerySet
|
||||||
|
from django.test.client import Client
|
||||||
|
|
||||||
from openslides.utils.test import TestCase
|
|
||||||
from openslides.projector.api import get_active_slide, set_active_slide
|
|
||||||
from openslides.participant.models import User
|
|
||||||
from openslides.agenda.models import Item
|
from openslides.agenda.models import Item
|
||||||
from openslides.agenda.slides import agenda_slide
|
from openslides.participant.models import User
|
||||||
|
from openslides.utils.test import TestCase
|
||||||
|
|
||||||
from .models import RelatedItem, BadRelatedItem
|
from .models import BadRelatedItem, RelatedItem
|
||||||
|
|
||||||
|
|
||||||
class ItemTest(TestCase):
|
class ItemTest(TestCase):
|
||||||
|
@ -10,10 +10,10 @@
|
|||||||
|
|
||||||
from django.test.client import Client
|
from django.test.client import Client
|
||||||
|
|
||||||
from openslides.utils.test import TestCase
|
|
||||||
from openslides.agenda.models import Item
|
from openslides.agenda.models import Item
|
||||||
from openslides.assignment.models import Assignment
|
from openslides.assignment.models import Assignment
|
||||||
from openslides.participant.models import User
|
from openslides.participant.models import User
|
||||||
|
from openslides.utils.test import TestCase
|
||||||
|
|
||||||
|
|
||||||
class AssignmentModelTest(TestCase):
|
class AssignmentModelTest(TestCase):
|
||||||
|
@ -10,10 +10,9 @@
|
|||||||
|
|
||||||
from django.test.client import Client
|
from django.test.client import Client
|
||||||
|
|
||||||
from openslides.config.api import config
|
|
||||||
from openslides.utils.test import TestCase
|
|
||||||
from openslides.assignment.models import Assignment
|
from openslides.assignment.models import Assignment
|
||||||
from openslides.participant.models import User, Group
|
from openslides.participant.models import Group, User
|
||||||
|
from openslides.utils.test import TestCase
|
||||||
|
|
||||||
|
|
||||||
class AssignmentViewTestCase(TestCase):
|
class AssignmentViewTestCase(TestCase):
|
||||||
|
@ -8,17 +8,18 @@
|
|||||||
:license: GNU GPL, see LICENSE for more details.
|
:license: GNU GPL, see LICENSE for more details.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from django.test.client import Client
|
|
||||||
from django.dispatch import receiver
|
|
||||||
from django.contrib.contenttypes.models import ContentType
|
|
||||||
from django.contrib.auth.models import Permission
|
|
||||||
from django import forms
|
from django import forms
|
||||||
|
from django.contrib.auth.models import Permission
|
||||||
|
from django.contrib.contenttypes.models import ContentType
|
||||||
|
from django.dispatch import receiver
|
||||||
|
from django.test.client import Client
|
||||||
|
|
||||||
from openslides.utils.test import TestCase
|
from openslides.config.api import (config, ConfigGroup, ConfigGroupedPage,
|
||||||
from openslides.participant.models import User
|
ConfigPage, ConfigVariable)
|
||||||
from openslides.config.api import config, ConfigGroupedPage, ConfigPage, ConfigGroup, ConfigVariable
|
|
||||||
from openslides.config.signals import config_signal
|
|
||||||
from openslides.config.exceptions import ConfigError, ConfigNotFound
|
from openslides.config.exceptions import ConfigError, ConfigNotFound
|
||||||
|
from openslides.config.signals import config_signal
|
||||||
|
from openslides.participant.models import User
|
||||||
|
from openslides.utils.test import TestCase
|
||||||
|
|
||||||
|
|
||||||
class HandleConfigTest(TestCase):
|
class HandleConfigTest(TestCase):
|
||||||
|
@ -8,10 +8,10 @@
|
|||||||
:license: GNU GPL, see LICENSE for more details.
|
:license: GNU GPL, see LICENSE for more details.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from django.template import Template, Context
|
from django.template import Context, Template
|
||||||
|
|
||||||
from openslides.utils.test import TestCase
|
|
||||||
from openslides.config.api import config
|
from openslides.config.api import config
|
||||||
|
from openslides.utils.test import TestCase
|
||||||
|
|
||||||
from .models import TestModel
|
from .models import TestModel
|
||||||
|
|
||||||
|
@ -10,14 +10,14 @@
|
|||||||
|
|
||||||
from django.test.client import Client
|
from django.test.client import Client
|
||||||
|
|
||||||
from openslides.utils.test import TestCase
|
|
||||||
from openslides import get_version
|
from openslides import get_version
|
||||||
from openslides.participant.models import User
|
from openslides.participant.models import User
|
||||||
|
from openslides.utils.test import TestCase
|
||||||
|
|
||||||
|
|
||||||
class VersionViewTest(TestCase):
|
class VersionViewTest(TestCase):
|
||||||
def test_get(self):
|
def test_get(self):
|
||||||
user = User.objects.create_user('CoreMaximilian', 'xxx@xx.xx', 'default')
|
User.objects.create_user('CoreMaximilian', 'xxx@xx.xx', 'default')
|
||||||
client = Client()
|
client = Client()
|
||||||
client.login(username='CoreMaximilian', password='default')
|
client.login(username='CoreMaximilian', password='default')
|
||||||
response = client.get('/version/')
|
response = client.get('/version/')
|
||||||
|
@ -8,10 +8,9 @@
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
from django import forms
|
from django import forms
|
||||||
from django.db import models
|
|
||||||
|
|
||||||
from openslides.utils.test import TestCase
|
|
||||||
from openslides.utils.forms import CleanHtmlFormMixin
|
from openslides.utils.forms import CleanHtmlFormMixin
|
||||||
|
from openslides.utils.test import TestCase
|
||||||
|
|
||||||
|
|
||||||
class HtmlTestForm(CleanHtmlFormMixin, forms.Form):
|
class HtmlTestForm(CleanHtmlFormMixin, forms.Form):
|
||||||
|
@ -13,15 +13,15 @@
|
|||||||
import os
|
import os
|
||||||
import tempfile
|
import tempfile
|
||||||
|
|
||||||
from django.test.client import Client
|
|
||||||
from django.core.files.uploadedfile import SimpleUploadedFile
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.contrib.contenttypes.models import ContentType
|
|
||||||
from django.contrib.auth.models import Permission
|
from django.contrib.auth.models import Permission
|
||||||
|
from django.contrib.contenttypes.models import ContentType
|
||||||
|
from django.core.files.uploadedfile import SimpleUploadedFile
|
||||||
|
from django.test.client import Client
|
||||||
|
|
||||||
from openslides.utils.test import TestCase
|
|
||||||
from openslides.mediafile.models import Mediafile
|
from openslides.mediafile.models import Mediafile
|
||||||
from openslides.participant.models import User
|
from openslides.participant.models import User
|
||||||
|
from openslides.utils.test import TestCase
|
||||||
|
|
||||||
|
|
||||||
class MediafileTest(TestCase):
|
class MediafileTest(TestCase):
|
||||||
@ -33,7 +33,6 @@ class MediafileTest(TestCase):
|
|||||||
ct = ContentType.objects.get(app_label='mediafile', model='mediafile')
|
ct = ContentType.objects.get(app_label='mediafile', model='mediafile')
|
||||||
perm_1 = Permission.objects.get(content_type=ct, codename='can_see')
|
perm_1 = Permission.objects.get(content_type=ct, codename='can_see')
|
||||||
perm_2 = Permission.objects.get(content_type=ct, codename='can_upload')
|
perm_2 = Permission.objects.get(content_type=ct, codename='can_upload')
|
||||||
perm_3 = Permission.objects.get(content_type=ct, codename='can_manage')
|
|
||||||
|
|
||||||
# Setup three different users
|
# Setup three different users
|
||||||
self.manager = User.objects.get(pk=1)
|
self.manager = User.objects.get(pk=1)
|
||||||
|
@ -8,14 +8,13 @@
|
|||||||
:license: GNU GPL, see LICENSE for more details.
|
:license: GNU GPL, see LICENSE for more details.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import StringIO
|
|
||||||
import os
|
import os
|
||||||
|
import StringIO
|
||||||
|
|
||||||
from django.test.client import Client
|
from django.test.client import Client
|
||||||
|
|
||||||
from openslides.config.api import config
|
|
||||||
from openslides.motion.models import Motion, Category
|
|
||||||
from openslides.motion.csv_import import import_motions
|
from openslides.motion.csv_import import import_motions
|
||||||
|
from openslides.motion.models import Category, Motion
|
||||||
from openslides.participant.models import User
|
from openslides.participant.models import User
|
||||||
from openslides.utils.test import TestCase
|
from openslides.utils.test import TestCase
|
||||||
|
|
||||||
|
@ -8,11 +8,11 @@
|
|||||||
:license: GNU GPL, see LICENSE for more details.
|
:license: GNU GPL, see LICENSE for more details.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from openslides.utils.test import TestCase
|
|
||||||
from openslides.participant.models import User
|
|
||||||
from openslides.config.api import config
|
from openslides.config.api import config
|
||||||
from openslides.motion.models import Motion, Workflow, State
|
|
||||||
from openslides.motion.exceptions import WorkflowError
|
from openslides.motion.exceptions import WorkflowError
|
||||||
|
from openslides.motion.models import Motion, State, Workflow
|
||||||
|
from openslides.participant.models import User
|
||||||
|
from openslides.utils.test import TestCase
|
||||||
|
|
||||||
|
|
||||||
class ModelTest(TestCase):
|
class ModelTest(TestCase):
|
||||||
@ -58,7 +58,6 @@ class ModelTest(TestCase):
|
|||||||
|
|
||||||
motion.title = 'v2'
|
motion.title = 'v2'
|
||||||
motion.save(use_version=motion.get_new_version())
|
motion.save(use_version=motion.get_new_version())
|
||||||
v2_version = motion.get_last_version()
|
|
||||||
motion.title = 'v3'
|
motion.title = 'v3'
|
||||||
motion.save(use_version=motion.get_new_version())
|
motion.save(use_version=motion.get_new_version())
|
||||||
with self.assertRaises(AttributeError):
|
with self.assertRaises(AttributeError):
|
||||||
@ -122,8 +121,8 @@ class ModelTest(TestCase):
|
|||||||
state_1.save()
|
state_1.save()
|
||||||
|
|
||||||
def test_two_empty_identifiers(self):
|
def test_two_empty_identifiers(self):
|
||||||
motion1 = Motion.objects.create(title='foo', text='bar', identifier='')
|
Motion.objects.create(title='foo', text='bar', identifier='')
|
||||||
motion2 = Motion.objects.create(title='foo2', text='bar2', identifier='')
|
Motion.objects.create(title='foo2', text='bar2', identifier='')
|
||||||
|
|
||||||
def test_do_not_create_new_version_when_permit_old_version(self):
|
def test_do_not_create_new_version_when_permit_old_version(self):
|
||||||
motion = Motion()
|
motion = Motion()
|
||||||
|
@ -11,9 +11,9 @@
|
|||||||
from django.test.client import Client
|
from django.test.client import Client
|
||||||
|
|
||||||
from openslides.config.api import config
|
from openslides.config.api import config
|
||||||
|
from openslides.motion.models import Category, Motion, MotionLog, State
|
||||||
|
from openslides.participant.models import Group, User
|
||||||
from openslides.utils.test import TestCase
|
from openslides.utils.test import TestCase
|
||||||
from openslides.participant.models import User, Group
|
|
||||||
from openslides.motion.models import Motion, State, Category, MotionLog
|
|
||||||
|
|
||||||
|
|
||||||
class MotionViewTestCase(TestCase):
|
class MotionViewTestCase(TestCase):
|
||||||
@ -152,9 +152,9 @@ class TestMotionCreateView(MotionViewTestCase):
|
|||||||
|
|
||||||
def test_log(self):
|
def test_log(self):
|
||||||
self.assertFalse(MotionLog.objects.all().exists())
|
self.assertFalse(MotionLog.objects.all().exists())
|
||||||
response = self.admin_client.post(self.url, {'title': 'new motion',
|
self.admin_client.post(self.url, {'title': 'new motion',
|
||||||
'text': 'motion text',
|
'text': 'motion text',
|
||||||
'workflow': 1})
|
'workflow': 1})
|
||||||
self.assertEqual(MotionLog.objects.get(pk=1).message_list, ['Motion created'])
|
self.assertEqual(MotionLog.objects.get(pk=1).message_list, ['Motion created'])
|
||||||
|
|
||||||
|
|
||||||
@ -328,39 +328,39 @@ class TestMotionUpdateView(MotionViewTestCase):
|
|||||||
|
|
||||||
# Update motion without versioning
|
# Update motion without versioning
|
||||||
self.assertFalse(self.motion1.state.versioning)
|
self.assertFalse(self.motion1.state.versioning)
|
||||||
response = self.admin_client.post(self.url, {'title': 'new motion_title',
|
self.admin_client.post(self.url, {'title': 'new motion_title',
|
||||||
'text': 'motion text',
|
'text': 'motion text',
|
||||||
'workflow': 2})
|
'workflow': 2})
|
||||||
self.assertEqual(MotionLog.objects.get(pk=1).message_list, ['Motion version', ' 1 ', 'updated'])
|
self.assertEqual(MotionLog.objects.get(pk=1).message_list, ['Motion version', ' 1 ', 'updated'])
|
||||||
|
|
||||||
# Update motion by creating a new version
|
# Update motion by creating a new version
|
||||||
self.motion1.set_state(6) # Set to state 'permitted' which has versioning=True
|
self.motion1.set_state(6) # Set to state 'permitted' which has versioning=True
|
||||||
self.assertTrue(self.motion1.state.versioning)
|
self.assertTrue(self.motion1.state.versioning)
|
||||||
self.motion1.save(use_version=False)
|
self.motion1.save(use_version=False)
|
||||||
response = self.admin_client.post(self.url, {'title': 'new motion_title',
|
self.admin_client.post(self.url, {'title': 'new motion_title',
|
||||||
'text': 'new motion text',
|
'text': 'new motion text',
|
||||||
'workflow': 2})
|
'workflow': 2})
|
||||||
self.assertEqual(MotionLog.objects.get(pk=2).message_list, ['Motion version', ' 2 ', 'created'])
|
self.assertEqual(MotionLog.objects.get(pk=2).message_list, ['Motion version', ' 2 ', 'created'])
|
||||||
|
|
||||||
# Update motion with so called 'trivial changes'
|
# Update motion with so called 'trivial changes'
|
||||||
config['motion_allow_disable_versioning'] = True
|
config['motion_allow_disable_versioning'] = True
|
||||||
response = self.admin_client.post(self.url, {'title': 'new motion_title',
|
self.admin_client.post(self.url, {'title': 'new motion_title',
|
||||||
'text': 'more new motion text',
|
'text': 'more new motion text',
|
||||||
'disable_versioning': 'on',
|
'disable_versioning': 'on',
|
||||||
'workflow': 2})
|
'workflow': 2})
|
||||||
self.assertEqual(MotionLog.objects.get(pk=3).message_list, ['Motion version', ' 2 ', 'updated'])
|
self.assertEqual(MotionLog.objects.get(pk=3).message_list, ['Motion version', ' 2 ', 'updated'])
|
||||||
|
|
||||||
# Update motion without changes in the version data
|
# Update motion without changes in the version data
|
||||||
response = self.admin_client.post(self.url, {'title': 'new motion_title',
|
self.admin_client.post(self.url, {'title': 'new motion_title',
|
||||||
'text': 'more new motion text',
|
'text': 'more new motion text',
|
||||||
'workflow': 2})
|
'workflow': 2})
|
||||||
self.assertEqual(MotionLog.objects.get(pk=4).message_list, ['Motion version', ' 2 ', 'updated'])
|
self.assertEqual(MotionLog.objects.get(pk=4).message_list, ['Motion version', ' 2 ', 'updated'])
|
||||||
|
|
||||||
# Update motion without changes in the version data but also with the 'trivial changes' flag
|
# Update motion without changes in the version data but also with the 'trivial changes' flag
|
||||||
response = self.admin_client.post(self.url, {'title': 'new motion_title',
|
self.admin_client.post(self.url, {'title': 'new motion_title',
|
||||||
'text': 'more new motion text',
|
'text': 'more new motion text',
|
||||||
'disable_versioning': 'on',
|
'disable_versioning': 'on',
|
||||||
'workflow': 2})
|
'workflow': 2})
|
||||||
self.assertEqual(MotionLog.objects.get(pk=5).message_list, ['Motion version', ' 2 ', 'updated'])
|
self.assertEqual(MotionLog.objects.get(pk=5).message_list, ['Motion version', ' 2 ', 'updated'])
|
||||||
|
|
||||||
|
|
||||||
@ -376,7 +376,7 @@ class TestMotionDeleteView(MotionViewTestCase):
|
|||||||
def test_delegate(self):
|
def test_delegate(self):
|
||||||
response = self.delegate_client.post('/motion/2/del/', {'yes': 'yes'})
|
response = self.delegate_client.post('/motion/2/del/', {'yes': 'yes'})
|
||||||
self.assertEqual(response.status_code, 403)
|
self.assertEqual(response.status_code, 403)
|
||||||
motion = Motion.objects.get(pk=2).add_submitter(self.delegate)
|
Motion.objects.get(pk=2).add_submitter(self.delegate)
|
||||||
response = self.delegate_client.post('/motion/2/del/', {'yes': 'yes'})
|
response = self.delegate_client.post('/motion/2/del/', {'yes': 'yes'})
|
||||||
self.assertEqual(response.status_code, 403)
|
self.assertEqual(response.status_code, 403)
|
||||||
|
|
||||||
@ -404,7 +404,7 @@ class TestVersionPermitView(MotionViewTestCase):
|
|||||||
self.motion1.active_version = new_version
|
self.motion1.active_version = new_version
|
||||||
self.motion1.save()
|
self.motion1.save()
|
||||||
self.assertEqual(self.motion1.versions.count(), 2)
|
self.assertEqual(self.motion1.versions.count(), 2)
|
||||||
response = self.admin_client.post('/motion/1/version/1/permit/', {'yes': 1})
|
self.admin_client.post('/motion/1/version/1/permit/', {'yes': 1})
|
||||||
self.motion1 = Motion.objects.get(pk=1)
|
self.motion1 = Motion.objects.get(pk=1)
|
||||||
self.assertEqual(self.motion1.active_version, first_version)
|
self.assertEqual(self.motion1.active_version, first_version)
|
||||||
self.assertEqual(self.motion1.versions.count(), 2)
|
self.assertEqual(self.motion1.versions.count(), 2)
|
||||||
|
@ -8,12 +8,10 @@
|
|||||||
:license: GNU GPL, see LICENSE for more details.
|
:license: GNU GPL, see LICENSE for more details.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from openslides.utils.test import TestCase
|
from openslides.participant.api import gen_password, gen_username
|
||||||
|
from openslides.participant.models import Group, User
|
||||||
from openslides.utils.person import get_person, Persons
|
from openslides.utils.person import get_person, Persons
|
||||||
|
from openslides.utils.test import TestCase
|
||||||
from openslides.participant.models import User, Group
|
|
||||||
from openslides.participant.api import gen_username, gen_password
|
|
||||||
|
|
||||||
|
|
||||||
class UserTest(TestCase):
|
class UserTest(TestCase):
|
||||||
|
@ -10,9 +10,8 @@
|
|||||||
|
|
||||||
from django.test.client import Client
|
from django.test.client import Client
|
||||||
|
|
||||||
|
from openslides.participant.models import Group, User
|
||||||
from openslides.utils.test import TestCase
|
from openslides.utils.test import TestCase
|
||||||
from openslides.config.api import config
|
|
||||||
from openslides.participant.models import User, Group
|
|
||||||
|
|
||||||
|
|
||||||
class TestUmlautUser(TestCase):
|
class TestUmlautUser(TestCase):
|
||||||
|
@ -8,10 +8,9 @@
|
|||||||
:license: GNU GPL, see LICENSE for more details.
|
:license: GNU GPL, see LICENSE for more details.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from openslides.utils.test import TestCase
|
|
||||||
|
|
||||||
from openslides.participant.models import User
|
|
||||||
from openslides.participant.api import gen_username
|
from openslides.participant.api import gen_username
|
||||||
|
from openslides.participant.models import User
|
||||||
|
from openslides.utils.test import TestCase
|
||||||
|
|
||||||
|
|
||||||
class UserGenUsername(TestCase):
|
class UserGenUsername(TestCase):
|
||||||
|
@ -9,11 +9,12 @@
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from django.test.client import Client
|
from django.test.client import Client
|
||||||
|
|
||||||
from openslides.config.api import config
|
from openslides.config.api import config
|
||||||
|
from openslides.participant.models import get_protected_perm, Group, User
|
||||||
from openslides.utils.test import TestCase
|
from openslides.utils.test import TestCase
|
||||||
from openslides.participant.models import User, Group, get_protected_perm
|
|
||||||
|
|
||||||
|
|
||||||
class GroupViews(TestCase):
|
class GroupViews(TestCase):
|
||||||
|
@ -1,9 +1,8 @@
|
|||||||
from django.db import models
|
from django.db import models
|
||||||
from django.dispatch import receiver
|
from django.dispatch import receiver
|
||||||
|
|
||||||
from openslides.utils.person.models import PersonMixin, PersonField
|
from openslides.utils.person.models import PersonField, PersonMixin
|
||||||
from openslides.utils.person.signals import receive_persons
|
from openslides.utils.person.signals import receive_persons
|
||||||
from openslides.utils.person.api import Person
|
|
||||||
|
|
||||||
|
|
||||||
class TestPerson(PersonMixin, models.Model):
|
class TestPerson(PersonMixin, models.Model):
|
||||||
|
@ -10,14 +10,12 @@
|
|||||||
:license: GNU GPL, see LICENSE for more details.
|
:license: GNU GPL, see LICENSE for more details.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from django.test.client import Client
|
|
||||||
from django.db.models.query import EmptyQuerySet
|
|
||||||
from django.contrib.auth.models import AnonymousUser
|
from django.contrib.auth.models import AnonymousUser
|
||||||
|
|
||||||
from openslides.utils.test import TestCase
|
|
||||||
from openslides.utils.person.api import get_person
|
from openslides.utils.person.api import get_person
|
||||||
|
from openslides.utils.test import TestCase
|
||||||
|
|
||||||
from .models import TestPerson, TestModel
|
from .models import TestModel, TestPerson
|
||||||
|
|
||||||
|
|
||||||
class PersonTest(TestCase):
|
class PersonTest(TestCase):
|
||||||
|
@ -20,7 +20,7 @@ from openslides.utils.test import TestCase
|
|||||||
class WidgetObject(TestCase):
|
class WidgetObject(TestCase):
|
||||||
def test_error(self):
|
def test_error(self):
|
||||||
with self.assertRaises(OpenSlidesError):
|
with self.assertRaises(OpenSlidesError):
|
||||||
w = Widget(HttpRequest(), name='chahghuyeim8ie0Noong')
|
Widget(HttpRequest(), name='chahghuyeim8ie0Noong')
|
||||||
|
|
||||||
def test_repr(self):
|
def test_repr(self):
|
||||||
w = Widget(HttpRequest(), name='abcdefgäöüß', html='<strong>html</strong>')
|
w = Widget(HttpRequest(), name='abcdefgäöüß', html='<strong>html</strong>')
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
import openslides.main
|
from openslides.global_settings import * # noqa
|
||||||
from openslides.global_settings import *
|
|
||||||
|
|
||||||
# Use 'DEBUG = True' to get more details for server errors
|
# Use 'DEBUG = True' to get more details for server errors
|
||||||
# (Default for releases: 'False')
|
# (Default for releases: 'False')
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
:license: GNU GPL, see LICENSE for more details.
|
:license: GNU GPL, see LICENSE for more details.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from openslides import get_version, get_git_commit_id
|
from openslides import get_git_commit_id, get_version
|
||||||
from openslides.utils.test import TestCase
|
from openslides.utils.test import TestCase
|
||||||
|
|
||||||
|
|
||||||
|
@ -10,16 +10,12 @@
|
|||||||
:license: GNU GPL, see LICENSE for more details.
|
:license: GNU GPL, see LICENSE for more details.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from django.contrib.messages.storage import default_storage
|
|
||||||
from django.core.exceptions import ImproperlyConfigured
|
from django.core.exceptions import ImproperlyConfigured
|
||||||
from django.core.urlresolvers import clear_url_caches
|
from django.core.urlresolvers import clear_url_caches
|
||||||
from django.dispatch import receiver
|
|
||||||
from django.http.response import HttpResponseNotAllowed
|
|
||||||
from django.test import RequestFactory
|
from django.test import RequestFactory
|
||||||
from django.test.client import Client
|
from django.test.client import Client
|
||||||
from django.test.utils import override_settings
|
from django.test.utils import override_settings
|
||||||
|
|
||||||
from openslides.participant.models import User
|
|
||||||
from openslides.utils import views
|
from openslides.utils import views
|
||||||
from openslides.utils.signals import template_manipulation
|
from openslides.utils.signals import template_manipulation
|
||||||
from openslides.utils.test import TestCase
|
from openslides.utils.test import TestCase
|
||||||
@ -38,7 +34,6 @@ class ViewTestCase(TestCase):
|
|||||||
|
|
||||||
class LoginMixinTest(ViewTestCase):
|
class LoginMixinTest(ViewTestCase):
|
||||||
def test_dispatch(self):
|
def test_dispatch(self):
|
||||||
view = test_views.LoginMixinView.as_view()
|
|
||||||
client = Client()
|
client = Client()
|
||||||
response = client.get('/login_mixin/')
|
response = client.get('/login_mixin/')
|
||||||
self.assertEqual(response['Location'], 'http://testserver/login/?next=/login_mixin/')
|
self.assertEqual(response['Location'], 'http://testserver/login/?next=/login_mixin/')
|
||||||
|
Loading…
Reference in New Issue
Block a user