diff --git a/src/attendance/templates/attendance/entry_form.html b/src/attendance/templates/attendance/entry_form.html
index ba63152..a1b4d62 100644
--- a/src/attendance/templates/attendance/entry_form.html
+++ b/src/attendance/templates/attendance/entry_form.html
@@ -4,7 +4,7 @@
For {{student}}
-{% endblock %}
\ No newline at end of file
+{% endblock %}
diff --git a/src/core/forms.py b/src/core/forms.py
index 431c045..4552c7f 100644
--- a/src/core/forms.py
+++ b/src/core/forms.py
@@ -16,36 +16,55 @@ from .models import (
class SchoolYearCreateForm(forms.ModelForm):
class Meta:
model = SchoolYear
- fields = [
- 'year'
- ]
+ fields = ['year']
class StudentForm(forms.ModelForm):
class Meta:
model = Student
- fields = (
+ fields = [
'student_id',
'first_name',
'last_name',
'address',
'dob',
- )
+ 'tags'
+ ]
labels = {
'student_id': 'Student ID',
- 'dob': 'DOB',
+ 'dob': 'DOB'
}
class ComponentCreateForm(forms.ModelForm):
class Meta:
model = Component
- fields = (
+ fields = [
'name',
'category',
'due_date',
- 'grade_total',
- )
+ 'grade_total'
+ ]
widgets = {
- 'due_date': forms.DateInput(attrs={'type': 'date'}),
+ 'due_date': forms.DateInput(attrs={'type': 'date'})
+ }
+
+
+class SchoolDayForm(forms.ModelForm):
+ class Meta:
+ model = SchoolDay
+ fields = ['date']
+ widgets = {
+ 'date': forms.DateInput(attrs={
+ 'type': 'date',
+ })
+ }
+
+
+class AttendanceEntryForm(forms.ModelForm):
+ class Meta:
+ model = AttendanceEntry
+ fields = ['status']
+ widgets = {
+ 'status': forms.RadioSelect()
}
diff --git a/src/core/migrations/0007_remove_studenttag_core_studen_content_a7305d_idx_and_more.py b/src/core/migrations/0007_remove_studenttag_core_studen_content_a7305d_idx_and_more.py
new file mode 100644
index 0000000..8e71e28
--- /dev/null
+++ b/src/core/migrations/0007_remove_studenttag_core_studen_content_a7305d_idx_and_more.py
@@ -0,0 +1,30 @@
+# Generated by Django 4.0.5 on 2022-07-27 19:55
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('core', '0006_score'),
+ ]
+
+ operations = [
+ migrations.RemoveIndex(
+ model_name='studenttag',
+ name='core_studen_content_a7305d_idx',
+ ),
+ migrations.RemoveField(
+ model_name='studenttag',
+ name='content_type',
+ ),
+ migrations.RemoveField(
+ model_name='studenttag',
+ name='object_id',
+ ),
+ migrations.AddField(
+ model_name='student',
+ name='tags',
+ field=models.ManyToManyField(blank=True, to='core.studenttag'),
+ ),
+ ]
diff --git a/src/core/migrations/0008_remove_studenttag_tag_studenttag_name.py b/src/core/migrations/0008_remove_studenttag_tag_studenttag_name.py
new file mode 100644
index 0000000..9c7dda9
--- /dev/null
+++ b/src/core/migrations/0008_remove_studenttag_tag_studenttag_name.py
@@ -0,0 +1,23 @@
+# Generated by Django 4.0.5 on 2022-07-27 19:57
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('core', '0007_remove_studenttag_core_studen_content_a7305d_idx_and_more'),
+ ]
+
+ operations = [
+ migrations.RemoveField(
+ model_name='studenttag',
+ name='tag',
+ ),
+ migrations.AddField(
+ model_name='studenttag',
+ name='name',
+ field=models.CharField(default='Allergy: Seasonal/Hay', max_length=255),
+ preserve_default=False,
+ ),
+ ]
diff --git a/src/core/models.py b/src/core/models.py
index c23034e..b2eb966 100644
--- a/src/core/models.py
+++ b/src/core/models.py
@@ -30,21 +30,13 @@ class SchoolYear(models.Model):
class StudentTag(models.Model):
- tag = models.SlugField()
- content_type = models.ForeignKey(ContentType, on_delete=models.CASCADE)
- object_id = models.PositiveIntegerField()
- content_object = GenericForeignKey('content_type', 'object_id')
+ name = models.CharField(max_length=255)
created_at = models.DateTimeField(auto_now_add=True)
updated_at = models.DateTimeField(auto_now=True)
def __str__(self):
- return self.tag
-
- class Meta:
- indexes = [
- models.Index(fields=['content_type', 'object_id']),
- ]
+ return self.name
# class StudentManager(models.Manager):
@@ -70,7 +62,7 @@ class Student(models.Model):
address = models.TextField(blank=True)
dob = models.DateField()
- tags = GenericRelation(StudentTag)
+ tags = models.ManyToManyField(StudentTag, blank=True)
created_at = models.DateTimeField(auto_now_add=True)
updated_at = models.DateTimeField(auto_now=True)
@@ -236,6 +228,12 @@ class SchoolDay(models.Model):
created_at = models.DateTimeField(auto_now_add=True)
updated_at = models.DateTimeField(auto_now=True)
+ def get_absolute_url(self):
+ return reverse('core:schoolday-detail', kwargs={
+ 'year': self.school_year.year,
+ 'pk': self.pk
+ })
+
def __str__(self):
return f'{self.date}'
@@ -265,6 +263,13 @@ class AttendanceEntry(models.Model):
created_at = models.DateTimeField(auto_now_add=True)
updated_at = models.DateTimeField(auto_now=True)
+ def get_absolute_url(self):
+ return reverse('core:schoolday-detail', kwargs={
+ 'year': self.school_day.school_year.year,
+ 'pk': self.school_day.pk,
+ 'entry_pk': self.pk
+ })
+
def __str__(self):
return f"{self.day} | {self.student} | {self.status}"
diff --git a/src/core/templates/core/attendanceentry_confirm_delete.html b/src/core/templates/core/attendanceentry_confirm_delete.html
new file mode 100644
index 0000000..c1ae1ff
--- /dev/null
+++ b/src/core/templates/core/attendanceentry_confirm_delete.html
@@ -0,0 +1,13 @@
+{% extends 'base.html' %}
+
+{% block content %}
+
Delete Attendanceentry
+
+{% endblock %}
diff --git a/src/core/templates/core/attendanceentry_create_form.html b/src/core/templates/core/attendanceentry_create_form.html
new file mode 100644
index 0000000..d4a2762
--- /dev/null
+++ b/src/core/templates/core/attendanceentry_create_form.html
@@ -0,0 +1,12 @@
+{% extends 'base.html' %}
+
+{% block content %}
++ New Attendanceentry
+
+{% endblock %}
diff --git a/src/core/templates/core/attendanceentry_detail.html b/src/core/templates/core/attendanceentry_detail.html
new file mode 100644
index 0000000..0ae4565
--- /dev/null
+++ b/src/core/templates/core/attendanceentry_detail.html
@@ -0,0 +1,33 @@
+{% extends 'base.html' %}
+
+{% block head_title %}Attendance | {% endblock head_title %}
+
+{% block breadcrumbs %}
+
+{% endblock breadcrumbs %}
+
+{% block content %}
+
+
+
+
+{% endblock %}
diff --git a/src/core/templates/core/attendanceentry_form.html b/src/core/templates/core/attendanceentry_form.html
new file mode 100644
index 0000000..ce10d77
--- /dev/null
+++ b/src/core/templates/core/attendanceentry_form.html
@@ -0,0 +1,33 @@
+{% extends 'base.html' %}
+
+{% block head_title %}Attendance | {% endblock head_title %}
+
+{% block breadcrumbs %}
+
+{% endblock breadcrumbs %}
+
+{% block content %}
+
+
+
+
+{% endblock %}
diff --git a/src/core/templates/core/attendanceentry_list.html b/src/core/templates/core/attendanceentry_list.html
new file mode 100644
index 0000000..bd7d376
--- /dev/null
+++ b/src/core/templates/core/attendanceentry_list.html
@@ -0,0 +1,16 @@
+{% extends 'base.html' %}
+
+{% block content %}
+Attendanceentrys
+
+
+ {% for attendanceentry in attendanceentry_list %}
+
+ {{ attendanceentry }}
+
+ {% empty %}
+ No attendanceentrys yet.
+ {% endfor %}
+
+
+{% endblock %}
diff --git a/src/core/templates/core/component_detail.html b/src/core/templates/core/component_detail.html
index 3ca5d54..12d3285 100644
--- a/src/core/templates/core/component_detail.html
+++ b/src/core/templates/core/component_detail.html
@@ -63,7 +63,7 @@
| {{score.student.student_id}} — {{score.student}} |
{{score.value}} / {{component.grade_total}} |
- Edit score |
+ Edit |
{% endfor %}
diff --git a/src/core/templates/core/component_form.html b/src/core/templates/core/component_form.html
index ea2259c..426179a 100644
--- a/src/core/templates/core/component_form.html
+++ b/src/core/templates/core/component_form.html
@@ -1,7 +1,7 @@
{% extends 'base.html' %}
{% block content %}
-Update Component
+Edit Component