Skip to content
Snippets Groups Projects
Unverified Commit 12468ed9 authored by Nik | Klampfradler's avatar Nik | Klampfradler
Browse files

Try getting to full names of persons.

parent b2d35417
No related branches found
No related tags found
No related merge requests found
......@@ -13,14 +13,17 @@ class LessonDocumentationForm(forms.ModelForm):
class PersonalNoteForm(forms.ModelForm):
class Meta:
model = PersonalNote
fields = ['person', 'absent', 'late', 'excused', 'remarks']
fields = ['person__last_name', 'person__first_name', 'absent', 'late', 'excused', 'remarks']
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.fields['person'].widget.attrs['readonly'] = True
self.fields['person__last_name'].widget.attrs['readonly'] = True
self.fields['person__first_name'].widget.attrs['readonly'] = True
def clean_person(self):
return self.instance.person
def clean_person__last_name(self):
return self.instance.person__last_name
def clean_person__first_name(self):
return self.instance.person__first_name
PersonalNoteFormSet = forms.modelformset_factory(
......
......@@ -45,7 +45,8 @@
<table class="table table-striped table-bordered table-hover table-condensed table-responsive w-100 d-block d-md-table">
<tr>
<th>{% blocktrans %}Person{% endblocktrans %}</th>
<th>{% blocktrans %}Last name{% endblocktrans %}</th>
<th>{% blocktrans %}First name{% endblocktrans %}</th>
<th>{% blocktrans %}Absent{% endblocktrans %}</th>
<th>{% blocktrans %}Tardiness{% endblocktrans %}</th>
<th>{% blocktrans %}Excused{% endblocktrans %}</th>
......@@ -53,7 +54,8 @@
</tr>
{% for form in personal_note_formset %}
<tr>
<td>{{ form.person }}</td>
<td>{{ form.person__last_name }}</td>
<td>{{ form.person__firstname }}</td>
<td>{{ form.absent }}</td>
<td>{{ form.late }}</td>
<td>{{ form.excused }}</td>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment