added option to number poll cadidates
This commit is contained in:
parent
8d77c0495b
commit
90b04366b5
@ -10,6 +10,7 @@ export interface AssignmentWithoutNestedModels extends BaseModelWithAgendaItemAn
|
||||
default_poll_description: string;
|
||||
tags_id: number[];
|
||||
attachments_id: number[];
|
||||
number_poll_candidates: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -301,6 +301,13 @@
|
||||
}}</mat-error>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
|
||||
<!-- Number poll candidates -->
|
||||
<div>
|
||||
<mat-checkbox formControlName="number_poll_candidates">
|
||||
<span translate>Number poll candidates</span>
|
||||
</mat-checkbox>
|
||||
</div>
|
||||
<!-- TODO searchValueSelector: Parent -->
|
||||
</form>
|
||||
</mat-card>
|
||||
|
@ -193,7 +193,8 @@ export class AssignmentDetailComponent extends BaseViewComponent implements OnIn
|
||||
open_posts: [1, [Validators.required, Validators.min(1)]],
|
||||
agenda_create: [''],
|
||||
agenda_parent_id: [],
|
||||
agenda_type: ['']
|
||||
agenda_type: [''],
|
||||
number_poll_candidates: [false]
|
||||
});
|
||||
this.candidatesForm = formBuilder.group({
|
||||
userId: null
|
||||
|
@ -129,6 +129,11 @@ class Migration(migrations.Migration):
|
||||
),
|
||||
preserve_default=False,
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name="assignment",
|
||||
name="number_poll_candidates",
|
||||
field=models.BooleanField(default=False),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name="assignment",
|
||||
name="poll_description_default",
|
||||
|
@ -153,6 +153,11 @@ class Assignment(RESTModelMixin, AgendaItemWithListOfSpeakersMixin, models.Model
|
||||
Mediafiles as attachments for this assignment.
|
||||
"""
|
||||
|
||||
number_poll_candidates = models.BooleanField(default=False)
|
||||
"""
|
||||
Controls whether the candidates in polls for this assignment should be numbered or listed with bullet points.
|
||||
"""
|
||||
|
||||
class Meta:
|
||||
default_permissions = ()
|
||||
permissions = (
|
||||
|
@ -169,6 +169,7 @@ class AssignmentSerializer(ModelSerializer):
|
||||
"agenda_parent_id",
|
||||
"tags",
|
||||
"attachments",
|
||||
"number_poll_candidates",
|
||||
)
|
||||
validators = (posts_validator,)
|
||||
|
||||
|
@ -42,10 +42,6 @@ class CreateAssignment(TestCase):
|
||||
Tests basic creation of assignments.
|
||||
"""
|
||||
|
||||
def setUp(self):
|
||||
self.client = APIClient()
|
||||
self.client.login(username="admin", password="admin")
|
||||
|
||||
def test_simple(self):
|
||||
response = self.client.post(
|
||||
reverse("assignment-list"),
|
||||
@ -54,6 +50,7 @@ class CreateAssignment(TestCase):
|
||||
self.assertEqual(response.status_code, status.HTTP_201_CREATED)
|
||||
assignment = Assignment.objects.get()
|
||||
self.assertEqual(assignment.title, "test_title_ef3jpF)M329f30m)f82")
|
||||
self.assertEqual(assignment.number_poll_candidates, False)
|
||||
|
||||
def test_with_tags_and_mediafiles(self):
|
||||
Tag.objects.create(name="test_tag")
|
||||
@ -75,6 +72,19 @@ class CreateAssignment(TestCase):
|
||||
self.assertTrue(assignment.tags.exists())
|
||||
self.assertTrue(assignment.attachments.exists())
|
||||
|
||||
def test_number_poll_candidates(self):
|
||||
response = self.client.post(
|
||||
reverse("assignment-list"),
|
||||
{
|
||||
"title": "test_title_EFBhGQkQciwZtjSc7BVy",
|
||||
"open_posts": 1,
|
||||
"number_poll_candidates": True,
|
||||
},
|
||||
)
|
||||
self.assertEqual(response.status_code, status.HTTP_201_CREATED)
|
||||
assignment = Assignment.objects.get()
|
||||
self.assertEqual(assignment.number_poll_candidates, True)
|
||||
|
||||
|
||||
class CandidatureSelf(TestCase):
|
||||
"""
|
||||
|
Loading…
Reference in New Issue
Block a user