From 648d5a6ad7120f8b81b81cce27cccb6397a369d2 Mon Sep 17 00:00:00 2001 From: Emanuel Schuetze Date: Thu, 19 Jun 2014 12:02:29 +0200 Subject: [PATCH 01/10] Fixed CKEditor stuff: - Added missing insertpre plugin and allow
 tag with class
  attribute. Added font style to base.css.
- Removed unused link to old ckeditor.css (now managed by
  django-ckeditor).
---
 CHANGELOG                                     |   3 +
 .../ckeditor/plugins/insertpre/README.md      |  27 ++++
 .../insertpre/icons/insertpre-color.png       | Bin 0 -> 603 bytes
 .../plugins/insertpre/icons/insertpre.png     | Bin 0 -> 693 bytes
 .../ckeditor/plugins/insertpre/lang/en.js     |   6 +
 .../ckeditor/plugins/insertpre/lang/pl.js     |   6 +
 .../ckeditor/plugins/insertpre/plugin.js      | 131 ++++++++++++++++++
 openslides/core/static/css/base.css           |   6 +
 openslides/core/static/js/ckeditor-config.js  |  43 ------
 openslides/global_settings.py                 |   5 +-
 .../motion/templates/motion/motion_form.html  |   1 -
 openslides/utils/forms.py                     |   3 +-
 12 files changed, 184 insertions(+), 47 deletions(-)
 create mode 100644 openslides/core/static/ckeditor/ckeditor/plugins/insertpre/README.md
 create mode 100644 openslides/core/static/ckeditor/ckeditor/plugins/insertpre/icons/insertpre-color.png
 create mode 100644 openslides/core/static/ckeditor/ckeditor/plugins/insertpre/icons/insertpre.png
 create mode 100644 openslides/core/static/ckeditor/ckeditor/plugins/insertpre/lang/en.js
 create mode 100644 openslides/core/static/ckeditor/ckeditor/plugins/insertpre/lang/pl.js
 create mode 100644 openslides/core/static/ckeditor/ckeditor/plugins/insertpre/plugin.js
 delete mode 100644 openslides/core/static/js/ckeditor-config.js

diff --git a/CHANGELOG b/CHANGELOG
index fc619bbd0..188b00ed3 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -8,6 +8,9 @@ Version 1.6.1 (unreleased)
 ==========================
 [https://github.com/OpenSlides/OpenSlides/issues?milestone=16]
 
+Other:
+- Fixed CKEditor stuff (added insertpre plugin and removed unused code)
+
 
 Version 1.6 (2014-06-02)
 ========================
diff --git a/openslides/core/static/ckeditor/ckeditor/plugins/insertpre/README.md b/openslides/core/static/ckeditor/ckeditor/plugins/insertpre/README.md
new file mode 100644
index 000000000..5bf8edb2f
--- /dev/null
+++ b/openslides/core/static/ckeditor/ckeditor/plugins/insertpre/README.md
@@ -0,0 +1,27 @@
+CKEditor Insert <pre> Plugin
+===============================
+
+This plugin makes it easier to insert a <pre> tag in CKEditor.
+
+Installation
+------------
+
+1. Clone/copy this repository contents in a new "plugins/insertpre" folder in your CKEditor installation.
+2. Enable the "insertpre" plugin in the CKEditor configuration file (config.js):
+
+        config.extraPlugins = 'insertpre';
+
+That's all. "InsertPre" button will appear on the editor toolbar and will be ready to use.
+
+3. Optionally, you may specify which class should be added to the <pre> element:
+
+        CKEDITOR.config.insertpre_class = 'prettyprint';
+
+   As well as specify how the <pre> tag should be rendered inside CKEditor:
+   
+		CKEDITOR.config.insertpre_style = 'background-color:#F8F8F8;border:1px solid #DDD;padding:10px;';
+
+License
+-------
+
+Licensed under the terms of any of the following licenses at your choice: [GPL](http://www.gnu.org/licenses/gpl.html), [LGPL](http://www.gnu.org/licenses/lgpl.html) and [MPL](http://www.mozilla.org/MPL/MPL-1.1.html).
diff --git a/openslides/core/static/ckeditor/ckeditor/plugins/insertpre/icons/insertpre-color.png b/openslides/core/static/ckeditor/ckeditor/plugins/insertpre/icons/insertpre-color.png
new file mode 100644
index 0000000000000000000000000000000000000000..0c76bd1297751b66230f74719504b2adb02b1615
GIT binary patch
literal 603
zcmV-h0;K(kP)^~*-1fljz_B$LUvK}k?BNXe#Y!m=zM!!V#}8bncK5m;8VP
zw86G*RI63?Cd%b9bX|ueNlZ|wR6rj|r_)VIP@r2imh3?SN+^{|kY%~8B{maJ@F*OK
z&VH9LwOeGt#DRjj0~v~8`>iO7!Ybi;zE$va`A^T#yW`y44;k^#O~K5*jD=qcUhPSc
zvyy~q;5H_1WT1l~cqje9yfa+l!hu6xjdOJ8s;8E^+=QQ$tw
p?%p!Hy#YapB=@+^9(46X{{RQg%9y;OKjr`c002ovPDHLkV1g7l326WT

literal 0
HcmV?d00001

diff --git a/openslides/core/static/ckeditor/ckeditor/plugins/insertpre/icons/insertpre.png b/openslides/core/static/ckeditor/ckeditor/plugins/insertpre/icons/insertpre.png
new file mode 100644
index 0000000000000000000000000000000000000000..756a4906f94bd832bfd77e8018c82339245c2be7
GIT binary patch
literal 693
zcmV;m0!safP)Px#24YJ`L;(K){{a7>y{D4^000SaNLh0L01FcU01FcV0GgZ_00007bV*G`2iyx8
z3=Aw}o`rh=00K2hL_t(I%Z-yePa9DXg}?h)9E;d8iExDC$nXOqiU?@jxuHO`q@hlm
zh8|H<1PPEVrKh5&Kr%{4iG)N=8ibLI-@D7+y^{jl!Q^?QsqUFGb7#&d5dlCcRRZ1s
zhQFf$d>0W9fQT>@`4B}>D@l^nIVZo1D2il%e}4~{2egPx2rMT_lJG%8NXt&#P
ze}6Bxx3}V)lbf3xIXE~Ni;R*Luw=1nyOB#)aIOk+A7)YFWT*PTB%gX=koyMaycrM3f*p(TrS7O#l>SqV|Y3zeSLlX>F(|>
znx39E^?IF7rvpHz)8XvwjBGYbv)N>EaS>w-#u&8LV*w>1Y;A45E))v&g@uLp4-XG)
zZf%d4Yh<(8@n(h_z*@Va0d{wHn}>&opS|}aNdiEUBzW&xUtb?518A*(
z?O@~s=iK>o
-    
     
 {% endblock %}
 
diff --git a/openslides/utils/forms.py b/openslides/utils/forms.py
index 1dfe2404c..ca4db1a7c 100644
--- a/openslides/utils/forms.py
+++ b/openslides/utils/forms.py
@@ -29,7 +29,8 @@ HTML_TAG_WHITELIST = ('a',
 HTML_ATTRIBUTES_WHITELIST = {
     'a': ['href'],
     '*': ['style'],
-    'img': ['src'],
+    'pre': ['class'],
+    'img': ['src', 'width', 'height'],
 }
 
 HTML_STYLES_WHITELIST = ('color', 'background-color', 'list-style', 'width', 'height')

From 587a3766d2154689960b2a04ac06da06fcc50024 Mon Sep 17 00:00:00 2001
From: Emanuel Schuetze 
Date: Thu, 19 Jun 2014 14:13:06 +0200
Subject: [PATCH 02/10] Fixed participant csv import for group id

- Allowed to add multiple groups in csv group id field (e.g. "3,4")
- Fixed bug that group ids > 9 can not be imported.
- Updated error message if group id does not exists.
---
 CHANGELOG                                    |  6 ++++++
 extras/csv-examples/participants-demo_de.csv |  2 +-
 openslides/participant/csv_import.py         | 12 +++++-------
 3 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/CHANGELOG b/CHANGELOG
index 188b00ed3..8e28b5e64 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -8,6 +8,12 @@ Version 1.6.1 (unreleased)
 ==========================
 [https://github.com/OpenSlides/OpenSlides/issues?milestone=16]
 
+Participants:
+- Fixed participant csv import for group id:
+  * Allowed to add multiple groups in csv group id field, e.g. "3,4".
+  * Fixed bug that group ids > 9 can not be imported.
+  * Updated error message if group id does not exists.
+
 Other:
 - Fixed CKEditor stuff (added insertpre plugin and removed unused code)
 
diff --git a/extras/csv-examples/participants-demo_de.csv b/extras/csv-examples/participants-demo_de.csv
index 6b05c0562..d50b9fdc1 100644
--- a/extras/csv-examples/participants-demo_de.csv
+++ b/extras/csv-examples/participants-demo_de.csv
@@ -13,7 +13,7 @@ Teilnehmer/innen-Namen aus http://de.wikipedia.org/wiki/Otto_Normalverbraucher";
 ;"Tädi";"Maali";"female";;3;"Estland";;;;1
 ;"Maija";"Maikäläinen";"female";;3;"Finnland";;;;1
 ;"Jean";"Dupont";"male";;3;"Frankreich";;;;1
-;"Paul";"Martin";"female";;4;"Frankreich";"Versammlungsleitung";;;1
+;"Paul";"Martin";"male";;"3,4";"Frankreich";"Versammlungsleitung";;;1
 ;"Fred";"Bloggs";"male";;3;"Großbritanien";;;;0
 ;"John";"Smith";"male";;4;"Großbritanien";"Versammlungsleitung";;;1
 ;"Ashok";"Kumar";"male";;3;"Indien";;;;1
diff --git a/openslides/participant/csv_import.py b/openslides/participant/csv_import.py
index 55c16c2c4..73bf403c0 100644
--- a/openslides/participant/csv_import.py
+++ b/openslides/participant/csv_import.py
@@ -54,15 +54,13 @@ def import_users(csvfile):
                         user.is_active = False
                     user.default_password = gen_password()
                     user.save()
-                    for groupid in groups:
+                    for groupid in groups.split(','):
                         try:
-                            if groupid != ",":
+                            if groupid and int(groupid):
                                 Group.objects.get(pk=groupid).user_set.add(user)
-                        except ValueError:
-                            error_messages.append(_('Ignoring malformed group id in line %d.') % (line_no + 1))
-                            continue
-                        except Group.DoesNotExist:
-                            error_messages.append(_('Group id %(id)s does not exists (line %(line)d).') % {'id': groupid, 'line': line_no + 1})
+                        except (Group.DoesNotExist, ValueError):
+                            error_messages.append(_('Ignoring group id "%(id)s" in line %(line)d which does not exist.') %
+                                                  {'id': groupid, 'line': line_no + 1})
                             continue
                     user.reset_password()
                     count_success += 1

From f6d0a96126bb4be4c5dc787945f1736c50a0eca8 Mon Sep 17 00:00:00 2001
From: Emanuel Schuetze 
Date: Thu, 19 Jun 2014 12:12:48 +0200
Subject: [PATCH 03/10] Show supporters on motion slide if available.

---
 CHANGELOG                                     |  3 +++
 openslides/motion/templates/motion/slide.html | 11 +++++++++++
 2 files changed, 14 insertions(+)

diff --git a/CHANGELOG b/CHANGELOG
index 8e28b5e64..a8a2bd2c3 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -8,6 +8,9 @@ Version 1.6.1 (unreleased)
 ==========================
 [https://github.com/OpenSlides/OpenSlides/issues?milestone=16]
 
+Motions:
+- Show supporters on motion slide if available.
+
 Participants:
 - Fixed participant csv import for group id:
   * Allowed to add multiple groups in csv group id field, e.g. "3,4".
diff --git a/openslides/motion/templates/motion/slide.html b/openslides/motion/templates/motion/slide.html
index bd8804385..2a6c97f03 100644
--- a/openslides/motion/templates/motion/slide.html
+++ b/openslides/motion/templates/motion/slide.html
@@ -55,6 +55,17 @@
         -
     {% endfor %}
 
+    
+    {% with motion.supporter.all as supporters %}
+    {% if supporters|length > 0 %}
+        

{% trans "Supporters" %}:

+ {% for supporter in supporters %} + {{ supporter.person }}{% if not forloop.last %},
{% endif %} + {% endfor %} +

+ {% endif %} + {% endwith %} + {% if motion.category %}

{% trans "Category" %}:

From 276f76d320c0dab9e676abcc74849047a6a10afe Mon Sep 17 00:00:00 2001 From: Stefan Frauenknecht Date: Fri, 10 Oct 2014 21:30:22 +0200 Subject: [PATCH 04/10] Omit leading zero in method item_no if no agenda prefix is given. --- openslides/agenda/models.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/openslides/agenda/models.py b/openslides/agenda/models.py index 459b50547..50414209a 100644 --- a/openslides/agenda/models.py +++ b/openslides/agenda/models.py @@ -304,10 +304,12 @@ class Item(SlideMixin, AbsoluteUrlMixin, MPTTModel): @property def item_no(self): + item_no = None if self.item_number: - item_no = '%s %s' % (config['agenda_number_prefix'], self.item_number) - else: - item_no = None + if config['agenda_number_prefix']: + item_no = '%s %s' % (config['agenda_number_prefix'], self.item_number) + else: + item_no = str(self.item_number) return item_no def calc_item_no(self): From 2a389b4a7ff90adba9499b8bbb67d0344963be79 Mon Sep 17 00:00:00 2001 From: Emanuel Schuetze Date: Fri, 10 Oct 2014 19:01:34 +0200 Subject: [PATCH 05/10] Fixed #1326: Assignment PDF fails when having a lot of posts. Print always 7 signature lines in assingment pdf. Added test. --- openslides/assignment/views.py | 2 +- tests/assignment/test_pdf.py | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/openslides/assignment/views.py b/openslides/assignment/views.py index aa35f712b..bf0eb2a93 100644 --- a/openslides/assignment/views.py +++ b/openslides/assignment/views.py @@ -364,7 +364,7 @@ class AssignmentPDF(PDFView): ".  %s" % candidate, stylesheet['Signaturefield'])) if assignment.status == "sea": - for x in range(0, 2 * assignment.posts): + for x in range(0, 7): cell2b.append( Paragraph( ".  " diff --git a/tests/assignment/test_pdf.py b/tests/assignment/test_pdf.py index 90b3f92be..85a5925c0 100644 --- a/tests/assignment/test_pdf.py +++ b/tests/assignment/test_pdf.py @@ -20,3 +20,8 @@ class AssignmentPDFTest(TestCase): Assignment.objects.create(name='assignment_name_ith8qua1Eiferoqu5ju2', description="test", posts=1) response = self.admin_client.get('/assignment/print/') self.assertEqual(response.status_code, 200) + + def test_render_many_posts(self): + Assignment.objects.create(name='assignment_name_cohZ9shaipee3Phaing4', description="test", posts=20) + response = self.admin_client.get('/assignment/print/') + self.assertEqual(response.status_code, 200) From af8dead5a3ec66d1fb175bdd108b7b33cb0a7dd4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Norman=20J=C3=A4ckel?= Date: Sat, 4 Oct 2014 00:50:00 +0200 Subject: [PATCH 06/10] Fixed motion detail view template. Added block to enable extra content via plugins. Updated CHANGELOG. --- CHANGELOG | 14 +++++++--- .../templates/motion/motion_detail.html | 26 +++++++------------ openslides/motion/templates/motion/slide.html | 16 +++++++----- 3 files changed, 29 insertions(+), 27 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index a8a2bd2c3..3987d5f12 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -10,15 +10,21 @@ Version 1.6.1 (unreleased) Motions: - Show supporters on motion slide if available. +- Fixed motion detail view template. Added block to enable extra content via + plugins. + +Assignments: +- Fixed PDF when an assignment has a lot of posts. Used only 7 signature + lines. Participants: -- Fixed participant csv import for group id: - * Allowed to add multiple groups in csv group id field, e.g. "3,4". - * Fixed bug that group ids > 9 can not be imported. +- Fixed participant csv import with group ids: + * Allowed to add multiple groups in csv group id field, e. g. "3,4". + * Fixed bug that group ids greater than 9 can not be imported. * Updated error message if group id does not exists. Other: -- Fixed CKEditor stuff (added insertpre plugin and removed unused code) +- Fixed CKEditor stuff (added insertpre plugin and removed unused code). Version 1.6 (2014-06-02) diff --git a/openslides/motion/templates/motion/motion_detail.html b/openslides/motion/templates/motion/motion_detail.html index 399a8d4ec..9eaa029fd 100644 --- a/openslides/motion/templates/motion/motion_detail.html +++ b/openslides/motion/templates/motion/motion_detail.html @@ -92,7 +92,7 @@

{% trans "Reason" %}:

- {{ reason|safe|default:'–' }} + {{ reason|safe|default:'–' }}
@@ -208,9 +208,12 @@
{% trans "Vote result" %}:
{% with motion.polls.all as polls %} {% for poll in polls %} - {% if perms.motion.can_manage_motion or poll.has_votes %} -

{{ poll.poll_number|ordinal|safe }} {% trans "vote" %}:
+

+ {% if polls.count > 1 %} + {{ poll.poll_number|ordinal|safe }} {% trans "vote" %}: + {% endif %} {% if perms.motion.can_manage_motion %} + {% if polls.count > 1 %}
{% endif %} @@ -220,7 +223,6 @@ rel="tooltip" data-original-title="{% trans 'Edit Vote' %}"> -

{% endif %} {% if poll.has_votes %}
@@ -244,11 +246,10 @@ {% endwith %}
{% else %} - {% if perms.motion.can_manage_motion %} -

{% trans 'No result' %}

- {% endif %} +

{% trans 'No result' %}

{% endif %} - {% endif %} + {% block meta_box_poll_extras %}{% endblock %} +

{% empty %} – {% endfor %} @@ -279,15 +280,6 @@ {{ version.creation_time }} - - {# TODO: Check this button #} - {% if allowed_actions.wit and user in motion.submitters %} -

- - {% trans 'Withdraw motion' %} - - {% endif %} - {% if perms.motion.can_support_motion and 'motion_min_supporters'|get_config > 0 %} {% if allowed_actions.unsupport %} diff --git a/openslides/motion/templates/motion/slide.html b/openslides/motion/templates/motion/slide.html index 2a6c97f03..ae64d6696 100644 --- a/openslides/motion/templates/motion/slide.html +++ b/openslides/motion/templates/motion/slide.html @@ -50,7 +50,7 @@

{% trans "Submitter" %}:

{% for submitter in motion.submitter.all %} - {{ submitter.person }}{% if not forloop.last %},
{% endif %} + {{ submitter.person }}{% if not forloop.last %},
{% endif %} {% empty %} - {% endfor %} @@ -60,9 +60,8 @@ {% if supporters|length > 0 %}

{% trans "Supporters" %}:

{% for supporter in supporters %} - {{ supporter.person }}{% if not forloop.last %},
{% endif %} + {{ supporter.person }}{% if not forloop.last %},
{% endif %} {% endfor %} -

{% endif %} {% endwith %} @@ -82,9 +81,14 @@ -
{{ motion.active_version.text|safe }}
+
+ {{ motion.active_version.text|safe }} +
+ {% if motion.active_version.reason %}
-

{% trans "Reason" %}:

- {{ motion.active_version.reason|safe }}
+
+

{% trans "Reason" %}:

+ {{ motion.active_version.reason|safe }} +
{% endif %} From c73c986ef120ca8f1297fa96cdc40a85f344d5d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Norman=20J=C3=A4ckel?= Date: Sun, 12 Oct 2014 10:46:17 +0200 Subject: [PATCH 07/10] Updated CHANGELOG. --- CHANGELOG | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG b/CHANGELOG index 3987d5f12..b541777af 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -8,6 +8,9 @@ Version 1.6.1 (unreleased) ========================== [https://github.com/OpenSlides/OpenSlides/issues?milestone=16] +Agenda: +- Fixed error in item numbers. + Motions: - Show supporters on motion slide if available. - Fixed motion detail view template. Added block to enable extra content via From ebadb9078c692237e1f19213edc67763930a3746 Mon Sep 17 00:00:00 2001 From: Stefan Frauenknecht Date: Sun, 12 Oct 2014 10:55:56 +0200 Subject: [PATCH 08/10] Bugix in method get_title. Return item no for related objects. --- openslides/agenda/models.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/openslides/agenda/models.py b/openslides/agenda/models.py index 50414209a..f86b7ce03 100644 --- a/openslides/agenda/models.py +++ b/openslides/agenda/models.py @@ -163,11 +163,12 @@ class Item(SlideMixin, AbsoluteUrlMixin, MPTTModel): """ Return the title of this item. """ + item_no = self.item_no if not self.content_object: - item_no = self.item_no return '%s %s' % (item_no, self.title) if item_no else self.title try: - return self.content_object.get_agenda_title() + agenda_title = self.content_object.get_agenda_title() + return '%s %s' % (item_no, agenda_title) if item_no else agenda_title except AttributeError: raise NotImplementedError('You have to provide a get_agenda_title method on your related model.') From ff9fedd14f26a3a29212a7d7fb93cd8cc1ac592c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Norman=20J=C3=A4ckel?= Date: Thu, 16 Oct 2014 23:27:22 +0200 Subject: [PATCH 09/10] Updated English language files. --- openslides/locale/en/LC_MESSAGES/django.po | 167 +++++++++---------- openslides/locale/en/LC_MESSAGES/djangojs.po | 2 +- 2 files changed, 80 insertions(+), 89 deletions(-) diff --git a/openslides/locale/en/LC_MESSAGES/django.po b/openslides/locale/en/LC_MESSAGES/django.po index 1a90b1e6a..ab6a14430 100644 --- a/openslides/locale/en/LC_MESSAGES/django.po +++ b/openslides/locale/en/LC_MESSAGES/django.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2014-05-20 12:31+0200\n" +"POT-Creation-Date: 2014-10-16 23:25+0200\n" "Language: en\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -40,7 +40,7 @@ msgid "None" msgstr "" #: agenda/csv_import.py:22 motion/csv_import.py:37 -#: participant/csv_import.py:72 +#: participant/csv_import.py:70 msgid "Import file has wrong character encoding, only UTF-8 is supported!" msgstr "" @@ -62,7 +62,7 @@ msgstr "" msgid "Invalid format. Hours from 0 to 99 and minutes from 00 to 59" msgstr "" -#: agenda/forms.py:30 agenda/templates/agenda/overview.html:88 +#: agenda/forms.py:30 agenda/templates/agenda/overview.html:89 msgid "Duration" msgstr "" @@ -84,7 +84,7 @@ msgstr "" #: agenda/templates/agenda/item_slide_summary.html:7 #: agenda/templates/agenda/overview.html:7 #: agenda/templates/agenda/overview.html:34 -#: agenda/templates/agenda/overview.html:96 +#: agenda/templates/agenda/overview.html:97 #: agenda/templates/agenda/widget_item.html:18 #: agenda/templates/search/agenda-results.html:7 #: agenda/templates/search/agenda-results.html:13 @@ -115,7 +115,7 @@ msgstr "" msgid "Text" msgstr "" -#: agenda/models.py:56 agenda/templates/agenda/overview.html:85 +#: agenda/models.py:56 agenda/templates/agenda/overview.html:86 #: agenda/templates/agenda/view.html:54 participant/models.py:46 #: participant/templates/participant/overview.html:55 #: participant/templates/participant/user_detail.html:71 @@ -158,16 +158,16 @@ msgstr "" msgid "Organizational items can not have agenda items as child elements." msgstr "" -#: agenda/models.py:345 +#: agenda/models.py:348 #, python-format msgid "%(person)s is already on the list of speakers of item %(id)s." msgstr "" -#: agenda/models.py:349 +#: agenda/models.py:352 msgid "An anonymous user can not be on lists of speakers." msgstr "" -#: agenda/models.py:389 +#: agenda/models.py:392 msgid "Can put oneself on the list of speakers" msgstr "" @@ -294,7 +294,7 @@ msgstr "" #: agenda/views.py:648 #: agenda/templates/agenda/item_slide_list_of_speaker.html:26 -#: agenda/templates/agenda/overlay_speaker_projector.html:17 +#: agenda/templates/agenda/overlay_speaker_projector.html:20 msgid "The list of speakers is empty." msgstr "" @@ -310,7 +310,7 @@ msgstr "" #: agenda/views.py:716 agenda/widgets.py:44 #: agenda/templates/agenda/current_list_of_speakers_projector.html:4 #: agenda/templates/agenda/item_slide_list_of_speaker.html:9 -#: agenda/templates/agenda/overlay_speaker_projector.html:4 +#: agenda/templates/agenda/overlay_speaker_projector.html:7 #: agenda/templates/agenda/overlay_speaker_widget.html:4 #: agenda/templates/agenda/overview.html:43 #: agenda/templates/agenda/view.html:60 @@ -341,7 +341,7 @@ msgstr "" #: mediafile/templates/mediafile/mediafile_form.html:22 #: motion/templates/motion/category_list.html:15 #: motion/templates/motion/motion_detail.html:35 -#: motion/templates/motion/motion_form.html:51 +#: motion/templates/motion/motion_form.html:50 #: motion/templates/motion/motion_form_csv_import.html:11 #: participant/templates/participant/edit.html:42 #: participant/templates/participant/group_detail.html:12 @@ -364,7 +364,7 @@ msgstr "" #: config/templates/config/config_form.html:47 #: mediafile/templates/mediafile/mediafile_form.html:33 #: motion/templates/motion/category_form.html:27 -#: motion/templates/motion/motion_form.html:60 +#: motion/templates/motion/motion_form.html:59 #: motion/templates/motion/motion_form_csv_import.html:42 #: motion/templates/motion/motionpoll_form.html:84 #: participant/templates/participant/edit.html:56 @@ -381,7 +381,7 @@ msgstr "" #: core/templates/core/customslide_update.html:18 #: mediafile/templates/mediafile/mediafile_form.html:35 #: motion/templates/motion/category_form.html:30 -#: motion/templates/motion/motion_form.html:63 +#: motion/templates/motion/motion_form.html:62 #: motion/templates/motion/motion_form_csv_import.html:45 #: participant/templates/participant/edit.html:59 #: participant/templates/participant/group_edit.html:34 @@ -460,12 +460,12 @@ msgstr "" #: agenda/templates/agenda/item_row.html:22 #: agenda/templates/agenda/widget_item.html:32 #: assignment/templates/assignment/assignment_detail.html:173 -#: assignment/templates/assignment/assignment_list.html:65 +#: assignment/templates/assignment/assignment_list.html:68 #: assignment/templates/assignment/widget_assignment.html:16 #: core/templates/core/widget_customslide.html:34 #: mediafile/templates/mediafile/mediafile_list.html:38 #: motion/templates/motion/category_list.html:30 -#: motion/templates/motion/motion_list.html:100 +#: motion/templates/motion/motion_list.html:103 #: motion/templates/motion/widget_motion.html:16 #: participant/templates/participant/group_overview.html:58 #: participant/templates/participant/overview.html:117 @@ -477,12 +477,12 @@ msgstr "" #: agenda/templates/agenda/item_row.html:25 #: agenda/templates/agenda/view.html:128 #: assignment/templates/assignment/assignment_detail.html:175 -#: assignment/templates/assignment/assignment_list.html:69 +#: assignment/templates/assignment/assignment_list.html:72 #: core/templates/core/widget_customslide.html:30 #: mediafile/templates/mediafile/mediafile_list.html:39 #: motion/templates/motion/category_list.html:33 #: motion/templates/motion/motion_detail.html:146 -#: motion/templates/motion/motion_list.html:103 +#: motion/templates/motion/motion_list.html:106 #: participant/templates/participant/group_overview.html:62 #: participant/templates/participant/overview.html:122 msgid "Delete" @@ -514,7 +514,7 @@ msgid "Item closed" msgstr "" #: agenda/templates/agenda/item_slide_list_of_speaker.html:10 -#: agenda/templates/agenda/overlay_speaker_projector.html:4 +#: agenda/templates/agenda/overlay_speaker_projector.html:7 #: agenda/templates/agenda/view.html:60 msgid "closed" msgstr "" @@ -534,7 +534,7 @@ msgstr "" #: assignment/templates/assignment/assignment_detail.html:215 #: assignment/templates/assignment/assignmentpoll_slide.html:24 #: motion/models.py:712 motion/pdf.py:129 motion/pdf.py:274 -#: motion/templates/motion/motion_detail.html:228 +#: motion/templates/motion/motion_detail.html:230 #: motion/templates/motion/motionpoll_slide.html:20 #: motion/templates/motion/slide.html:23 utils/views.py:330 msgid "Yes" @@ -546,7 +546,7 @@ msgstr "" #: assignment/templates/assignment/assignment_detail.html:212 #: assignment/templates/assignment/assignmentpoll_slide.html:26 #: motion/models.py:712 motion/pdf.py:129 motion/pdf.py:276 -#: motion/templates/motion/motion_detail.html:229 +#: motion/templates/motion/motion_detail.html:231 #: motion/templates/motion/motionpoll_slide.html:24 #: motion/templates/motion/slide.html:24 utils/views.py:330 msgid "No" @@ -571,52 +571,52 @@ msgstr "" msgid "Current list of speakers" msgstr "" -#: agenda/templates/agenda/overview.html:51 +#: agenda/templates/agenda/overview.html:52 +msgid "Number agenda items" +msgstr "" + +#: agenda/templates/agenda/overview.html:57 msgid "Hide closed items" msgstr "" -#: agenda/templates/agenda/overview.html:54 +#: agenda/templates/agenda/overview.html:60 msgid "item" msgid_plural "items" msgstr[0] "" msgstr[1] "" -#: agenda/templates/agenda/overview.html:62 +#: agenda/templates/agenda/overview.html:68 msgid "Start of event" msgstr "" -#: agenda/templates/agenda/overview.html:66 +#: agenda/templates/agenda/overview.html:72 msgid "Estimated end" msgstr "" -#: agenda/templates/agenda/overview.html:71 +#: agenda/templates/agenda/overview.html:77 msgid "Set start time of event" msgstr "" -#: agenda/templates/agenda/overview.html:75 -msgid "Number agenda items" -msgstr "" - -#: agenda/templates/agenda/overview.html:83 +#: agenda/templates/agenda/overview.html:84 msgid "Item" msgstr "" -#: agenda/templates/agenda/overview.html:91 -#: assignment/templates/assignment/assignment_list.html:36 +#: agenda/templates/agenda/overview.html:92 +#: assignment/templates/assignment/assignment_list.html:37 #: mediafile/templates/mediafile/mediafile_list.html:24 #: motion/templates/motion/category_list.html:23 #: motion/templates/motion/motion_detail.html:122 -#: motion/templates/motion/motion_list.html:59 +#: motion/templates/motion/motion_list.html:60 #: participant/templates/participant/group_overview.html:33 #: participant/templates/participant/overview.html:57 msgid "Actions" msgstr "" -#: agenda/templates/agenda/overview.html:110 +#: agenda/templates/agenda/overview.html:111 msgid "Show agenda" msgstr "" -#: agenda/templates/agenda/overview.html:133 +#: agenda/templates/agenda/overview.html:134 #: agenda/templates/agenda/widget_item.html:59 #: core/templates/core/widget_customslide.html:43 msgid "No items available." @@ -1001,7 +1001,7 @@ msgstr "" #: assignment/templates/assignment/assignment_detail.html:65 #: assignment/templates/assignment/assignment_detail.html:149 #: assignment/templates/assignment/assignment_list.html:34 -#: assignment/templates/assignment/assignment_list.html:48 +#: assignment/templates/assignment/assignment_list.html:50 #: assignment/templates/assignment/assignmentpoll_form.html:44 #: assignment/templates/assignment/slide.html:29 msgid "Candidates" @@ -1038,7 +1038,7 @@ msgstr "" #: assignment/templates/assignment/assignment_detail.html:234 #: assignment/templates/assignment/assignmentpoll_form.html:61 #: assignment/templates/assignment/assignmentpoll_slide.html:39 -#: motion/pdf.py:119 motion/templates/motion/motion_detail.html:234 +#: motion/pdf.py:119 motion/templates/motion/motion_detail.html:236 #: motion/templates/motion/motionpoll_form.html:54 #: motion/templates/motion/motionpoll_slide.html:33 #: motion/templates/motion/slide.html:29 poll/models.py:84 @@ -1050,7 +1050,7 @@ msgstr "" #: assignment/templates/assignment/assignment_detail.html:250 #: assignment/templates/assignment/assignmentpoll_form.html:71 #: assignment/templates/assignment/assignmentpoll_slide.html:45 -#: motion/pdf.py:121 motion/templates/motion/motion_detail.html:237 +#: motion/pdf.py:121 motion/templates/motion/motion_detail.html:239 #: motion/templates/motion/motionpoll_form.html:58 #: motion/templates/motion/motionpoll_slide.html:39 #: motion/templates/motion/slide.html:32 poll/models.py:86 @@ -1062,7 +1062,7 @@ msgstr "" #: assignment/templates/assignment/assignment_detail.html:266 #: assignment/templates/assignment/assignmentpoll_form.html:81 #: assignment/templates/assignment/assignmentpoll_slide.html:51 -#: motion/pdf.py:123 motion/templates/motion/motion_detail.html:242 +#: motion/pdf.py:123 motion/templates/motion/motion_detail.html:244 #: motion/templates/motion/motionpoll_form.html:62 #: motion/templates/motion/motionpoll_slide.html:45 #: motion/templates/motion/slide.html:37 poll/models.py:88 @@ -1092,19 +1092,18 @@ msgstr[1] "" #: assignment/templates/assignment/assignment_detail.html:213 #: assignment/templates/assignment/assignmentpoll_slide.html:28 #: motion/pdf.py:129 motion/pdf.py:278 -#: motion/templates/motion/motion_detail.html:230 +#: motion/templates/motion/motion_detail.html:232 #: motion/templates/motion/motionpoll_slide.html:28 #: motion/templates/motion/slide.html:25 msgid "Abstention" msgstr "" #: assignment/templates/assignment/assignment_detail.html:22 -#: assignment/templates/assignment/assignment_list.html:74 msgid "Print election as PDF" msgstr "" #: assignment/templates/assignment/assignment_detail.html:27 -#: assignment/templates/assignment/assignment_list.html:59 +#: assignment/templates/assignment/assignment_list.html:62 #: assignment/templates/assignment/assignmentpoll_form.html:21 msgid "Show election" msgstr "" @@ -1165,7 +1164,7 @@ msgstr "" #: assignment/templates/assignment/assignment_detail.html:171 #: assignment/templates/assignment/assignmentpoll_form.html:96 -#: motion/templates/motion/motion_detail.html:218 +#: motion/templates/motion/motion_detail.html:221 #: motion/templates/motion/motionpoll_form.html:72 msgid "Ballot paper as PDF" msgstr "" @@ -1220,12 +1219,12 @@ msgstr "" msgid "Print all elections as PDF" msgstr "" -#: assignment/templates/assignment/assignment_list.html:44 +#: assignment/templates/assignment/assignment_list.html:46 msgctxt "Number of searched candidates for an election" msgid "Posts" msgstr "" -#: assignment/templates/assignment/assignment_list.html:51 +#: assignment/templates/assignment/assignment_list.html:53 msgid "Elected" msgstr "" @@ -1516,7 +1515,7 @@ msgstr "" #: motion/templates/motion/motion_diff.html:35 #: motion/templates/motion/motion_diff.html:39 #: motion/templates/motion/motionpoll_slide.html:10 -#: motion/templates/motion/slide.html:70 +#: motion/templates/motion/slide.html:80 msgid "Version" msgstr "" @@ -1657,7 +1656,7 @@ msgstr "" msgid "Motion imported" msgstr "" -#: motion/csv_import.py:123 participant/csv_import.py:83 +#: motion/csv_import.py:123 participant/csv_import.py:81 msgid "Errors" msgstr "" @@ -1677,7 +1676,7 @@ msgstr "" #: motion/forms.py:39 motion/models.py:542 motion/pdf.py:152 #: motion/templates/motion/motion_detail.html:94 #: motion/templates/motion/motion_diff.html:54 -#: motion/templates/motion/slide.html:77 +#: motion/templates/motion/slide.html:91 msgid "Reason" msgstr "" @@ -1695,6 +1694,7 @@ msgstr "" #: motion/forms.py:92 motion/pdf.py:74 motion/signals.py:86 #: motion/templates/motion/motion_detail.html:190 #: motion/templates/motion/motion_list.html:56 +#: motion/templates/motion/slide.html:61 msgid "Supporters" msgstr "" @@ -1706,9 +1706,9 @@ msgstr "" msgid "Don't create a new version. Useful e.g. for trivial changes." msgstr "" -#: motion/forms.py:121 motion/templates/motion/motion_detail.html:265 +#: motion/forms.py:121 motion/templates/motion/motion_detail.html:266 #: motion/templates/motion/motion_list.html:52 -#: motion/templates/motion/slide.html:60 +#: motion/templates/motion/slide.html:70 msgid "Category" msgstr "" @@ -1778,7 +1778,7 @@ msgstr "" #: motion/templates/motion/motionpoll_form.html:7 #: motion/templates/motion/motionpoll_form.html:15 #: motion/templates/motion/motionpoll_slide.html:9 -#: motion/templates/motion/slide.html:69 +#: motion/templates/motion/slide.html:79 #: motion/templates/search/motion-results.html:7 msgid "Motion" msgstr "" @@ -2152,14 +2152,14 @@ msgid "Print motion as PDF" msgstr "" #: motion/templates/motion/motion_detail.html:41 -#: motion/templates/motion/motion_list.html:95 +#: motion/templates/motion/motion_list.html:98 #: motion/templates/motion/motionpoll_form.html:22 msgid "Show motion" msgstr "" #: motion/templates/motion/motion_detail.html:53 -#: motion/templates/motion/motion_form.html:33 -#: motion/templates/motion/motion_form.html:43 +#: motion/templates/motion/motion_form.html:32 +#: motion/templates/motion/motion_form.html:42 msgid "Edit motion" msgstr "" @@ -2199,69 +2199,65 @@ msgstr "" msgid "Show log" msgstr "" -#: motion/templates/motion/motion_detail.html:212 +#: motion/templates/motion/motion_detail.html:213 #: motion/templates/motion/motionpoll_slide.html:11 msgid "vote" msgstr "" -#: motion/templates/motion/motion_detail.html:215 +#: motion/templates/motion/motion_detail.html:218 #: motion/templates/motion/motionpoll_form.html:26 msgid "Show vote result" msgstr "" -#: motion/templates/motion/motion_detail.html:220 +#: motion/templates/motion/motion_detail.html:223 msgid "Edit Vote" msgstr "" -#: motion/templates/motion/motion_detail.html:222 +#: motion/templates/motion/motion_detail.html:225 #: motion/templates/motion/motionpoll_form.html:31 msgid "Delete Vote" msgstr "" -#: motion/templates/motion/motion_detail.html:248 +#: motion/templates/motion/motion_detail.html:249 msgid "No result" msgstr "" -#: motion/templates/motion/motion_detail.html:258 +#: motion/templates/motion/motion_detail.html:259 msgid "New vote" msgstr "" -#: motion/templates/motion/motion_detail.html:275 +#: motion/templates/motion/motion_detail.html:276 msgid "Last changes (of this version)" msgstr "" -#: motion/templates/motion/motion_detail.html:277 +#: motion/templates/motion/motion_detail.html:278 #: motion/templates/motion/motion_diff.html:36 #: motion/templates/motion/motion_diff.html:40 #: motion/templates/motion/motion_list.html:58 msgid "Last changes" msgstr "" -#: motion/templates/motion/motion_detail.html:287 -msgid "Withdraw motion" -msgstr "" - -#: motion/templates/motion/motion_detail.html:296 +#: motion/templates/motion/motion_detail.html:288 msgid "Unsupport" msgstr "" -#: motion/templates/motion/motion_detail.html:302 +#: motion/templates/motion/motion_detail.html:294 msgid "Support" msgstr "" -#: motion/templates/motion/motion_detail.html:310 +#: motion/templates/motion/motion_detail.html:302 msgid "minimum required supporters" msgstr "" -#: motion/templates/motion/motion_detail.html:317 +#: motion/templates/motion/motion_detail.html:309 msgid "Manage motion" msgstr "" -#: motion/templates/motion/motion_detail.html:327 +#: motion/templates/motion/motion_detail.html:319 msgid "For administration only:" msgstr "" -#: motion/templates/motion/motion_detail.html:329 +#: motion/templates/motion/motion_detail.html:321 msgid "Reset state" msgstr "" @@ -2274,13 +2270,13 @@ msgid "Diff view" msgstr "" #: motion/templates/motion/motion_diff.html:27 -#: motion/templates/motion/motion_form.html:49 +#: motion/templates/motion/motion_form.html:48 #: motion/templates/motion/motionpoll_form.html:18 msgid "Back to motion" msgstr "" -#: motion/templates/motion/motion_form.html:35 -#: motion/templates/motion/motion_form.html:45 +#: motion/templates/motion/motion_form.html:34 +#: motion/templates/motion/motion_form.html:44 #: motion/templates/motion/motion_list.html:36 msgid "New motion" msgstr "" @@ -2320,15 +2316,15 @@ msgstr "" msgid "Motion title" msgstr "" -#: motion/templates/motion/motion_list.html:77 +#: motion/templates/motion/motion_list.html:79 msgid "Enough supporters" msgstr "" -#: motion/templates/motion/motion_list.html:80 +#: motion/templates/motion/motion_list.html:82 msgid "Needs supporters" msgstr "" -#: motion/templates/motion/motion_list.html:87 +#: motion/templates/motion/motion_list.html:89 msgid "There is a newer (unauthorized) version." msgstr "" @@ -2352,19 +2348,14 @@ msgstr "" #: participant/csv_import.py:62 #, python-format -msgid "Ignoring malformed group id in line %d." +msgid "Ignoring group id \"%(id)s\" in line %(line)d which does not exist." msgstr "" -#: participant/csv_import.py:65 -#, python-format -msgid "Group id %(id)s does not exists (line %(line)d)." -msgstr "" - -#: participant/csv_import.py:70 +#: participant/csv_import.py:68 msgid "Import aborted because of severe errors in the input file." msgstr "" -#: participant/csv_import.py:76 +#: participant/csv_import.py:74 #, python-format msgid "%d new participants were successfully imported." msgstr "" @@ -2951,11 +2942,11 @@ msgstr "" msgid "Scroll level" msgstr "" -#: utils/forms.py:111 +#: utils/forms.py:112 msgid "CSV File" msgstr "" -#: utils/forms.py:112 +#: utils/forms.py:113 msgid "The file has to be encoded in UTF-8." msgstr "" diff --git a/openslides/locale/en/LC_MESSAGES/djangojs.po b/openslides/locale/en/LC_MESSAGES/djangojs.po index f1a009231..f5445d612 100644 --- a/openslides/locale/en/LC_MESSAGES/djangojs.po +++ b/openslides/locale/en/LC_MESSAGES/djangojs.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2014-05-05 20:29+0200\n" +"POT-Creation-Date: 2014-10-16 23:27+0200\n" "Language: en\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" From cb03908a1bab83e8a4bc8b6361aa936ac2c23576 Mon Sep 17 00:00:00 2001 From: Oskar Hahn Date: Thu, 16 Oct 2014 18:04:30 +0200 Subject: [PATCH 10/10] Returns a 404 response if a requested poll does not exist. fixes #1355 --- openslides/motion/views.py | 6 ++++-- openslides/poll/views.py | 7 ++++++- tests/assignment/test_views.py | 17 +++++++++++++++++ tests/motion/test_views.py | 17 +++++++++++++++++ 4 files changed, 44 insertions(+), 3 deletions(-) diff --git a/openslides/motion/views.py b/openslides/motion/views.py index 829421665..97da9976d 100644 --- a/openslides/motion/views.py +++ b/openslides/motion/views.py @@ -7,6 +7,7 @@ from django.utils.text import slugify from django.utils.translation import ugettext as _ from django.utils.translation import ugettext_lazy, ugettext_noop from reportlab.platypus import SimpleDocTemplate +from django.shortcuts import get_object_or_404 from openslides.agenda.views import CreateRelatedAgendaItemView as _CreateRelatedAgendaItemView from openslides.config.api import config @@ -524,9 +525,10 @@ class PollMixin(object): Use the motion id and the poll_number from the url kwargs to get the object. """ - return MotionPoll.objects.filter( + queryset = MotionPoll.objects.filter( motion=self.kwargs['pk'], - poll_number=self.kwargs['poll_number']).get() + poll_number=self.kwargs['poll_number']) + return get_object_or_404(queryset) def get_url_name_args(self): """ diff --git a/openslides/poll/views.py b/openslides/poll/views.py index f16806734..41ee176d5 100644 --- a/openslides/poll/views.py +++ b/openslides/poll/views.py @@ -2,6 +2,7 @@ from django.forms.models import modelform_factory from django.http import HttpResponseRedirect +from django.shortcuts import get_object_or_404 from openslides.utils.views import TemplateView, FormMixin @@ -53,7 +54,11 @@ class PollFormView(FormMixin, TemplateView): 'a get_poll_class method.') def get_object(self): - return self.get_poll_class().objects.get(pk=self.kwargs['poll_id']) + """ + Returns the poll object. Raises Http404 if the poll does not exist. + """ + queryset = self.get_poll_class().objects.filter(pk=self.kwargs['poll_id']) + return get_object_or_404(queryset) def get_context_data(self, **kwargs): context = super(PollFormView, self).get_context_data(**kwargs) diff --git a/tests/assignment/test_views.py b/tests/assignment/test_views.py index 2b2358b44..4717be190 100644 --- a/tests/assignment/test_views.py +++ b/tests/assignment/test_views.py @@ -109,3 +109,20 @@ class TestAssignmentPollCreateView(TestCase): self.assertEqual(poll.assignment, self.assignment) self.assertEqual(poll.assignmentoption_set.count(), 1) self.assertTrue(poll.yesnoabstain) + + +class TestPollUpdateView(TestCase): + def setUp(self): + self.admin_client = Client() + self.admin_client.login(username='admin', password='admin') + + def test_not_existing_poll(self): + """ + Tests that a 404 is returned, when a non existing poll is requested. + """ + Assignment.objects.create(name='test assignment', posts=1) + url = '/assignment/poll/1/edit/' + + response = self.admin_client.get(url) + + self.assertTrue(response.status_code, '404') diff --git a/tests/motion/test_views.py b/tests/motion/test_views.py index 8b47f0310..96e1c819b 100644 --- a/tests/motion/test_views.py +++ b/tests/motion/test_views.py @@ -528,3 +528,20 @@ class CategoryViewsTest(TestCase): response = self.admin_client.post(url, {'yes': 'true'}) self.assertRedirects(response, '/motion/category/') self.assertFalse(Category.objects.exists()) + + +class PollUpdateViewTest(TestCase): + def setUp(self): + self.admin_client = Client() + self.admin_client.login(username='admin', password='admin') + + def test_not_existing_poll(self): + """ + Tests that a 404 is returned, when a non existing poll is requested + """ + Motion.objects.create(title='test_motion') + url = '/motion/1/poll/1/edit/' + + response = self.admin_client.get(url) + + self.assertTrue(response.status_code, '404')