Merge pull request #684 from emanuelschuetze/fixes-for-1.4b2
Fixes for 1.4b2
This commit is contained in:
commit
c81177ea7a
@ -137,7 +137,7 @@ class Item(MPTTModel, SlideMixin):
|
||||
# TODO: Rename it to 'get_related_object'
|
||||
object = get_slide_from_sid(self.related_sid, element=True)
|
||||
if object is None:
|
||||
self.title = _('Item for deleted slide %s') % self.related_sid
|
||||
self.title = _('< Item for deleted slide (%s) >') % self.related_sid
|
||||
self.related_sid = None
|
||||
self.save()
|
||||
return self
|
||||
|
@ -1,5 +1,4 @@
|
||||
{% load i18n %}
|
||||
{% load tags %}
|
||||
|
||||
<style type="text/css">
|
||||
/* List of speakers – overlay */
|
||||
|
@ -1,5 +1,4 @@
|
||||
{% load i18n %}
|
||||
{% load tags %}
|
||||
|
||||
<span>
|
||||
{% trans "List of speakers" %} <small class="grey">({% trans 'This overlay only appears on agenda slides if it is activated' %}.)</small>
|
||||
|
@ -1,6 +1,5 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% load tags %}
|
||||
{% load i18n %}
|
||||
{% load mptt_tags %}
|
||||
{% load staticfiles %}
|
||||
@ -42,7 +41,7 @@
|
||||
{% if perms.agenda.can_manage_agenda %}
|
||||
<a href="{% url 'item_new' %}" class="btn btn-mini btn-primary" rel="tooltip" data-original-title="{% trans 'New item' %}"><i class="icon-plus icon-white"></i> {% trans "New" %}</a>
|
||||
{% endif %}
|
||||
<a href="{% url 'print_agenda' %}" class="btn btn-mini" rel="tooltip" data-original-title="{% trans 'Print agenda as PDF' %}"><i class="icon-print"></i> PDF</a>
|
||||
<a href="{% url 'print_agenda' %}" class="btn btn-mini" rel="tooltip" data-original-title="{% trans 'Print agenda as PDF' %}" target="_blank"><i class="icon-print"></i> PDF</a>
|
||||
</small>
|
||||
</h1>
|
||||
|
||||
|
@ -1,13 +1,12 @@
|
||||
{% load i18n %}
|
||||
{% load tags %}
|
||||
|
||||
{% if perms.agenda.can_be_speaker %}
|
||||
<p><a href="{% url 'agenda_add_to_current_list_of_speakers' %}" class="btn"><i class="icon icon-speaker"></i> {% trans 'Put me on the current list of speakers' %}</a></p>
|
||||
<p><a href="{% url 'agenda_add_to_current_list_of_speakers' %}" class="btn"><i class="icon icon-speaker"></i> {% trans 'Put me on the current list of speakers' %}</a></p>
|
||||
{% endif %}
|
||||
|
||||
<p><a href="{% url 'agenda_current_list_of_speakers' %}" class="btn"><i class="icon icon-bell"></i> {% trans 'Go to current list of speakers' %}</a></p>
|
||||
|
||||
{% if perms.agenda.can_manage_agenda %}
|
||||
<hr>
|
||||
<a href="{% url 'agenda_next_on_current_list_of_speakers' %}" class="btn btn-mini"><i class="icon icon-bell"></i> {% trans 'Next speaker' %}</a>
|
||||
<hr>
|
||||
<a href="{% url 'agenda_next_on_current_list_of_speakers' %}" class="btn btn-mini"><i class="icon icon-bell"></i> {% trans 'Next speaker' %}</a>
|
||||
{% endif %}
|
||||
|
@ -20,27 +20,25 @@
|
||||
<h1>
|
||||
{{ item }}
|
||||
<small class="pull-right">
|
||||
<div class="btn-toolbar">
|
||||
<a href="{% url 'item_overview' %}" class="btn btn-mini"><i class="icon-chevron-left"></i> {% trans "Back to overview" %}</a>
|
||||
{% if perms.projector.can_manage_projector %}
|
||||
<a href="{% url 'projector_activate_slide' item.sid %}"
|
||||
class="activate_link btn btn-mini {% if item.active and not show_list %}btn-primary{% endif %}"
|
||||
rel="tooltip" data-original-title="{% trans 'Show' %}">
|
||||
<i class="icon icon-facetime-video {% if item.active and not show_list %}icon-white{% endif %}"></i>
|
||||
</a>
|
||||
{% endif %}
|
||||
{% if perms.agenda.can_manage_agenda %}
|
||||
<div class="btn-group">
|
||||
<a data-toggle="dropdown" href="#" class="btn btn-mini dropdown-toggle">
|
||||
{% trans 'More actions' %}
|
||||
<span class="caret"></span>
|
||||
</a>
|
||||
<ul class="dropdown-menu pull-right">
|
||||
<li><a href="{% model_url item 'update' %}"><i class="icon-pencil"></i> {% trans 'Edit item' %}</a></li>
|
||||
<li><a href="{% model_url item 'delete' %}"><i class="icon-remove"></i> {% trans 'Delete item' %}</a></li>
|
||||
</ul>
|
||||
{% endif %}
|
||||
</div>
|
||||
<a href="{% url 'item_overview' %}" class="btn btn-mini"><i class="icon-chevron-left"></i> {% trans "Back to overview" %}</a>
|
||||
{% if perms.projector.can_manage_projector %}
|
||||
<a href="{% url 'projector_activate_slide' item.sid %}"
|
||||
class="activate_link btn btn-mini {% if item.active and not show_list %}btn-primary{% endif %}"
|
||||
rel="tooltip" data-original-title="{% trans 'Show' %}">
|
||||
<i class="icon icon-facetime-video {% if item.active and not show_list %}icon-white{% endif %}"></i>
|
||||
</a>
|
||||
{% endif %}
|
||||
{% if perms.agenda.can_manage_agenda %}
|
||||
<div class="btn-group">
|
||||
<a data-toggle="dropdown" href="#" class="btn btn-mini dropdown-toggle">
|
||||
{% trans 'More actions' %}
|
||||
<span class="caret"></span>
|
||||
</a>
|
||||
<ul class="dropdown-menu pull-right">
|
||||
<li><a href="{% model_url item 'update' %}"><i class="icon-pencil"></i> {% trans 'Edit item' %}</a></li>
|
||||
<li><a href="{% model_url item 'delete' %}"><i class="icon-remove"></i> {% trans 'Delete item' %}</a></li>
|
||||
</ul>
|
||||
{% endif %}
|
||||
</div>
|
||||
</small>
|
||||
</h1>
|
||||
@ -48,7 +46,7 @@
|
||||
{% if item.get_related_slide == item %}
|
||||
{{ item.text|safe|linebreaks }}
|
||||
{% else %}
|
||||
<a href="{% model_url item.get_related_slide %}">{% trans 'Goto' %} {% trans item.get_related_type %} {{ item.get_related_slide }}</a>
|
||||
<a href="{% model_url item.get_related_slide %}" class="btn btn-small">{% trans 'View' %} "{{ item.get_related_slide }}" ({% trans item.get_related_type %})</a>
|
||||
{% endif %}
|
||||
</p>
|
||||
|
||||
@ -146,7 +144,7 @@
|
||||
{% endif %}
|
||||
</p>
|
||||
|
||||
{% if perms.can_manage_agenda %}
|
||||
{% if perms.agenda.can_manage_agenda %}
|
||||
<form action="" method="post">{% csrf_token %}
|
||||
{% for field in form %}
|
||||
<label>{{ field.label }}:</label>
|
||||
|
@ -1,7 +1,6 @@
|
||||
{% extends 'base-projector.html' %}
|
||||
|
||||
{% load i18n %}
|
||||
{% load tags %}
|
||||
|
||||
{% block title %}{{ block.super }} – {{ item }}{% endblock %}
|
||||
|
||||
|
@ -21,7 +21,7 @@
|
||||
<a href="{% url 'assignment_new' %}" class="btn btn-mini btn-primary" rel="tooltip" data-original-title="{% trans 'New election' %}"><i class="icon-plus icon-white"></i> {% trans "New" %}</a>
|
||||
{% endif %}
|
||||
{% if perms.assignment.can_see_assignment %}
|
||||
<a href="{% url 'print_assignment' %}" class="btn btn-mini" rel="tooltip" data-original-title="{% trans 'Print all elections as PDF' %}"><i class="icon-print"></i> PDF</a>
|
||||
<a href="{% url 'print_assignment' %}" class="btn btn-mini" rel="tooltip" data-original-title="{% trans 'Print all elections as PDF' %}" target="_blank"><i class="icon-print"></i> PDF</a>
|
||||
{% endif %}
|
||||
</small>
|
||||
</h1>
|
||||
@ -65,7 +65,7 @@
|
||||
<i class="icon-remove"></i>
|
||||
</a>
|
||||
{% endif %}
|
||||
<a href="{% url 'print_assignment' assignment.id %}" class="btn btn-mini" title="{% trans 'Print election as PDF' %}">
|
||||
<a href="{% url 'print_assignment' assignment.id %}" class="btn btn-mini" title="{% trans 'Print election as PDF' %}" target="_blank">
|
||||
<i class="icon-print"></i> PDF
|
||||
</a>
|
||||
</span>
|
||||
|
@ -70,7 +70,7 @@
|
||||
</table>
|
||||
|
||||
<p>
|
||||
<a href="{% url 'print_assignment_poll' poll.id %}" class="btn">
|
||||
<a href="{% url 'print_assignment_poll' poll.id %}" class="btn" target="_blank">
|
||||
<i class="icon-print"></i> {% trans 'Ballot paper as PDF' %}
|
||||
</a>
|
||||
</p>
|
||||
|
@ -19,7 +19,7 @@
|
||||
{{ assignment }}
|
||||
<small class="pull-right">
|
||||
<a href="{% url 'assignment_overview' %}" class="btn btn-mini"><i class="icon-chevron-left"></i> {% trans "Back to overview" %}</a>
|
||||
<a href="{% url 'print_assignment' assignment.id %}" class="btn btn-mini" rel="tooltip" data-original-title="{% trans 'Print election as PDF' %}"><i class="icon-print"></i> PDF</a>
|
||||
<a href="{% url 'print_assignment' assignment.id %}" class="btn btn-mini" rel="tooltip" data-original-title="{% trans 'Print election as PDF' %}" target="_blank"><i class="icon-print"></i> PDF</a>
|
||||
<!-- activate projector -->
|
||||
{% if perms.projector.can_manage_projector %}
|
||||
<a href="{% url 'projector_activate_slide' assignment.sid %}" class="activate_link btn {% if assignment.active %}btn-primary{% endif %} btn-mini" rel="tooltip" data-original-title="{% trans 'Show election' %}">
|
||||
|
@ -1,6 +1,5 @@
|
||||
{% extends "base-projector.html" %}
|
||||
|
||||
{% load tags %}
|
||||
{% load i18n %}
|
||||
{% load staticfiles %}
|
||||
|
||||
|
@ -8,7 +8,7 @@
|
||||
<h1>{% trans 'Version' %}</h1>
|
||||
<ul>
|
||||
{% for version in versions %}
|
||||
<li>{{ version.0 }} – {% trans "Version" %} {{ version.1 }}</li>
|
||||
<li>{{ version.0 }} – {% trans 'Version' %} {{ version.1 }}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endblock %}
|
||||
|
Binary file not shown.
File diff suppressed because it is too large
Load Diff
@ -19,7 +19,9 @@ import csv
|
||||
from django.db import transaction
|
||||
from django.utils.translation import ugettext as _, ugettext_noop
|
||||
|
||||
from openslides.utils import csv_ext
|
||||
from openslides.utils.person.api import Persons
|
||||
from openslides.utils.utils import html_strong
|
||||
|
||||
from .models import Motion, Category
|
||||
|
||||
@ -37,25 +39,33 @@ def import_motions(csv_file, default_submitter, override=False, importing_person
|
||||
error_messages = []
|
||||
warning_messages = []
|
||||
count_success = 0
|
||||
count_lines = 0
|
||||
|
||||
# Check encoding
|
||||
try:
|
||||
csv_file.read().decode('utf8')
|
||||
except UnicodeDecodeError:
|
||||
return (0, [_('Encoding error in import file. Ensure using UTF-8.')], [])
|
||||
return (0, [_('Import file has wrong character encoding, only UTF-8 is supported!')], [])
|
||||
csv_file.seek(0)
|
||||
|
||||
with transaction.commit_on_success():
|
||||
for (line_no, line) in enumerate(csv.reader(csv_file)):
|
||||
dialect = csv.Sniffer().sniff(csv_file.readline())
|
||||
dialect = csv_ext.patchup(dialect)
|
||||
csv_file.seek(0)
|
||||
for (line_no, line) in enumerate(csv.reader(csv_file, dialect=dialect)):
|
||||
warnings = []
|
||||
if line_no < 1:
|
||||
# Do not read the header line
|
||||
continue
|
||||
|
||||
count_lines += 1
|
||||
# Check format
|
||||
try:
|
||||
(identifier, title, text, reason, submitter, category) = line[:6]
|
||||
except ValueError:
|
||||
error_messages.append(_('Ignoring malformed line %d in import file.') % (line_no + 1))
|
||||
error_line = html_strong(_('Line %d of import file:') % (line_no + 1))
|
||||
msg = _('Line is malformed. Motion not imported. Please check the required values.')
|
||||
error_messages.append("%s<br>%s" % (error_line, msg))
|
||||
continue
|
||||
|
||||
# Check existing motions according to the identifier
|
||||
@ -66,7 +76,9 @@ def import_motions(csv_file, default_submitter, override=False, importing_person
|
||||
motion = Motion(identifier=identifier)
|
||||
else:
|
||||
if not override:
|
||||
error_messages.append(_('Line %d in import file: Ignoring existing motion.') % (line_no + 1))
|
||||
error_line = html_strong(_('Line %d of import file:') % (line_no + 1))
|
||||
msg = _('Identifier already exists. Motion not imported.')
|
||||
error_messages.append("%s<br>%s" % (error_line, msg))
|
||||
continue
|
||||
else:
|
||||
motion = Motion()
|
||||
@ -79,9 +91,9 @@ def import_motions(csv_file, default_submitter, override=False, importing_person
|
||||
try:
|
||||
motion.category = Category.objects.get(name=category)
|
||||
except Category.DoesNotExist:
|
||||
error_messages.append(_('Line %d in import file: Category not found.') % (line_no + 1))
|
||||
warnings.append(_('Category unknown. No category is used.'))
|
||||
except Category.MultipleObjectsReturned:
|
||||
error_messages.append(_('Line %d in import file: Multiple categories found.') % (line_no + 1))
|
||||
warnings.append(_('Several suitable categories found. No category is used.'))
|
||||
motion.save()
|
||||
|
||||
# Add submitter
|
||||
@ -90,15 +102,24 @@ def import_motions(csv_file, default_submitter, override=False, importing_person
|
||||
for person in Persons():
|
||||
if person.clean_name == submitter.decode('utf8'):
|
||||
if person_found:
|
||||
error_messages.append(_('Line %d in import file: Multiple persons found.') % (line_no + 1))
|
||||
warnings.append(_('Several suitable submitters found.'))
|
||||
person_found = False
|
||||
break
|
||||
else:
|
||||
new_submitter = person
|
||||
person_found = True
|
||||
if not person_found:
|
||||
warning_messages.append(_('Line %d in import file: Default submitter is used.') % (line_no + 1))
|
||||
warnings.append(_('Submitter unknown. Default submitter is used.'))
|
||||
new_submitter = default_submitter
|
||||
|
||||
# show summarized warning message for each import line
|
||||
if warnings:
|
||||
warning_line = _('Line %d of import file:') % (line_no + 1)
|
||||
warning_message_string = "%s<ul>" % html_strong(warning_line)
|
||||
for w in warnings:
|
||||
warning_message_string += "<li>%s</li>" % w
|
||||
warning_message_string += "</ul>"
|
||||
warning_messages.append(warning_message_string)
|
||||
motion.clear_submitters()
|
||||
motion.add_submitter(new_submitter)
|
||||
|
||||
@ -106,4 +127,4 @@ def import_motions(csv_file, default_submitter, override=False, importing_person
|
||||
person=importing_person)
|
||||
count_success += 1
|
||||
|
||||
return (count_success, error_messages, warning_messages)
|
||||
return (count_success, count_lines, error_messages, warning_messages)
|
||||
|
@ -734,7 +734,7 @@ class MotionPoll(CountInvalid, CountVotesCast, BasePoll):
|
||||
|
||||
def __unicode__(self):
|
||||
"""Return a string, representing the poll."""
|
||||
return _('Ballot %d') % self.poll_number
|
||||
return _('Vote %d') % self.poll_number
|
||||
|
||||
def get_absolute_url(self, link='edit'):
|
||||
"""Return an URL for the poll.
|
||||
|
@ -56,7 +56,8 @@ def motion_to_pdf(pdf, motion):
|
||||
stylesheet['Heading4']))
|
||||
cell1b = []
|
||||
cell1b.append(Spacer(0, 0.2 * cm))
|
||||
cell1b.append(Paragraph(unicode(motion.submitter), stylesheet['Normal']))
|
||||
for submitter in motion.submitter.all():
|
||||
cell1b.append(Paragraph(unicode(submitter), stylesheet['Normal']))
|
||||
motion_data.append([cell1a, cell1b])
|
||||
|
||||
# TODO: choose this in workflow
|
||||
@ -88,26 +89,12 @@ def motion_to_pdf(pdf, motion):
|
||||
cell3b.append(Spacer(0, 0.2 * cm))
|
||||
motion_data.append([cell3a, cell3b])
|
||||
|
||||
## # status
|
||||
## cell4a = []
|
||||
## cell4b = []
|
||||
## note = " ".join(motion.notes)
|
||||
## cell4a.append(Paragraph("<font name='Ubuntu-Bold'>%s:</font>" % _("Status"), stylesheet['Heading4']))
|
||||
## if note != "":
|
||||
## if motion.status == "pub":
|
||||
## cell4b.append(Paragraph(note, stylesheet['Normal']))
|
||||
## else:
|
||||
## cell4b.append(Paragraph("%s | %s" % (motion.get_status_display(), note), stylesheet['Normal']))
|
||||
## else:
|
||||
## cell4b.append(Paragraph("%s" % motion.get_status_display(), stylesheet['Normal']))
|
||||
## data.append([cell4a, cell4b])
|
||||
|
||||
# Motion state
|
||||
cell4a = []
|
||||
cell4b = []
|
||||
cell4a.append(Paragraph("<font name='Ubuntu-Bold'>%s:</font>" % _("State"),
|
||||
stylesheet['Heading4']))
|
||||
cell4b.append(Paragraph(motion.state.name, stylesheet['Normal']))
|
||||
cell4b.append(Paragraph(_(motion.state.name), stylesheet['Normal']))
|
||||
motion_data.append([cell4a, cell4b])
|
||||
|
||||
# Version number (aid)
|
||||
@ -137,7 +124,7 @@ def motion_to_pdf(pdf, motion):
|
||||
option = poll.get_options()[0]
|
||||
yes, no, abstain, invalid, votecast = (
|
||||
option['Yes'], option['No'], option['Abstain'],
|
||||
poll.print_voteinvalid(), poll.print_votecast())
|
||||
poll.print_votesinvalid(), poll.print_votescast())
|
||||
|
||||
if len(polls) > 1:
|
||||
cell6b.append(Paragraph("%s. %s" % (ballotcounter, _("Vote")),
|
||||
|
@ -5,6 +5,11 @@
|
||||
* :license: GNU GPL, see LICENSE for more details.
|
||||
*/
|
||||
|
||||
/* motion create/update form fields */
|
||||
#id_submitter, #id_supporter {
|
||||
height: 110px;
|
||||
width: auto;
|
||||
}
|
||||
/* motion version diff table */
|
||||
table.diff, .diff_row {
|
||||
font-size: 12px;
|
||||
|
@ -1,6 +1,5 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% load tags %}
|
||||
{% load i18n %}
|
||||
|
||||
{% block title %}
|
||||
|
@ -21,7 +21,7 @@
|
||||
</small>
|
||||
<small class="pull-right">
|
||||
<a href="{% url 'motion_list' %}" class="btn btn-mini"><i class="icon-chevron-left"></i> {% trans "Back to overview" %}</a>
|
||||
<a href="{% url 'motion_detail_pdf' motion.id %}" class="btn btn-mini" rel="tooltip" data-original-title="{% trans 'Print motion as PDF' %}"><i class="icon-print"></i> PDF</a>
|
||||
<a href="{% url 'motion_detail_pdf' motion.id %}" class="btn btn-mini" rel="tooltip" data-original-title="{% trans 'Print motion as PDF' %}" target="_blank"><i class="icon-print"></i> PDF</a>
|
||||
<!-- activate projector -->
|
||||
{% if perms.projector.can_manage_projector %}
|
||||
<a href="{% url 'projector_activate_slide' motion.sid %}" class="activate_link btn {% if motion.active %}btn-primary{% endif %} btn-mini" rel="tooltip" data-original-title="{% trans 'Show motion' %}">
|
||||
@ -184,11 +184,8 @@
|
||||
|
||||
<!-- Status -->
|
||||
<h5>{% trans "Status" %}:</h5>
|
||||
{% if motion.state_id != "pub" %}
|
||||
{# TODO: trans motion.state #}
|
||||
<span class="label label-info">{% trans motion.state.name %}</span>
|
||||
<br>
|
||||
{% endif %}
|
||||
<span class="label label-info">{% trans motion.state.name %}</span>
|
||||
<br>
|
||||
|
||||
<!-- Vote results -->
|
||||
<h5>{% trans "Vote results" %}:</h5>
|
||||
|
@ -1,6 +1,5 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% load tags %}
|
||||
{% load i18n %}
|
||||
{% load staticfiles %}
|
||||
|
||||
|
@ -6,6 +6,7 @@
|
||||
{% load staticfiles %}
|
||||
|
||||
{% block header %}
|
||||
<link type="text/css" rel="stylesheet" media="all" href="{% static 'styles/motion.css' %}" />
|
||||
<link type="text/css" rel="stylesheet" media="all" href="{% static 'styles/ckeditor.css' %}" />
|
||||
{% endblock %}
|
||||
|
||||
|
@ -28,7 +28,7 @@
|
||||
<a href="{% url 'motion_category_list' %}" class="btn btn-mini"><i class="icon-th-large"></i> {% trans 'Categories' %}</a>
|
||||
<a href="{% url 'motion_csv_import' %}" class="btn btn-mini" rel="tooltip" data-original-title="{% trans 'Import motions' %}"><i class="icon-import"></i> {% trans 'Import' %}</a>
|
||||
{% endif %}
|
||||
<a href="{% url 'motion_list_pdf' %}" class="btn btn-mini" rel="tooltip" data-original-title="{% trans 'Print all motions as PDF' %}"><i class="icon-print"></i> PDF</a>
|
||||
<a href="{% url 'motion_list_pdf' %}" class="btn btn-mini" rel="tooltip" data-original-title="{% trans 'Print all motions as PDF' %}" target="_blank"><i class="icon-print"></i> PDF</a>
|
||||
</small>
|
||||
</h1>
|
||||
|
||||
@ -86,7 +86,7 @@
|
||||
<i class="icon-remove"></i>
|
||||
</a>
|
||||
{% endif %}
|
||||
<a href="{% url 'motion_detail_pdf' motion.id %}" class="btn btn-mini" title="{% trans 'Print motion as PDF' %}">
|
||||
<a href="{% url 'motion_detail_pdf' motion.id %}" class="btn btn-mini" title="{% trans 'Print motion as PDF' %}" target="_blank">
|
||||
<i class="icon-print"></i> PDF
|
||||
</a>
|
||||
</span>
|
||||
|
@ -57,7 +57,7 @@
|
||||
|
||||
<!-- ballot paper button -->
|
||||
<p>
|
||||
<a href="{% url 'motion_poll_pdf' motion.id poll.poll_number %}" class="btn">
|
||||
<a href="{% url 'motion_poll_pdf' motion.id poll.poll_number %}" class="btn" target="_blank">
|
||||
<i class="icon-print"></i> {% trans 'Ballot paper as PDF' %}
|
||||
</a>
|
||||
</p>
|
||||
|
@ -1,6 +1,5 @@
|
||||
{% extends "base-projector.html" %}
|
||||
|
||||
{% load tags %}
|
||||
{% load i18n %}
|
||||
{% load staticfiles %}
|
||||
|
||||
|
@ -707,7 +707,7 @@ class MotionCSVImportView(FormView):
|
||||
"""
|
||||
Processes the import function.
|
||||
"""
|
||||
count_success, error_messages, warning_messages = import_motions(
|
||||
count_success, count_lines, error_messages, warning_messages = import_motions(
|
||||
self.request.FILES['csvfile'],
|
||||
default_submitter=form.cleaned_data['default_submitter'],
|
||||
override=form.cleaned_data['override'],
|
||||
@ -719,7 +719,7 @@ class MotionCSVImportView(FormView):
|
||||
if count_success:
|
||||
messages.success(
|
||||
self.request,
|
||||
_('%d motions were successfully imported.') % count_success)
|
||||
"<strong>%s</strong><br>%s" % (_('Summary'), _('%d of %d motions successfully imported.') % (count_success, count_lines)))
|
||||
return super(MotionCSVImportView, self).form_valid(form)
|
||||
|
||||
motion_csv_import = MotionCSVImportView.as_view()
|
||||
|
@ -3,7 +3,6 @@
|
||||
|
||||
<ul style="line-height: 180%">
|
||||
{% for group in groups %}
|
||||
{% if group.pk != 1 and group.pk != 2 %}
|
||||
<li class="{% if group.active %}activeline{% endif %}">
|
||||
<a href="{% url 'projector_activate_slide' group.sid %}" class="activate_link btn {% if group.active %}btn-primary{% endif %} btn-mini" title="{% trans 'Show' %}">
|
||||
<i class="icon-facetime-video {% if group.active %}icon-white{% endif %}"></i>
|
||||
@ -14,10 +13,7 @@
|
||||
<a href="{% url 'projctor_preview_slide' group.sid %}" title="{% trans 'Preview' %}" class="btn btn-mini right">
|
||||
<i class="icon-search"></i>
|
||||
</a>
|
||||
<a href="{% model_url group 'view' %}">{{ group }}</a>
|
||||
<a href="{% model_url group 'view' %}">{% trans group.name %}</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% empty %}
|
||||
<li>{% trans 'No groups available.' %}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
|
@ -31,12 +31,12 @@
|
||||
</a>
|
||||
<ul class="dropdown-menu pull-right">
|
||||
{% url 'user_settings' as url_usersettings %}
|
||||
<li><a href="{% url 'user_print' %}"><i class="icon-list"></i> {% trans 'List of participants' %}</a></li>
|
||||
<li><a href="{% url 'print_passwords' %}"><i class="icon-th-large"></i> {% trans 'First time passwords' %}</a></li>
|
||||
<li><a href="{% url 'user_print' %}" target="_blank"><i class="icon-list"></i> {% trans 'List of participants' %}</a></li>
|
||||
<li><a href="{% url 'print_passwords' %}" target="_blank"><i class="icon-th-large"></i> {% trans 'First time passwords' %}</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
{% else %}
|
||||
<a href="{% url 'user_print' %}" class="btn btn-mini" rel="tooltip" data-original-title="{% trans 'Print list of participants as PDF' %}"><i class="icon-print"></i> PDF</a>
|
||||
<a href="{% url 'user_print' %}" class="btn btn-mini" rel="tooltip" data-original-title="{% trans 'Print list of participants as PDF' %}" target="_blank"><i class="icon-print"></i> PDF</a>
|
||||
{% endif %}
|
||||
</small>
|
||||
</h1>
|
||||
|
@ -1,7 +1,6 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% load i18n %}
|
||||
{% load tags %}
|
||||
|
||||
{% block title %}{{ block.super }} – {{ shown_user }}{% endblock %}
|
||||
|
||||
|
@ -1,22 +1,13 @@
|
||||
{% extends "base-projector.html" %}
|
||||
|
||||
{% load i18n %}
|
||||
{% load tags %}
|
||||
|
||||
{% block title %}{{ block.super }} - {{ title }}{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="item_fullscreen">{{ group }}
|
||||
<div class="item_fullscreen">{% trans group.name %}
|
||||
<span>
|
||||
<p><i>{{ group.user_set.all.count }} {% trans "participants" %}</i></p>
|
||||
{% comment %}
|
||||
TODO: print fullname (not username) of all group users [see #420]
|
||||
<p>
|
||||
{% if group.user_set.all %}
|
||||
{{ group.user_set.all|join:", " }}
|
||||
{% endif %}
|
||||
</p>
|
||||
{% endcomment %}
|
||||
</span>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
@ -1,7 +1,6 @@
|
||||
{% extends "base-projector.html" %}
|
||||
|
||||
{% load i18n %}
|
||||
{% load tags %}
|
||||
|
||||
{% block title %}{{ block.super }} - {{ title }}{% endblock %}
|
||||
|
||||
@ -13,7 +12,9 @@
|
||||
{% endif %}
|
||||
<p>
|
||||
{% if shown_user.groups.all %}
|
||||
{{ shown_user.groups.all|join:", " }}
|
||||
{% for group in shown_user.groups.all %}
|
||||
{% trans group.name %}{% if not forloop.last %}, {% endif %}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
</p>
|
||||
</span>
|
||||
|
@ -132,6 +132,17 @@ class UserUpdateView(UpdateView):
|
||||
form_kwargs.update({'request': self.request})
|
||||
return form_kwargs
|
||||
|
||||
def post_save(self, form):
|
||||
super(UserUpdateView, self).post_save(form)
|
||||
# TODO: find a better solution that makes the following lines obsolete
|
||||
# Background: motion.models.use_post_save adds already the registerd group
|
||||
# to new user but super(..).post_save(form) removes it and sets only the
|
||||
# groups selected in the form (without 'registered')
|
||||
# workaround: add registered group again manually
|
||||
from openslides.participant.api import get_registered_group # TODO: Test, if global import is possible
|
||||
registered = get_registered_group()
|
||||
self.object.groups.add(registered)
|
||||
|
||||
|
||||
class UserDeleteView(DeleteView):
|
||||
"""
|
||||
|
@ -1,10 +1,8 @@
|
||||
{% load tags %}
|
||||
{% load staticfiles %}
|
||||
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
|
||||
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
|
||||
<!DOCTYPE html>
|
||||
<html lang="{{LANGUAGE_CODE}}">
|
||||
<head>
|
||||
<link type="text/css" rel="stylesheet" href="{% static 'styles/projector.css' %}">
|
||||
<link rel="shortcut icon" href="{% static 'img/favicon.png' %}" type="image/png" />
|
||||
|
@ -1,6 +1,5 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% load tags %}
|
||||
{% load i18n %}
|
||||
{% load staticfiles %}
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
{% load i18n %}
|
||||
{% load tags %}
|
||||
|
||||
<!-- projector control buttons -->
|
||||
{% if perms.projector.can_manage_projector %}
|
||||
|
@ -1,6 +1,5 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% load tags %}
|
||||
{% load i18n %}
|
||||
|
||||
{% block title %}{{ block.super }} – {% trans "Custom slide" %}{% endblock %}
|
||||
|
@ -1,5 +1,4 @@
|
||||
{% load i18n %}
|
||||
{% load tags %}
|
||||
|
||||
<span>
|
||||
{% trans "Countdown for speaking time" %}:
|
||||
|
@ -1,5 +1,4 @@
|
||||
{% load i18n %}
|
||||
{% load tags %}
|
||||
|
||||
<ul class="overlay_list">
|
||||
{% for overlay in overlays %}
|
||||
|
@ -1,5 +1,4 @@
|
||||
{% load i18n %}
|
||||
{% load tags %}
|
||||
|
||||
{% if welcometext %}
|
||||
<p>{{ welcometext|safe|linebreaks }}</p>
|
||||
|
@ -167,17 +167,17 @@ legend + .control-group {
|
||||
height: 310px;
|
||||
width: auto;
|
||||
}
|
||||
#id_submitter, #id_supporter, #id_users {
|
||||
#id_users {
|
||||
height: 110px;
|
||||
width: auto;
|
||||
}
|
||||
#dataTableParticipants_filter input {
|
||||
#dataTable_filter input {
|
||||
width: auto;
|
||||
}
|
||||
#dataTableParticipants {
|
||||
#dataTable {
|
||||
clear: none;
|
||||
}
|
||||
#dataTableParticipants_wrapper .row-fluid:after {
|
||||
#dataTable_wrapper .row-fluid:after {
|
||||
clear: none;
|
||||
}
|
||||
|
||||
|
@ -1,8 +1,5 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% load tags %}
|
||||
{% load i18n %}
|
||||
|
||||
{% block content %}
|
||||
<h1>{{ error }}</h1>
|
||||
{% endblock %}
|
||||
|
@ -1,6 +1,5 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% load tags %}
|
||||
{% load i18n %}
|
||||
|
||||
{% block content %}
|
||||
|
@ -1,6 +1,5 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% load tags %}
|
||||
{% load i18n %}
|
||||
|
||||
{% block content %}
|
||||
|
@ -2,10 +2,8 @@
|
||||
{% load i18n %}
|
||||
{% load staticfiles %}
|
||||
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
|
||||
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
|
||||
<!DOCTYPE html>
|
||||
<html lang="{{LANGUAGE_CODE}}">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
@ -26,7 +24,7 @@
|
||||
<div class="row-fluid">
|
||||
<div class="span12">
|
||||
<div id="header">
|
||||
<a href="/" class="logo" title="{% trans 'Home' %}"><img src="{% static 'img/logo.png' %}" /></a>
|
||||
<a href="/" class="logo" title="{% trans 'Home' %}"><img src="{% static 'img/logo.png' %}" alt="{% trans 'Logo' %}" /></a>
|
||||
<span class="title optional">{% get_config 'event_name' %} – {% get_config 'event_description' %}</span>
|
||||
{% block loginbutton %}
|
||||
<div class="btn-group pull-right">
|
||||
|
@ -27,13 +27,6 @@ def get_config(key):
|
||||
return config[key]
|
||||
|
||||
|
||||
@register.simple_tag
|
||||
def active(request, pattern):
|
||||
if request.path.startswith(pattern):
|
||||
return 'selected'
|
||||
return ''
|
||||
|
||||
|
||||
@register.simple_tag
|
||||
def model_url(object, link='view'):
|
||||
# TODO: Rename to object_url
|
||||
|
@ -56,7 +56,7 @@ class CSVImport(TestCase):
|
||||
csv_dir = os.path.join(os.path.dirname(__file__), '..', '..', 'extras', 'csv-examples')
|
||||
self.assertEqual(Motion.objects.count(), 0)
|
||||
with open(csv_dir + '/motions-demo_de.csv') as f:
|
||||
count_success, error_messages, warning_messages = import_motions(csv_file=f, default_submitter=self.normal_user.person_id)
|
||||
count_success, count_lines, error_messages, warning_messages = import_motions(csv_file=f, default_submitter=self.normal_user.person_id)
|
||||
self.assertEqual(Motion.objects.count(), 4)
|
||||
self.assertEqual(count_success, 4)
|
||||
|
||||
@ -68,8 +68,8 @@ class CSVImport(TestCase):
|
||||
self.assertEqual(len(motion1.submitter.all()), 1)
|
||||
self.assertEqual(motion1.submitter.all()[0].person, self.normal_user)
|
||||
self.assertTrue(motion1.category is None)
|
||||
self.assertTrue('Line 2 in import file: Default submitter is used.' in warning_messages)
|
||||
self.assertTrue('Line 2 in import file: Category not found.' in error_messages)
|
||||
self.assertTrue(any('Submitter unknown.' in w for w in warning_messages))
|
||||
self.assertTrue(any('Category unknown.' in w for w in warning_messages))
|
||||
|
||||
motion2 = Motion.objects.get(pk=2)
|
||||
self.assertEqual(motion2.identifier, 'S 2')
|
||||
@ -81,15 +81,15 @@ class CSVImport(TestCase):
|
||||
self.assertEqual(motion2.submitter.all()[0].person, special_user)
|
||||
self.assertEqual(motion2.category, self.category1)
|
||||
|
||||
self.assertTrue('Line 5 in import file: Multiple persons found.' in error_messages)
|
||||
self.assertTrue('Line 5 in import file: Multiple categories found.' in error_messages)
|
||||
self.assertTrue(any('Several suitable submitters found.' in w for w in warning_messages))
|
||||
self.assertTrue(any('Several suitable categories found.' in w for w in warning_messages))
|
||||
|
||||
def test_malformed_file(self):
|
||||
csv_file = StringIO.StringIO()
|
||||
csv_file.write('Header\nMalformed data,\n,Title,Text,,,\n')
|
||||
count_success, error_messages, warning_messages = import_motions(csv_file=csv_file, default_submitter=self.normal_user.person_id)
|
||||
self.assertEqual(count_success, 1)
|
||||
self.assertTrue('Ignoring malformed line 2 in import file.' in error_messages)
|
||||
count_success, count_lines, error_messages, warning_messages = import_motions(csv_file=csv_file, default_submitter=self.normal_user.person_id)
|
||||
self.assertEqual(count_success, 0)
|
||||
self.assertTrue(any('Line is malformed.' in e for e in error_messages))
|
||||
|
||||
def test_wrong_encoding(self):
|
||||
csv_file = StringIO.StringIO()
|
||||
@ -98,4 +98,4 @@ class CSVImport(TestCase):
|
||||
csv_file.seek(0)
|
||||
count_success, error_messages, warning_messages = import_motions(csv_file=csv_file, default_submitter=self.normal_user.person_id)
|
||||
self.assertEqual(count_success, 0)
|
||||
self.assertTrue('Encoding error in import file. Ensure using UTF-8.' in error_messages)
|
||||
self.assertTrue('Import file has wrong character encoding, only UTF-8 is supported!' in error_messages)
|
||||
|
Loading…
Reference in New Issue
Block a user