Commit 8fdc7d50 authored by Star Neptune R. Sy's avatar Star Neptune R. Sy

Merge branch 'assignments' into 'main'

Assignments

See merge request !3
parents bc0c3d82 d9515a5a
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# C extensions
*.so
# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST
# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec
# Installer logs
pip-log.txt
pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/
# Translations
*.mo
*.pot
# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal
# Flask stuff:
instance/
.webassets-cache
# Scrapy stuff:
.scrapy
# Sphinx documentation
docs/_build/
# PyBuilder
.pybuilder/
target/
# Jupyter Notebook
.ipynb_checkpoints
# IPython
profile_default/
ipython_config.py
# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version
# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock
# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock
# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm.fming.dev/#use-with-ide
.pdm.toml
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/
# Celery stuff
celerybeat-schedule
celerybeat.pid
# SageMath parsed files
*.sage.py
# Environments
.env .env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/
# Spyder project settings
.spyderproject
.spyproject
# Rope project settings
.ropeproject
# mkdocs documentation
/site
# mypy
.mypy_cache/
.dmypy.json
dmypy.json
# Pyre type checker
.pyre/
# pytype static type analyzer
.pytype/
# Cython debug symbols
cython_debug/
# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/
\ No newline at end of file
# Generated by Django 3.2 on 2023-03-05 09:46
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('dashboard', '0001_initial'),
('announcementBoard', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='announcement',
name='author',
field=models.ForeignKey(default=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='announcements', to='dashboard.widgetuser'),
),
migrations.AlterField(
model_name='reaction',
name='annoucement',
field=models.ForeignKey(default=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='reactions', to='announcementBoard.announcement'),
),
migrations.AlterField(
model_name='reaction',
name='name',
field=models.CharField(choices=[('Like', 'Like'), ('Love', 'Love'), ('Angry', 'Angry')], default='Like', max_length=5),
),
migrations.AlterField(
model_name='reaction',
name='tally',
field=models.PositiveIntegerField(default=0),
),
]
from django.contrib import admin
from .models import Assignment, Course
class AssignmentInline(admin.StackedInline):
model = Assignment
class AssignmentAdmin(admin.ModelAdmin):
model = Assignment
list_display = ('assignment_name', 'section')
search_fields = ('course',)
list_filter = ('section', 'perfect_score', 'passing_score')
class CourseAdmin(admin.ModelAdmin):
model = Course
list_display = ('course_code', 'course_title',)
search_fields = ('course_code', 'course_title',)
list_filter = ('course_code', 'course_title',)
admin.site.register(Course, CourseAdmin)
admin.site.register(Assignment, AssignmentAdmin)
\ No newline at end of file
from django.apps import AppConfig
class AssignmentsConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'assignments'
# Generated by Django 3.2 on 2023-03-05 06:23
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Course',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('course_code', models.CharField(default='', max_length=50, unique=True)),
('course_title', models.CharField(default='', max_length=50, unique=True)),
],
),
migrations.CreateModel(
name='Assignment',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('assignment_name', models.CharField(default='', max_length=50, unique=True)),
('description', models.TextField(default='')),
('perfect_score', models.IntegerField(default=0)),
('passing_score', models.IntegerField(default=0)),
('section', models.CharField(max_length=16, unique=True)),
('course', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='subject', to='assignments.course')),
],
),
]
# Generated by Django 3.2 on 2023-03-05 09:21
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('assignments', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='course',
name='course_code',
field=models.CharField(default='', max_length=10, unique=True),
),
]
from django.db import models
class Course(models.Model):
course_code = models.CharField(unique=True, default="", max_length=10,)
course_title = models.CharField(unique=True, default="", max_length=50,)
def __str__(self):
return '{} {}'.format(self.course_code, self.course_title,)
class Assignment(models.Model):
assignment_name = models.CharField(unique=True, default="", max_length=50,)
description = models.TextField(default="")
perfect_score = models.IntegerField(default=0)
passing_score = models.IntegerField(default=0)
section = models.CharField(unique=True, max_length=16,)
course = models.ForeignKey(
Course,
on_delete=models.CASCADE,
related_name='subject'
)
def __str__(self):
return '{} {}-'.format(self.assignment_name, self.section,)
from django.test import TestCase
# Create your tests here.
from django.urls import path
from .views import index
urlpatterns = [
path('', index, name='index'),
]
app_name = "assignments"
\ No newline at end of file
from django.shortcuts import render
from django.http import HttpResponse
from .models import Assignment
def index(request):
head = "<h1 style='border-bottom:4px solid lightgray;\
padding-bottom:30px;\
font-size:500%;'>\
Widget's assignment page\
</h1>\n"
body = ""
for subject in Assignment.objects.all():
body += "<p style='border: 2px solid gray;\
border-radius:5px;\
padding:20px 30px;'>\
<b> Assignment Name: "+subject.assignment_name+" </b> <br>\
Description: "+subject.description+" <br>\
Perfect Score: "+str(subject.perfect_score)+" <br>\
Passing Score: "+str(subject.passing_score)+" <br>\
Course/Section: "+str(subject.course)+" /"+str(subject.section)+" <br>\
</p>"
return_string = "<html>\
<body>\
{}{}\
</body></html>".format(head, body)
return HttpResponse(return_string)
...@@ -41,6 +41,7 @@ INSTALLED_APPS = [ ...@@ -41,6 +41,7 @@ INSTALLED_APPS = [
'django.contrib.messages', 'django.contrib.messages',
'django.contrib.staticfiles', 'django.contrib.staticfiles',
'dashboard', 'dashboard',
'assignments',
'announcementBoard', 'announcementBoard',
] ]
......
...@@ -19,5 +19,6 @@ from django.urls import include, path ...@@ -19,5 +19,6 @@ from django.urls import include, path
urlpatterns = [ urlpatterns = [
path('admin/', admin.site.urls), path('admin/', admin.site.urls),
path('dashboard/', include('dashboard.urls', namespace="dashboard")), path('dashboard/', include('dashboard.urls', namespace="dashboard")),
path('assignments/', include('assignments.urls', namespace="assignments")),
path('announcementBoard/', include('announcementBoard.urls', namespace="announcementBoard")), path('announcementBoard/', include('announcementBoard.urls', namespace="announcementBoard")),
] ]
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment