-
Notifications
You must be signed in to change notification settings - Fork 10
Evaluation student #422
base: staging
Are you sure you want to change the base?
Evaluation student #422
Changes from 26 commits
a5dedaa
d2547df
ac4244e
4033577
8ac3414
db52494
04ef4d4
71c7f2c
bdf30a2
8aca609
f776b39
ce60729
b63318b
6fb782c
26eafab
5e84c47
d43cc65
cf503e8
8699fdf
a261e94
bfea9be
6705100
68c8555
ddd8227
f9d7ca5
2d53737
56fe700
7bf120c
7b92bf4
596ebfc
02d786d
b45f805
ac77117
9fd3f78
bb1dcb6
444d7b0
47a2b0b
8c1a133
0b1f532
021fcbb
6530c2c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Generated by Django 3.0.5 on 2020-04-24 09:37 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('accounts', '0005_auto_20200410_2113'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name='newsletter', | ||
name='user_validation_required', | ||
field=models.IntegerField(choices=[(0, 'validierte'), (1, 'nicht validierte'), (2, 'varlidierte und nicht validierte'), (3, 'validiert und von uns approved')], default=0), | ||
), | ||
] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
from django.contrib import admin | ||
from .models import StudentEvaluation, InstitutionEvaluation | ||
|
||
|
||
admin.site.register(StudentEvaluation) | ||
admin.site.register(InstitutionEvaluation) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
from django.apps import AppConfig | ||
|
||
|
||
class EvaluationConfig(AppConfig): | ||
name = 'evaluation' |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
from crispy_forms.bootstrap import Field | ||
from crispy_forms.utils import TEMPLATE_PACK | ||
|
||
|
||
class InputButtonGroup(Field): | ||
""" | ||
Layout object for rendering radio and checkbox elements as button groups:: | ||
|
||
RadioButtons('field_name', [option_label_class="btn blue text-white btn-lg"]) | ||
""" | ||
template = "%s/layout/input_buttongroup.html" | ||
|
||
def __init__(self, *args, **kwargs): | ||
|
||
try: | ||
self.input_type | ||
except AttributeError: | ||
raise NotImplementedError( | ||
'Cannot instantiate {}. input_type property must be set'.format( | ||
type(self).__name__)) | ||
|
||
self.option_label_class = 'btn btn-secondary' | ||
if 'option_label_class' in kwargs: | ||
self.option_label_class = kwargs.pop('option_label_class') | ||
super(InputButtonGroup, self).__init__(*args, **kwargs) | ||
|
||
def render(self, form, form_style, context, template_pack=TEMPLATE_PACK, **kwargs): | ||
return super(InputButtonGroup, self).render( | ||
form, form_style, context, template_pack=template_pack, | ||
extra_context={ | ||
'input_type': self.input_type, | ||
'option_label_class': self.option_label_class | ||
} | ||
) | ||
|
||
class RadioButtons(InputButtonGroup): | ||
input_type = 'radio' | ||
|
||
class CheckboxButtons(InputButtonGroup): | ||
input_type = 'checkbox' |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
from django import forms | ||
from apps.evaluation.models import StudentEvaluation, InstitutionEvaluation | ||
from django.utils.translation import gettext_lazy as _ | ||
|
||
from crispy_forms.helper import FormHelper | ||
from crispy_forms.layout import Layout, Submit, HTML, Row | ||
|
||
from apps.evaluation.custom_crispy import RadioButtons | ||
|
||
|
||
def make_button_group(field): | ||
return RadioButtons(field, option_label_class="btn btn-md blue text-white", | ||
template='evaluation/input_buttongroup-any_indicator.html') | ||
|
||
|
||
class StudentEvaluationForm(forms.ModelForm): | ||
class Meta: | ||
model = StudentEvaluation | ||
exclude = [] | ||
|
||
labels = { | ||
'overall_rating': _('Bitte bewerte deine Erfahrung mit match4healthcare insgesamt!'), | ||
'registration_feedback': _('Hier hast du die Möglichkeit, uns allgemeines Feedback zum match4healthcare' | ||
' zu geben.'), | ||
'suggested_improvements': _('Falls du Verbesserungsvorschläge hast, dann kannst du sie hier loswerden'), | ||
'likelihood_recommendation': _('Wie hoch ist die Wahrscheinlichkeit, dass du unsere Seite weiterbwerten' | ||
'wirst?'), | ||
'contact_mail': _('Hier kannst du deine Mail da lassen, falls du uns für Rückfragen zur Verfügung stehen ' | ||
'möchtest'), | ||
'communication_with_institutions': _('Wie lief für dich die Kommunikation mit den Institutionen?'), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Aren't these questions a bit too open to get helpful answers? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Those are the questions initially suggested in the typeform (see slack). I too think that it might be helpful to be more specific, but I havent really spent a lot of time to think about possible alternatives – so I'm open to any suggestions. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When can query statistics like how many hospitals contacted a student on average etc. but we don't know anything about the process after they were contacted. Maybe something like "How clear were the requirements of the hospitals?", "Did you receive offers which were interesting for you?"... |
||
} | ||
|
||
widgets = { | ||
'registration_feedback': forms.Textarea(attrs={'rows': 4}), | ||
'communication_with_institutions': forms.Textarea(attrs={'rows': 4}), | ||
'suggested_improvements': forms.Textarea(attrs={'rows': 4}), | ||
} | ||
|
||
def __init__(self, *args, **kwargs): | ||
super(StudentEvaluationForm, self).__init__(*args, **kwargs) | ||
self.helper = FormHelper() | ||
self.helper.form_id = 'id-exampleForm' | ||
self.helper.form_class = 'blueForms' | ||
self.helper.form_method = 'post' | ||
self.helper.form_action = 'student' | ||
|
||
self.helper.layout = Layout( | ||
make_button_group('overall_rating'), | ||
'registration_feedback', | ||
'communication_with_institutions', | ||
'suggested_improvements', | ||
make_button_group('likelihood_recommendation'), | ||
'contact_mail', | ||
) | ||
|
||
def clean_overall_rating(self): | ||
if not self.cleaned_data['overall_rating']: | ||
raise forms.ValidationError(_('Bitte gib eine Gesamtbewertung ab!'), code='invalid') | ||
return True |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Generated by Django 3.0.5 on 2020-04-13 09:41 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
initial = True | ||
|
||
dependencies = [ | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='StudentEvaluation', | ||
fields=[ | ||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think in this project we have never used |
||
('test', models.CharField(default='', max_length=50)), | ||
n-hackert marked this conversation as resolved.
Show resolved
Hide resolved
|
||
], | ||
), | ||
] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
# Generated by Django 3.0.5 on 2020-04-24 09:37 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('evaluation', '0001_initial'), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='InstitutionEvaluation', | ||
fields=[ | ||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('overall_rating', models.IntegerField(blank=True, choices=[(1, 'Sehr gut'), (2, 'Gut'), (3, 'Durchschnittlich'), (4, 'Schlecht'), (5, 'Sehr schlecht')], default=3, null=True)), | ||
('registration_feedback', models.TextField(blank=True, default='', null=True)), | ||
('suggested_improvements', models.TextField(blank=True, default='', null=True)), | ||
('likelihood_recommendation', models.IntegerField(blank=True, choices=[(1, 'Sehr gut'), (2, 'Gut'), (3, 'Durchschnittlich'), (4, 'Schlecht'), (5, 'Sehr schlecht')], default=3, null=True)), | ||
('contact_mail', models.EmailField(blank=True, max_length=254, null=True)), | ||
('institution_type', models.CharField(choices=[('hospital', 'Krankenhaus/Spital'), ('general practice', 'Arztpraxis'), ('health authority', 'Gesundheitsamt'), ('emergency medical service', 'Rettungsdienst'), ('other', 'Andere')], default='hospital', max_length=30)), | ||
], | ||
options={ | ||
'abstract': False, | ||
}, | ||
), | ||
migrations.RemoveField( | ||
model_name='studentevaluation', | ||
name='test', | ||
), | ||
migrations.AddField( | ||
model_name='studentevaluation', | ||
name='communication_with_institutions', | ||
field=models.TextField(blank=True, null=True), | ||
), | ||
migrations.AddField( | ||
model_name='studentevaluation', | ||
name='contact_mail', | ||
field=models.EmailField(blank=True, max_length=254, null=True), | ||
), | ||
migrations.AddField( | ||
model_name='studentevaluation', | ||
name='likelihood_recommendation', | ||
field=models.IntegerField(blank=True, choices=[(1, 'Sehr gut'), (2, 'Gut'), (3, 'Durchschnittlich'), (4, 'Schlecht'), (5, 'Sehr schlecht')], default=3, null=True), | ||
), | ||
migrations.AddField( | ||
model_name='studentevaluation', | ||
name='overall_rating', | ||
field=models.IntegerField(blank=True, choices=[(1, 'Sehr gut'), (2, 'Gut'), (3, 'Durchschnittlich'), (4, 'Schlecht'), (5, 'Sehr schlecht')], default=3, null=True), | ||
), | ||
migrations.AddField( | ||
model_name='studentevaluation', | ||
name='registration_feedback', | ||
field=models.TextField(blank=True, default='', null=True), | ||
), | ||
migrations.AddField( | ||
model_name='studentevaluation', | ||
name='suggested_improvements', | ||
field=models.TextField(blank=True, default='', null=True), | ||
), | ||
] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# Generated by Django 3.0.5 on 2020-04-28 15:10 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('evaluation', '0002_auto_20200424_1137'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name='institutionevaluation', | ||
name='likelihood_recommendation', | ||
field=models.IntegerField(choices=[(1, 'Sehr hoch'), (2, 'Hoch'), (3, 'Mittel'), (4, 'Gering'), (5, 'Sehr gering')], default=3), | ||
), | ||
migrations.AlterField( | ||
model_name='institutionevaluation', | ||
name='overall_rating', | ||
field=models.IntegerField(choices=[(1, 'Sehr gut'), (2, 'Gut'), (3, 'Durchschnittlich'), (4, 'Schlecht'), (5, 'Sehr schlecht')], default=3), | ||
), | ||
migrations.AlterField( | ||
model_name='studentevaluation', | ||
name='likelihood_recommendation', | ||
field=models.IntegerField(choices=[(1, 'Sehr hoch'), (2, 'Hoch'), (3, 'Mittel'), (4, 'Gering'), (5, 'Sehr gering')], default=3), | ||
), | ||
migrations.AlterField( | ||
model_name='studentevaluation', | ||
name='overall_rating', | ||
field=models.IntegerField(choices=[(1, 'Sehr gut'), (2, 'Gut'), (3, 'Durchschnittlich'), (4, 'Schlecht'), (5, 'Sehr schlecht')], default=3), | ||
), | ||
] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
from django.db import models | ||
from django.utils.translation import gettext_lazy as _ | ||
|
||
VERY_GOOD = 1 | ||
GOOD = 2 | ||
AVERAGE = 3 | ||
BAD = 4 | ||
VERY_BAD = 5 | ||
|
||
QUALITY_CHOICES = ( | ||
(VERY_GOOD, _('Sehr gut')), | ||
(GOOD, _('Gut')), | ||
(AVERAGE, _('Durchschnittlich')), | ||
(BAD, _('Schlecht')), | ||
(VERY_BAD, _('Sehr schlecht')), | ||
) | ||
|
||
RECOMMENDATION_CHOICES = ( | ||
(VERY_GOOD, _('Sehr hoch')), | ||
(GOOD, _('Hoch')), | ||
(AVERAGE, _('Mittel')), | ||
(BAD, _('Gering')), | ||
(VERY_BAD, _('Sehr gering')), | ||
) | ||
|
||
|
||
# fields common to both, institutions and students | ||
class BaseEvaluation(models.Model): | ||
overall_rating = models.IntegerField(choices=QUALITY_CHOICES, default=AVERAGE, blank=False, null=False) | ||
|
||
registration_feedback = models.TextField(default='', blank=True, null=True) | ||
suggested_improvements = models.TextField(default='', blank=True, null=True) | ||
|
||
likelihood_recommendation = models.IntegerField(choices=RECOMMENDATION_CHOICES, default=AVERAGE, blank=False, | ||
null=False) | ||
|
||
contact_mail = models.EmailField(blank=True, null=True) | ||
|
||
class Meta: | ||
abstract = True | ||
|
||
|
||
# student-specific fields | ||
class StudentEvaluation(BaseEvaluation): | ||
|
||
communication_with_institutions = models.TextField(blank=True, null=True) | ||
|
||
|
||
INSTITUTION_HOSPITAL = 'hospital' | ||
INSTITUTION_GENERAL_PRACTICE = 'general practice' | ||
INSTITUTION_HEALTH_AUTHORITY = 'health authority' | ||
INSTITUTION_EMS = 'emergency medical service' | ||
INSTITUTION_OTHER = 'other' | ||
|
||
INSTITUTION_CHOICES = [ | ||
(INSTITUTION_HOSPITAL, _('Krankenhaus/Spital')), | ||
(INSTITUTION_GENERAL_PRACTICE, _('Arztpraxis')), | ||
(INSTITUTION_HEALTH_AUTHORITY, _('Gesundheitsamt')), | ||
(INSTITUTION_EMS, _('Rettungsdienst')), | ||
(INSTITUTION_OTHER, _('Andere')), | ||
] | ||
|
||
|
||
# institution-specific fields | ||
class InstitutionEvaluation(BaseEvaluation): | ||
|
||
institution_type = models.CharField(max_length=30, choices=INSTITUTION_CHOICES, default=INSTITUTION_HOSPITAL) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
{% extends 'base.html' %} | ||
{% load static %} | ||
{% load i18n %} | ||
|
||
{% block title %} | ||
Danke! | ||
{% endblock %} | ||
|
||
{% block header %} | ||
<link rel="stylesheet" href="{% static 'css/form.css' %}"> | ||
<style type="text/css"> | ||
.bg-container { | ||
background-image: url({% static 'img/login-bg.jpg' %}); | ||
background-position: center; | ||
background-size: cover; | ||
} | ||
@media only screen and (max-width: 767px) { | ||
.bg-container {background-image:none; background-color: #dfe3e4;} | ||
} | ||
|
||
</style> | ||
<script type="text/javascript"> | ||
window.addEventListener('load', function() { | ||
$(window).on("resize", function() { | ||
|
||
var height = $(window).height(); | ||
var navHeight = $('.navbar').outerHeight(); | ||
var footerHeight = $('.footer').innerHeight(); | ||
|
||
var newHeight = height - navHeight - footerHeight; | ||
|
||
$(".login-form").height(newHeight); | ||
|
||
}).trigger("resize"); | ||
|
||
}); | ||
</script> | ||
{% endblock %} | ||
|
||
{% load crispy_forms_tags %} | ||
|
||
{% block content %} | ||
<div class="bg-container"> | ||
<div class="container login-form"> | ||
<div class="col-lg-6 col-md-10 col-sm-12 col-12" > | ||
<div class="card login-card text-center align-items-center"> | ||
<h4>{% blocktrans %} Vielen Dank für Dein Feedback!{% endblocktrans %}</h4> | ||
<hr> | ||
<a href="/"> | ||
<button type="button" class="btn blue text-white btn-md">{% blocktrans %}Zurück zur Startseite!{% endblocktrans %}</button> | ||
</a> | ||
|
||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
{% endblock %} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you add a migration for
newsletter
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That was unintentional, Ill fix it in the next commits.