Skip to content

Commit

Permalink
Student Portal v1, working login and display session information
Browse files Browse the repository at this point in the history
  • Loading branch information
charlestang06 committed Mar 5, 2024
1 parent d05a56e commit e55296c
Show file tree
Hide file tree
Showing 23 changed files with 593 additions and 349 deletions.
32 changes: 16 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
```
```
Binary file modified db.sqlite3
Binary file not shown.
Empty file added iridisite/.editorconfig
Empty file.
Binary file modified iridisite/__pycache__/settings.cpython-312.pyc
Binary file not shown.
6 changes: 5 additions & 1 deletion iridisite/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@

ALLOWED_HOSTS = []

EMAIL_HOST = "mail.iridiumtutoring.org"
EMAIL_HOST_USER = "[email protected]"
EMAIL_HOST_PASSWORD = "123456"
EMAIL_PORT = 587

# Application definition

Expand Down Expand Up @@ -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 = [
# ...
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -39,3 +38,4 @@ urllib3==2.2.1
Werkzeug==3.0.1
wheel==0.42.0
wrapt==1.16.0
pre-commit
Binary file modified tutoring_student/__pycache__/admin.cpython-312.pyc
Binary file not shown.
Binary file modified tutoring_student/__pycache__/backends.cpython-312.pyc
Binary file not shown.
Binary file modified tutoring_student/__pycache__/models.cpython-312.pyc
Binary file not shown.
Binary file modified tutoring_student/__pycache__/urls.cpython-312.pyc
Binary file not shown.
Binary file modified tutoring_student/__pycache__/views.cpython-312.pyc
Binary file not shown.
2 changes: 1 addition & 1 deletion tutoring_student/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
# Register your models here.
admin.site.register(Tutor)
admin.site.register(Student)
admin.site.register(TutoringSession)
admin.site.register(TutoringSession)
23 changes: 20 additions & 3 deletions tutoring_student/backends.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,32 @@
# 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

# Check if the tutor exists and if the provided password is correct
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
13 changes: 5 additions & 8 deletions tutoring_student/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,19 @@ 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)
email = models.EmailField("Email Address")
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.
Expand Down Expand Up @@ -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()



Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit e55296c

Please sign in to comment.