Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
1# (c) 2018-2020
2# MPIB <https://www.mpib-berlin.mpg.de/>,
3# MPI-CBS <https://www.cbs.mpg.de/>,
4# MPIP <http://www.psych.mpg.de/>
5#
6# This file is part of Castellum.
7#
8# Castellum is free software; you can redistribute it and/or modify it
9# under the terms of the GNU Affero General Public License as published
10# by the Free Software Foundation; either version 3 of the License, or
11# (at your option) any later version.
12#
13# Castellum is distributed in the hope that it will be useful, but
14# WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16# Affero General Public License for more details.
17#
18# You should have received a copy of the GNU Affero General Public
19# License along with Castellum. If not, see
20# <http://www.gnu.org/licenses/>.
22from django.core.management.base import BaseCommand
24from castellum.recruitment.models import AttributeDescription
26ATTRIBUTE_DESCRIPTIONS = [{
27 'field_type': 'ChoiceField',
28 'order': 0,
29 'label': {
30 'de': 'Händigkeit',
31 'en': 'Handedness',
32 },
33 'choices': [{
34 'label': {
35 'de': 'Rechts',
36 'en': 'Right',
37 }
38 }, {
39 'label': {
40 'de': 'Links',
41 'en': 'Left',
42 }
43 }],
44 'statistics_rank': 'secondary',
45}, {
46 'field_type': 'CharField',
47 'order': 1,
48 'label': {
49 'de': 'Muttersprache',
50 'en': 'Language',
51 },
52}, {
53 'field_type': 'AgeField',
54 'order': 2,
55 'label': {
56 'de': 'Geburtsdatum',
57 'en': 'Date of birth',
58 },
59 '_filter_label': {
60 'de': 'Alter',
61 'en': 'Age',
62 },
63 'statistics_rank': 'primary',
64}, {
65 'field_type': 'OrderedChoiceField',
66 'order': 3,
67 'label': {
68 'de': 'Höchster Abschluss',
69 'en': 'Highest degree',
70 },
71 'choices': [{
72 'label': {
73 'de': 'Kein Abschluss',
74 'en': 'No degree',
75 }
76 }, {
77 'label': {
78 'de': 'Grundschule',
79 'en': 'Elementary school',
80 }
81 }, {
82 'label': {
83 'de': 'Hauptschule',
84 'en': 'Hauptschule',
85 }
86 }, {
87 'label': {
88 'de': 'Mittlere Reife',
89 'en': 'Mittlere Reife',
90 }
91 }, {
92 'label': {
93 'de': 'Abitur',
94 'en': 'Abitur',
95 }
96 }, {
97 'label': {
98 'de': 'Bachelor',
99 'en': 'Bachelor',
100 }
101 }, {
102 'label': {
103 'de': 'Master',
104 'en': 'Master',
105 }
106 }],
107}]
110def generate_attribute_descriptions():
111 for data in ATTRIBUTE_DESCRIPTIONS:
112 description = AttributeDescription._import(data)
113 if 'statistics_rank' in data:
114 description.statistics_rank = data['statistics_rank']
115 description.save()
118class Command(BaseCommand):
119 help = 'Create recommended AttributeDescriptions.'
121 def handle(self, *args, **options):
122 if not AttributeDescription.objects.exists():
123 generate_attribute_descriptions()