Commit ddcf5759 authored by Bianca Aguilar's avatar Bianca Aguilar

Updating local repo

parents 24513c2b 54290254
...@@ -27,16 +27,6 @@ class Assignment(models.Model): ...@@ -27,16 +27,6 @@ class Assignment(models.Model):
@property @property
def passing_score(self): def passing_score(self):
return self.max_points * 0.60 return self.max_points * 0.60
@property
def assignment_info(self):
assignment = '<br>Assignment Name: {}'.format(self.name)
assignment += '<br>Description: {}'.format(self.description)
assignment += '<br>Perfect Score: {}'.format(self.max_points)
assignment += '<br>Passing Score: {}'.format(self.passing_score)
assignment += '<br>Course/Section: {}<br>'.format(self.course.course_info)
return assignment
def __str__(self): def __str__(self):
return '{} - {}'.format(self.name, self.course.course_shorthand) return '{} - {}'.format(self.name, self.course.course_shorthand)
\ No newline at end of file
{% extends 'base.html' %}
{% load static %}
{% block styles %}
<link rel="stylesheet" href="{% static 'css/assignments_stylesheet.css' %}">
{% endblock %}
{% block app_header %}Assignments Per Course{% endblock %}
{% block content %}
<ul>
{% for c in course_list %}
<li><p class="course_section">{{ c.course_code }} {{ c.course_title }} {{ c.section }}</p>
<ul class="course_assignments">
{% for a in assignment_list %}
{% if a.course.course_code == c.course_code %}
{% if a.course.section == c.section %}
<li><a href="{% url 'assignments:assignment-detail' pk=a.pk %}">{{ a.name }}</a></li>
{% endif %}
{% endif %}
{% endfor %}
</ul>
</li>
{% endfor %}
</ul>
{% endblock %}
\ No newline at end of file
{% extends 'base.html' %}
{% load static %}
{% block styles %}
<link rel="stylesheet" href="{% static 'css/assignments_stylesheet.css' %}">
{% endblock %}
{% block content %}
<p class="course">{{ object.course.course_code }} {{ object.course.course_title }} {{ object.course.section }}</p>
<p class="title">{{ object.name }}</p>
<p class="desc">{{ object.description }}</p>
<p class="score">Perfect Score: {{ object.max_points }}</p>
<p class="score">Passing Score: {{ object.passing_score }}</p>
{% endblock %}
\ No newline at end of file
from django.urls import path from django.urls import path
from .views import index from .views import AssignmentsPageView, AssignmentDetailView
urlpatterns = [ urlpatterns = [
path('', index, name="index"), path('', AssignmentsPageView.as_view(), name='index'),
path('<int:pk>/details', AssignmentDetailView.as_view(), name='assignment-detail'),
] ]
app_name = "assignments" app_name = "assignments"
\ No newline at end of file
from django.shortcuts import render from django.shortcuts import render
from django.http import HttpResponse from django.views import View
from django.views.generic.detail import DetailView
from .models import Assignment from .models import Assignment, Course
# Create your views here. # Create your views here.
def index(request): class AssignmentsPageView(View):
def assignment_list(): def get(self, request):
final_list = '' return render(request, 'assignments/assignment.html', {
for a in range(len(Assignment.objects.all())): 'course_list': Course.objects.all(),
final_list += '{}'.format(Assignment.objects.get(pk=a+1).assignment_info) 'assignment_list': Assignment.objects.all()
})
return final_list
html = f''' class AssignmentDetailView(DetailView):
<html> model = Assignment
<body> \ No newline at end of file
<header><h1>ASSIGNMENTS:</h1><header>
<main>
<p>{assignment_list()}</p>
</main>
</body>
</html>
'''
return HttpResponse(html)
\ No newline at end of file
No preview for this file type
...@@ -62,7 +62,7 @@ ROOT_URLCONF = 'widget_group_23.urls' ...@@ -62,7 +62,7 @@ ROOT_URLCONF = 'widget_group_23.urls'
TEMPLATES = [ TEMPLATES = [
{ {
'BACKEND': 'django.template.backends.django.DjangoTemplates', 'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [os.path.join(BASE_DIR, 'templates')], 'DIRS': [os.path.join(BASE_DIR, 'widget_group_23/templates')],
'APP_DIRS': True, 'APP_DIRS': True,
'OPTIONS': { 'OPTIONS': {
'context_processors': [ 'context_processors': [
...@@ -124,6 +124,7 @@ USE_TZ = True ...@@ -124,6 +124,7 @@ USE_TZ = True
# https://docs.djangoproject.com/en/4.0/howto/static-files/ # https://docs.djangoproject.com/en/4.0/howto/static-files/
STATIC_URL = 'static/' STATIC_URL = 'static/'
STATICFILES_DIRS = [os.path.join(BASE_DIR, 'widget_group_23/static')]
# Default primary key field type # Default primary key field type
# https://docs.djangoproject.com/en/4.0/ref/settings/#default-auto-field # https://docs.djangoproject.com/en/4.0/ref/settings/#default-auto-field
......
body {
font-family: Tahoma, sans-serif;
}
header {
font-size: 25px;
font-weight: bold;
}
.course_section {
font-weight: bold;
}
.course, .title {
font-weight: bold;
}
\ No newline at end of file
<html lang="en">
<head>
<meta charset = "UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Widget_23</title>
{% block styles %}{% endblock %}
</head>
<body>
<header>
{% block app_header %}{% endblock %}
</header>
{% block content %}{% endblock %}
{% block scripts %}{% endblock %}
</body>
</html>
\ No newline at end of file
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