diff --git a/README.md b/README.md index ab400b0..39011cb 100644 --- a/README.md +++ b/README.md @@ -1,29 +1,29 @@ # Iridium Tutoring Dashboard -[Iridium Tutoring](https://www.iridiumtutoring.org) is a nationwide 501(c)(3) nonprofit tutoring organization serving K-12 students with free, personalized educational support in all subjects. Our mission is to provide high-quality, accessible, and equitable tutoring to students in need, regardless of their background or financial status. We are committed to helping students reach their full potential and achieve academic success. +[Iridium Tutoring](https://www.iridiumtutoring.org) is a nationwide 501(c)(3) nonprofit tutoring organization serving K-12 students with free, personalized educational support in all subjects. Our mission is to provide high-quality, accessible, and equitable tutoring to students in need, regardless of their background or financial status. We are committed to helping students reach their full potential and achieve academic success. + +This dashboard streamlines the tutoring session registration process and tutor sign-up process to a non-Google-Sheets/Forms hosted platform. Developed by the 2024 Iridium Tutoring director team (Charles Tang). Utilizes Model-View-Template (MVT) architecture for Tutors, Students, and TutoringSessions. -This dashboard streamlines the tutoring session registration process and tutor sign-up process to a non-Google-Sheets/Forms hosted platform. Developed by the 2024 Iridium Tutoring director team (Charles Tang). ## Tech Stack - **Frontend**: Django, HTML, CSS, JavaScript - **Backend**: Django, SQLite -- **Deployment**: *To be determined* +- **Deployment**: DigitalOcean ## Features -- Admin dashboard (manage tutor, student, session registrations) -- Tutor dashboard -- Student session registration -- Model-View-Template (MVT) architecture for Tutors, Students, and TutoringSessions +[x] Admin dashboard (manage tutor, student, session registrations) +[x] Student session registration (sign up for tutoring sessions, email confirmation, automatic account generation) +[] Student dashboard (login/logout, see past/upcoming sessions, register session, see tutor details) +[] Tutor dashboard (login/logout, see available sessions, see historical sessions, volunteering hours, sign up for sessions, past taken sessions, add sessions) +[] Admin dashboard (sort by model, create new tutor form, create new session form) +[] Deployed onto DigitalOcean (thanks to nonprofit credits), subdomain of iridiumtutoring.org -## Future Features -[] Student dashboard + auth -[] Tutor auth -[] Director auth -[] Full site ported from Google Sites +## Notes -## How To Run +Since we are deploying with a SQLite single-file database, we will need to download the database from the server every time we deploy. This is not ideal, but it is the best we can do with our current resources. -We assume you have the latest version of Python installed. +## How To Run +We assume you have the latest version of Python installed. 1. Clone the repository ```bash @@ -35,7 +35,7 @@ We assume you have the latest version of Python installed. pip install django ``` -3. Run the server. +3. Run the server. ```bash python manage.py runserver -``` \ No newline at end of file +``` diff --git a/db.sqlite3 b/db.sqlite3 index 8866e4d..e294218 100644 Binary files a/db.sqlite3 and b/db.sqlite3 differ diff --git a/iridisite/.editorconfig b/iridisite/.editorconfig new file mode 100644 index 0000000..e69de29 diff --git a/iridisite/__pycache__/settings.cpython-312.pyc b/iridisite/__pycache__/settings.cpython-312.pyc index 5a376aa..07833ac 100644 Binary files a/iridisite/__pycache__/settings.cpython-312.pyc and b/iridisite/__pycache__/settings.cpython-312.pyc differ diff --git a/iridisite/settings.py b/iridisite/settings.py index 03a7a51..62cc3d5 100644 --- a/iridisite/settings.py +++ b/iridisite/settings.py @@ -27,6 +27,10 @@ ALLOWED_HOSTS = [] +EMAIL_HOST = "mail.iridiumtutoring.org" +EMAIL_HOST_USER = "noreply@iridiumtutoring.org" +EMAIL_HOST_PASSWORD = "123456" +EMAIL_PORT = 587 # Application definition @@ -102,7 +106,7 @@ ] # Auth backends -AUTHENTICATION_BACKENDS = ['tutoring_student.backends.TutorBackend', 'django.contrib.auth.backends.ModelBackend'] +AUTHENTICATION_BACKENDS = ['tutoring_student.backends.TutorBackend', 'tutoring_student.backends.StudentBackend', 'django.contrib.auth.backends.ModelBackend'] INTERNAL_IPS = [ # ... diff --git a/requirements.txt b/requirements.txt index 404f57a..242ac79 100644 --- a/requirements.txt +++ b/requirements.txt @@ -26,7 +26,6 @@ protobuf==4.25.3 Pygments==2.17.2 requests==2.31.0 rich==13.7.1 -scikit-learn==1.4.1.post1 scipy==1.12.0 setuptools==69.1.1 six==1.16.0 @@ -39,3 +38,4 @@ urllib3==2.2.1 Werkzeug==3.0.1 wheel==0.42.0 wrapt==1.16.0 +pre-commit diff --git a/tutoring_student/__pycache__/admin.cpython-312.pyc b/tutoring_student/__pycache__/admin.cpython-312.pyc index 7c6205b..d30f0f7 100644 Binary files a/tutoring_student/__pycache__/admin.cpython-312.pyc and b/tutoring_student/__pycache__/admin.cpython-312.pyc differ diff --git a/tutoring_student/__pycache__/backends.cpython-312.pyc b/tutoring_student/__pycache__/backends.cpython-312.pyc index 726d328..304e16d 100644 Binary files a/tutoring_student/__pycache__/backends.cpython-312.pyc and b/tutoring_student/__pycache__/backends.cpython-312.pyc differ diff --git a/tutoring_student/__pycache__/models.cpython-312.pyc b/tutoring_student/__pycache__/models.cpython-312.pyc index 6eaf0a8..dea8379 100644 Binary files a/tutoring_student/__pycache__/models.cpython-312.pyc and b/tutoring_student/__pycache__/models.cpython-312.pyc differ diff --git a/tutoring_student/__pycache__/urls.cpython-312.pyc b/tutoring_student/__pycache__/urls.cpython-312.pyc index 017597a..7e7afcb 100644 Binary files a/tutoring_student/__pycache__/urls.cpython-312.pyc and b/tutoring_student/__pycache__/urls.cpython-312.pyc differ diff --git a/tutoring_student/__pycache__/views.cpython-312.pyc b/tutoring_student/__pycache__/views.cpython-312.pyc index 003b881..979768b 100644 Binary files a/tutoring_student/__pycache__/views.cpython-312.pyc and b/tutoring_student/__pycache__/views.cpython-312.pyc differ diff --git a/tutoring_student/admin.py b/tutoring_student/admin.py index 97428f3..bc32fb0 100644 --- a/tutoring_student/admin.py +++ b/tutoring_student/admin.py @@ -4,4 +4,4 @@ # Register your models here. admin.site.register(Tutor) admin.site.register(Student) -admin.site.register(TutoringSession) \ No newline at end of file +admin.site.register(TutoringSession) diff --git a/tutoring_student/backends.py b/tutoring_student/backends.py index 9e33723..b500b51 100644 --- a/tutoring_student/backends.py +++ b/tutoring_student/backends.py @@ -1,11 +1,13 @@ # backends.py from django.contrib.auth.backends import ModelBackend -from .models import Tutor +from .models import Tutor, Student + +# Custom authentication backend for Tutor model class TutorBackend(ModelBackend): - def authenticate(self, request, username=None, password=None, **kwargs): + def authenticate(self, request, email=None, password=None, **kwargs): try: - tutor = Tutor.objects.get(user__email=username) + tutor = Tutor.objects.get(email=email) except Tutor.DoesNotExist: return None @@ -13,3 +15,18 @@ def authenticate(self, request, username=None, password=None, **kwargs): if tutor.user.check_password(password): return tutor.user return None + + +# Custom authentication backend for Student model +class StudentBackend(ModelBackend): + def authenticate(self, request, fullName=None, email=None, password=None, **kwargs): + try: + student = Student.objects.get( + studentName=fullName, email=email + ) + if student is None: + return None + else: + return student.user + except Student.DoesNotExist: + return None diff --git a/tutoring_student/models.py b/tutoring_student/models.py index 65455a0..4bdf205 100644 --- a/tutoring_student/models.py +++ b/tutoring_student/models.py @@ -11,7 +11,7 @@ class Student(models.Model): """ def __str__(self): return self.studentName - + # Personal Information user = models.OneToOneField(User, on_delete=models.CASCADE) studentName = models.CharField(max_length=100) @@ -19,11 +19,11 @@ def __str__(self): password = models.CharField(max_length=100, default="123456") phone = models.CharField(max_length=15, null=True) location = models.CharField(max_length=100, null=True) - + # Additional Information howDidYouHear = models.CharField(max_length=100, null=True) additionalComments = models.TextField(null=True) - + class Tutor(models.Model): """ Model for a tutor. @@ -53,14 +53,11 @@ def __str__(self): description = models.TextField("Further Description of Student Needs") gradeLevel = models.CharField(max_length=100) preferredPlatform = models.CharField(default="Zoom", max_length=100) - + # Personal Information student = models.ForeignKey(Student, on_delete=models.CASCADE) tutor = models.ForeignKey(Tutor, on_delete=models.CASCADE, null=True) - + # Useful Functions def was_in_the_past(self): return self.date < timezone.now().date() - - - diff --git a/tutoring_student/static/tutoring_student/images/wait.gif b/tutoring_student/static/tutoring_student/images/wait.gif new file mode 100644 index 0000000..e1b07ea Binary files /dev/null and b/tutoring_student/static/tutoring_student/images/wait.gif differ diff --git a/tutoring_student/templates/tutoring_student/index.html b/tutoring_student/templates/tutoring_student/index.html index 90a56c5..15cf795 100644 --- a/tutoring_student/templates/tutoring_student/index.html +++ b/tutoring_student/templates/tutoring_student/index.html @@ -8,6 +8,7 @@ integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous" /> +