-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
RecurringSession Model, Tutor Utilities, ManyToMany Rel
- Loading branch information
1 parent
22bd3a3
commit a2ed6bb
Showing
24 changed files
with
1,146 additions
and
24 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,18 @@ | ||
from django.contrib import admin | ||
from .models import Tutor, Student, TutoringSession | ||
from .models import * | ||
|
||
class RecurringInline(admin.TabularInline): | ||
model = RecurringSession.sessions.through | ||
|
||
class RecurringAdmin(admin.ModelAdmin): | ||
"""Recurring admin.""" | ||
model = RecurringSession | ||
inlines = [ | ||
RecurringInline, | ||
] | ||
exclude = ('sessions',) | ||
# Register your models here. | ||
admin.site.register(Tutor) | ||
admin.site.register(Student) | ||
admin.site.register(TutoringSession) | ||
admin.site.register(RecurringSession, RecurringAdmin) |
70 changes: 70 additions & 0 deletions
70
tutoring_student/migrations/0003_tutoringsession_isrecurring_recurringsession.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
# Generated by Django 5.0.3 on 2024-03-16 17:52 | ||
|
||
import django.core.validators | ||
import django.db.models.deletion | ||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("tutoring_student", "0002_alter_student_additionalcomments_and_more"), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name="tutoringsession", | ||
name="isRecurring", | ||
field=models.BooleanField(default=False), | ||
), | ||
migrations.CreateModel( | ||
name="RecurringSession", | ||
fields=[ | ||
( | ||
"id", | ||
models.BigAutoField( | ||
auto_created=True, | ||
primary_key=True, | ||
serialize=False, | ||
verbose_name="ID", | ||
), | ||
), | ||
("dayOfWeek", models.CharField(max_length=10)), | ||
("time", models.TimeField(verbose_name="Time of Session")), | ||
("startDate", models.DateField(verbose_name="Starting Date")), | ||
("endDate", models.DateField(verbose_name="Ending Date")), | ||
( | ||
"duration", | ||
models.DecimalField( | ||
decimal_places=1, | ||
max_digits=2, | ||
validators=[django.core.validators.MaxValueValidator(1.5)], | ||
verbose_name="Duration of Session (Hours)", | ||
), | ||
), | ||
("subject", models.CharField(max_length=100)), | ||
( | ||
"description", | ||
models.TextField( | ||
verbose_name="Further Description of Student Needs" | ||
), | ||
), | ||
("gradeLevel", models.CharField(max_length=100)), | ||
("preferredPlatform", models.CharField(default="Zoom", max_length=100)), | ||
( | ||
"student", | ||
models.ForeignKey( | ||
on_delete=django.db.models.deletion.CASCADE, | ||
to="tutoring_student.student", | ||
), | ||
), | ||
( | ||
"tutor", | ||
models.ForeignKey( | ||
on_delete=django.db.models.deletion.CASCADE, | ||
to="tutoring_student.tutor", | ||
), | ||
), | ||
], | ||
), | ||
] |
18 changes: 18 additions & 0 deletions
18
tutoring_student/migrations/0004_recurringsession_sessions.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Generated by Django 5.0.3 on 2024-03-17 02:25 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("tutoring_student", "0003_tutoringsession_isrecurring_recurringsession"), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name="recurringsession", | ||
name="sessions", | ||
field=models.ManyToManyField(to="tutoring_student.tutoringsession"), | ||
), | ||
] |
20 changes: 20 additions & 0 deletions
20
tutoring_student/migrations/0005_alter_recurringsession_sessions.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Generated by Django 5.0.3 on 2024-03-17 03:45 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("tutoring_student", "0004_recurringsession_sessions"), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name="recurringsession", | ||
name="sessions", | ||
field=models.ManyToManyField( | ||
blank=True, default=[], to="tutoring_student.tutoringsession" | ||
), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
128 changes: 128 additions & 0 deletions
128
tutoring_student/templates/tutoring_student/recurring_details.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,128 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<link | ||
href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" | ||
rel="stylesheet" | ||
integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" | ||
crossorigin="anonymous" | ||
/> | ||
<link | ||
href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.8.1/font/bootstrap-icons.css" | ||
rel="stylesheet" | ||
/> | ||
{% load static %} | ||
<link href="{% static 'tutoring_student/style.css' %}" rel="stylesheet" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1" /> | ||
<title id="title">Iridium Tutoring | Tutor</title> | ||
<style> | ||
.glow { | ||
transition: box-shadow 0.3s ease-in-out; | ||
} | ||
|
||
.glow:hover { | ||
box-shadow: 0 0 20px 2px rgba(0, 0, 0, 0.15); /* Adjust the glow effect */ | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
{% load static %} | ||
<!-- Nav Bar--> | ||
<nav class="navbar navbar-expand-lg navbar-dark bg-dark navbar-inverse"> | ||
<div class="container-fluid"> | ||
<a class="navbar-brand" href="https://www.iridiumtutoring.org" | ||
><img | ||
src="{% static 'tutoring_student/images/iridiumbannerheader.png' %}" | ||
class="img-fluid" | ||
style="height: 3rem" | ||
alt="Iridium Tutoring Logo" | ||
/></a> | ||
<button | ||
class="navbar-toggler" | ||
type="button" | ||
data-bs-toggle="collapse" | ||
data-bs-target="#navbarNavAltMarkup" | ||
aria-controls="navbarNavAltMarkup" | ||
aria-expanded="false" | ||
aria-label="Toggle navigation" | ||
> | ||
<span class="navbar-toggler-icon"></span> | ||
</button> | ||
<div class="collapse navbar-collapse" id="navbarNavAltMarkup"> | ||
<div class="navbar-nav"> | ||
<a | ||
class="nav-link fw-bold" | ||
href="{% url 'tutoring_student:index' %}" | ||
>Home</a | ||
> | ||
<a | ||
class="nav-link fw-bold" | ||
href="{% url 'tutoring_student:tutorView' %}" | ||
>Tutors</a | ||
> | ||
<a | ||
class="nav-link fw-bold" | ||
href="{% url 'tutoring_student:tutorProfile' %}" | ||
>Profile</a | ||
> | ||
<a | ||
class="nav-link active fw-bold" | ||
aria-current="page" | ||
href="{% url 'tutoring_student:tutorUtilities' %}" | ||
>Utilities</a | ||
> | ||
</div> | ||
</div> | ||
<!-- Align with right side of navbar --> | ||
<div class="nav navbar-nav ml-auto mr-0"> | ||
{% if not user %} | ||
<a class="nav-link fw-bold" href="https://www.iridiumtutoring.org" | ||
>Back To Main Site</a | ||
> | ||
{% endif %} | ||
{% if user %} | ||
<a href="{% url 'tutoring_student:tutor_logout' %}"> | ||
<button class="btn btn-outline-light"> | ||
<i class="bi bi-box-arrow-right fw-bold"></i> | ||
</button> | ||
</a> | ||
{% endif %} | ||
</div> | ||
</div> | ||
</nav> | ||
{% if user %} | ||
<div class="container mt-3"> | ||
<h1 class="text-center mt-5">{{recurring.student.studentName}}'s Recurring Session</h1> | ||
<hr /> | ||
<div class="row justify-content-md-center mt-5 mb-3"> | ||
<div class="col d-none d-md-block"> </div> | ||
<div class="list-group col-12 col-md-7"> | ||
{% for session in recurring.sessions.all %} | ||
<a class="list-group-item list-group-item-action" | ||
><div class="d-flex w-100 justify-content-between"> | ||
<h5 class="mb-1">{{session.student.studentName}} - {{session.subject}} (Grade {{session.gradeLevel}})</h5> | ||
{% if session.isRecurring %} | ||
<span class="badge bg-secondary align-self-start">Recurring</span> | ||
{% endif %} | ||
</div> | ||
<small>{{session.date}} - {{session.time}} ({{session.duration}} hours)</small> | ||
</a> | ||
{% endfor %} | ||
|
||
</div> | ||
<div class="col d-none d-md-block"> </div> | ||
</div> | ||
<a class="btn btn-secondary btn-lg rounded-pill mt-3" href="{% url 'tutoring_student:tutorRecurrings' %}" role="button">Go Back</a> | ||
</div> | ||
|
||
{% endif %} | ||
<!-- Footer--> | ||
{% include 'tutoring_student/footer.html' %} | ||
</body> | ||
<script | ||
src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.bundle.min.js" | ||
integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM" | ||
crossorigin="anonymous" | ||
></script> | ||
</html> |
Oops, something went wrong.