-
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.
- Loading branch information
1 parent
656d13b
commit 8900780
Showing
154 changed files
with
7,016 additions
and
0 deletions.
There are no files selected for viewing
Empty file.
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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
from django.contrib import admin | ||
from home.models import Assignment, Submission | ||
# Register your models here. | ||
|
||
admin.site.register((Assignment, Submission)) |
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,5 @@ | ||
from django.apps import AppConfig | ||
|
||
|
||
class HomeConfig(AppConfig): | ||
name = 'home' |
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,10 @@ | ||
|
||
from users.models import Notification, Notification_general | ||
|
||
def noti_count(request): | ||
if request.user.is_authenticated: | ||
count1 = Notification.objects.filter(user=request.user, seen=False) | ||
count2 = Notification_general.objects.filter(user=request.user, seen=False) | ||
return {"count1": count1, 'count2':count2,} | ||
else: | ||
return {"?":"?"} |
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,63 @@ | ||
# Generated by Django 3.1 on 2021-04-19 13:34 | ||
|
||
from django.conf import settings | ||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
initial = True | ||
|
||
dependencies = [ | ||
migrations.swappable_dependency(settings.AUTH_USER_MODEL), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='Assignment', | ||
fields=[ | ||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('title', models.CharField(max_length=255)), | ||
('upload', models.FileField(default='No file uploaded', null=True, upload_to='assignments/')), | ||
('due_date', models.DateField()), | ||
('created_at', models.DateField(auto_now_add=True)), | ||
('last_updated', models.DateField(auto_now=True)), | ||
('descprition', models.CharField(blank=True, max_length=1000, null=True)), | ||
('submmetted_by', models.ManyToManyField(blank=True, to=settings.AUTH_USER_MODEL)), | ||
], | ||
), | ||
migrations.CreateModel( | ||
name='Upload', | ||
fields=[ | ||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('upload', models.FileField(default='No file uploaded', upload_to='submissions/')), | ||
('assignment', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='sub_upload', to='home.assignment')), | ||
('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='sub_up_user', to=settings.AUTH_USER_MODEL)), | ||
], | ||
), | ||
migrations.CreateModel( | ||
name='Submission', | ||
fields=[ | ||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('upload', models.FileField(default='No file uploaded', upload_to='submissions/')), | ||
('submitted_at', models.DateField(auto_now=True)), | ||
('descprition', models.CharField(blank=True, max_length=1000, null=True)), | ||
('last_updated', models.DateField(auto_now=True)), | ||
('grade', models.CharField(blank=True, default='No grade yet', max_length=100, null=True)), | ||
('feedback', models.CharField(blank=True, default='No feedback yet', max_length=255, null=True)), | ||
('assignment', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='submissions', to='home.assignment')), | ||
('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='submissions', to=settings.AUTH_USER_MODEL)), | ||
], | ||
), | ||
migrations.AddField( | ||
model_name='assignment', | ||
name='uploads', | ||
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='assignments_upload', to='home.upload'), | ||
), | ||
migrations.AddField( | ||
model_name='assignment', | ||
name='user', | ||
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='assignments', to=settings.AUTH_USER_MODEL), | ||
), | ||
] |
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 3.1 on 2021-04-19 13:37 | ||
|
||
from django.db import migrations | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('home', '0001_initial'), | ||
] | ||
|
||
operations = [ | ||
migrations.RemoveField( | ||
model_name='assignment', | ||
name='uploads', | ||
), | ||
migrations.DeleteModel( | ||
name='Upload', | ||
), | ||
] |
Empty file.
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 |
---|---|---|
@@ -0,0 +1,67 @@ | ||
from django.db import models | ||
import uuid | ||
from django.db import models | ||
from django.contrib.auth.models import User | ||
from django.db.models.signals import post_save | ||
from django.dispatch import receiver | ||
from users.models import Profile | ||
import os | ||
|
||
|
||
|
||
|
||
|
||
|
||
class Assignment(models.Model): | ||
title = models.CharField(max_length=255) | ||
upload = models.FileField(upload_to='assignments/', null=True, default="No file uploaded") | ||
|
||
due_date = models.DateField() | ||
created_at = models.DateField(auto_now_add=True) | ||
last_updated = models.DateField(auto_now=True) | ||
# subject = models.ForeignKey(Profile.subject, on_delete=models.CASCADE,) | ||
|
||
descprition = models.CharField(null=True, blank=True, max_length=1000) | ||
submmetted_by = models.ManyToManyField(User, blank=True) | ||
user = models.ForeignKey( | ||
User, | ||
on_delete=models.CASCADE, | ||
related_name='assignments' | ||
) | ||
|
||
def extension_ass(self): | ||
extension = os.path.splitext(self.upload.name)[1] | ||
return extension | ||
|
||
def __str__(self): | ||
return self.user.username + " created " + self.title | ||
|
||
|
||
|
||
class Submission(models.Model): | ||
upload = models.FileField(upload_to='submissions/', default="No file uploaded") | ||
submitted_at = models.DateField(auto_now=True) | ||
descprition = models.CharField(null=True, blank=True, max_length=1000) | ||
last_updated = models.DateField(auto_now=True) | ||
assignment = models.ForeignKey( | ||
'Assignment', | ||
on_delete=models.CASCADE, | ||
related_name='submissions' | ||
) | ||
user = models.ForeignKey( | ||
User, | ||
on_delete=models.CASCADE, | ||
related_name='submissions' | ||
) | ||
|
||
def extension_sub(self): | ||
extension = os.path.splitext(self.upload.name)[1] | ||
return extension | ||
|
||
grade = models.CharField(max_length=100, null=True, blank=True, default="No grade yet") | ||
feedback = models.CharField(max_length=255, null=True, blank=True, default="No feedback yet") | ||
def __str__(self): | ||
return self.user.username + " submmitted " + self.assignment.title | ||
|
||
|
||
|
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,3 @@ | ||
from django.test import TestCase | ||
|
||
# Create your tests here. |
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,44 @@ | ||
from django.urls import path | ||
from home import views | ||
urlpatterns = [ | ||
path('home/', views.dashboard, name="home"), | ||
|
||
path('assignments/create/', views.create_assignment, name='add_assignment'), | ||
path('assignments/<id>/pass', views.pre_submission, | ||
name='pre_submission'), | ||
|
||
path('assignments/<id>/', views.assignment_detail), | ||
|
||
path('submissions/', views.all_submmission, name="all_submmission"), | ||
|
||
|
||
path('assignments/<id>/detail/', views.assignments_detail, name="assignments_detail"), | ||
|
||
path('assignments/', views.all_assignment, name='all_assignment'), | ||
|
||
path('submissions/all/', views.all_assignment_submmission, name='all_assignment_submmission'), | ||
|
||
path('assignments/<id>/delete', views.delete_assignment, | ||
name='delete_assignment'), | ||
|
||
path('assignments/<id>/edit', views.edit_assignment, | ||
name='edit_assignment'), | ||
|
||
path('assignments/<id>/submission/', views.submit_assignment, | ||
name='assignment_submission'), | ||
|
||
path('submissions/<id>/delete', views.delete_submission, | ||
name='delete_submission'), | ||
|
||
path('submissions/<id>/edit', views.edit_submission, | ||
name='submission_detail'), | ||
|
||
|
||
path('assignments/<id>/submissions', views.assignment_submissions, | ||
name='submissions'), | ||
|
||
path('assouncement/add/', views.create_Notification), | ||
path('notifications/', views.all_notification), | ||
path('test/', views.test) | ||
# path('notifications/clear/', views.clear_notifications), | ||
] |
Oops, something went wrong.