diff --git a/openslides/assignments/apps.py b/openslides/assignments/apps.py
index e967a3784..d439ca00d 100644
--- a/openslides/assignments/apps.py
+++ b/openslides/assignments/apps.py
@@ -24,4 +24,4 @@ class AssignmentsAppConfig(AppConfig):
# Register viewsets.
router.register('assignments/assignment', AssignmentViewSet)
- router.register('assignments/assignmentpoll', AssignmentPollViewSet)
+ router.register('assignments/poll', AssignmentPollViewSet)
diff --git a/openslides/assignments/serializers.py b/openslides/assignments/serializers.py
index 27fff8504..e54dc3166 100644
--- a/openslides/assignments/serializers.py
+++ b/openslides/assignments/serializers.py
@@ -50,7 +50,7 @@ class AssignmentOptionSerializer(ModelSerializer):
class Meta:
model = AssignmentOption
- fields = ('candidate', 'votes',)
+ fields = ('id', 'candidate', 'votes', 'poll')
class FilterPollListSerializer(ListSerializer):
diff --git a/openslides/assignments/static/js/assignments/base.js b/openslides/assignments/static/js/assignments/base.js
index 55fc428bc..5bffc331c 100644
--- a/openslides/assignments/static/js/assignments/base.js
+++ b/openslides/assignments/static/js/assignments/base.js
@@ -4,18 +4,45 @@
angular.module('OpenSlidesApp.assignments', [])
+.factory('AssignmentPollOption', [
+ 'DS',
+ function (DS) {
+ return DS.defineResource({
+ name: 'assignments/polloption',
+ relations: {
+ belongsTo: {
+ 'assignments/poll': {
+ localField: 'poll',
+ localKey: 'poll_id',
+ },
+ 'users/user': {
+ localField: 'candidate',
+ localKey: 'candidate_id',
+ }
+ }
+ },
+ })
+ }
+])
+
.factory('AssignmentPoll', [
'DS',
- 'Config',
- function (DS, Config) {
+ 'AssignmentPollOption',
+ function (DS, AssignmentPollOption) {
return DS.defineResource({
- name: 'assignments/assignmentpoll',
+ name: 'assignments/poll',
relations: {
belongsTo: {
'assignments/assignment': {
localField: 'assignment',
localKey: 'assignment_id',
}
+ },
+ hasMany: {
+ 'assignments/polloption': {
+ localField: 'options',
+ foreignKey: 'poll_id',
+ }
}
},
})
@@ -75,7 +102,7 @@ angular.module('OpenSlidesApp.assignments', [])
localField: 'assignment_related_users',
foreignKey: 'assignment_id',
},
- 'assignments/assignmentpoll': {
+ 'assignments/poll': {
localField: 'polls',
foreignKey: 'assignment_id',
}
diff --git a/openslides/assignments/static/js/assignments/site.js b/openslides/assignments/static/js/assignments/site.js
index 25fd6132f..b57af132f 100644
--- a/openslides/assignments/static/js/assignments/site.js
+++ b/openslides/assignments/static/js/assignments/site.js
@@ -382,7 +382,7 @@ angular.module('OpenSlidesApp.assignments.site', ['OpenSlidesApp.assignments'])
$scope.formFields.push(
{
noFormControl: true,
- template: 'User#' + option.candidate_id + ''
+ template: '' + option.candidate.get_full_name() + ''
},
{
key: 'yes_' + option.candidate_id,