diff --git a/Website/api/models.py b/Website/api/models.py index 09c9c91..76bfaba 100644 --- a/Website/api/models.py +++ b/Website/api/models.py @@ -26,7 +26,6 @@ class Class(models.Model): description = models.CharField(default="Class Description", max_length=500) repo=models.URLField(default="", blank=True) path=models.CharField(blank=True, max_length=100, default="") - assignments=models.TextField(default="", blank=True) default_file=models.CharField(max_length=100, default="", blank=True) confirmed=models.ManyToManyField(Student, blank=True, related_name='confirmed') unconfirmed=models.ManyToManyField(Student, blank=True, related_name='unconfirmed') @@ -49,12 +48,13 @@ class Teacher(models.Model): user = models.OneToOneField(User, on_delete=models.CASCADE) classes=models.ManyToManyField(Class, blank=True, related_name='classes') git=models.CharField(max_length=100, default="", blank=True) - ion_user=models.CharField(primary_key=True, max_length=100) + ion_user=models.CharField(primary_key=True, blank=True, max_length=100) def __str__(self): return f"{self.user.username}'s Profile" def save(self, *args, **kwargs): + self.ion_user = self.user.username super(Teacher, self).save(*args, **kwargs) # class Student(models.Model): @@ -71,16 +71,14 @@ class Teacher(models.Model): class Assignment(models.Model): - owner = models.ForeignKey('auth.User', related_name='assignments', on_delete=models.CASCADE) + myClass = models.ForeignKey(Class, related_name='assignments', on_delete=models.CASCADE) name=models.CharField(max_length=100, primary_key=True) due_date=models.DateTimeField() # files = models.ManyToManyField(DefFiles) files=models.CharField(max_length=100, default="", blank=True) - path=models.CharField(max_length=100) - classes=models.CharField(max_length=100) - teacher=models.CharField(max_length=100) + path=models.CharField(max_length=100, blank=True) def __str__(self): - return '%s' % (self.name) + return f'{self.name}' class DefFiles(models.Model): diff --git a/Website/skoolos/forms.py b/Website/skoolos/forms.py new file mode 100644 index 0000000..6374f97 --- /dev/null +++ b/Website/skoolos/forms.py @@ -0,0 +1,28 @@ +from django import forms +from django.contrib.auth.models import User +from api.models import Student, Teacher +import re + +class UserUpdateForm(forms.ModelForm): + + username = forms.CharField(max_length=50, disabled=True) + first_name = forms.CharField(max_length=50, disabled=True) + last_name = forms.CharField(max_length=50, disabled=True) + email = forms.EmailField() + + def __init__(self, *args, **kwargs): + super(UserUpdateForm, self).__init__(*args, **kwargs) + + class Meta: + model = User + fields = ['username','first_name','last_name','email'] + +class StudentUpdateForm(forms.ModelForm): + class Meta: + model = Student + fields = ['git'] + +class TeacherUpdateForm(forms.ModelForm): + class Meta: + model = Teacher + fields = ['git'] diff --git a/Website/skoolos/static/skoolos/styles.css b/Website/skoolos/static/skoolos/styles.css index 5da71bb..0f86d92 100644 --- a/Website/skoolos/static/skoolos/styles.css +++ b/Website/skoolos/static/skoolos/styles.css @@ -36,3 +36,59 @@ h1, h2, h3, h4, h5, h6 { .site-header .navbar-nav .nav-link.active { font-weight: 500; } + +.content-section { + background: #ffffff; + padding: 10px 20px; + border: 1px solid #dddddd; + border-radius: 3px; + margin-bottom: 20px; +} + +.article-title { + color: #444444; +} + +a.article-title:hover { + color: #428bca; + text-decoration: none; +} + +.article-content { + white-space: pre-line; +} + +.article-img { + height: 65px; + width: 65px; + margin-right: 16px; +} + +.article-metadata { + padding-bottom: 1px; + margin-bottom: 4px; + border-bottom: 1px solid #e3e3e3; + font-size: 1.5em; +} + +.article-metadata a:hover { + color: #333; + text-decoration: none; +} + +.article-svg { + width: 25px; + height: 25px; + vertical-align: middle; +} + +.account-img { + height: 125px; + width: 125px; + margin-right: 20px; + margin-bottom: 16px; +} + +.account-heading { + font-size: 2.5rem; +} diff --git a/Website/skoolos/templates/skoolos/base.html b/Website/skoolos/templates/skoolos/base.html index eb90110..2ec152d 100644 --- a/Website/skoolos/templates/skoolos/base.html +++ b/Website/skoolos/templates/skoolos/base.html @@ -43,6 +43,16 @@ + {% if messages %} + {% for message in messages %} +
+ {% endfor %} + {% endif %} {% block content %}{% endblock %} diff --git a/Website/skoolos/templates/skoolos/class_detail.html b/Website/skoolos/templates/skoolos/class_detail.html new file mode 100644 index 0000000..e6c02c5 --- /dev/null +++ b/Website/skoolos/templates/skoolos/class_detail.html @@ -0,0 +1,28 @@ +{% extends "skoolos/base.html" %} +{% block content %} +Teachers:
+{{ class.description }}
diff --git a/Website/skoolos/templates/skoolos/profile_student.html b/Website/skoolos/templates/skoolos/profile_student.html new file mode 100644 index 0000000..3da2f41 --- /dev/null +++ b/Website/skoolos/templates/skoolos/profile_student.html @@ -0,0 +1,34 @@ +{% extends "skoolos/base.html" %} +{% load crispy_forms_tags %} +{% block content %} ++ {{ user.email }} + GitHub +
++ {{ user.email }} + GitHub +
+