Commit 118ce515 authored by Bryan Carlo Guanlao's avatar Bryan Carlo Guanlao
parents 4c8d3031 f6fd0c33
...@@ -3,4 +3,5 @@ ...@@ -3,4 +3,5 @@
*.pyc *.pyc
__pycache__ __pycache__
db.sqlite3 db.sqlite3
media media
\ No newline at end of file .env
\ No newline at end of file
SECRET_KEY = 'django-insecure-$y$z*4bad7nc46_+$udo32cis1&=e&%7#*_$47+ym=d#u3t46m'
\ No newline at end of file
<ul>
<ul>
<li>
{{object.course.course_code}} {{object.course.course_title}} {{object.course.section}}
</li>
</ul>
<li>{{object.name}}</li>
<li>{{object.description}}</li>
<li>{{object.max_points}}</li>
<li>{{object.passing_score}}</li>
{% load static %}
<li><img src="{% static 'assignments/chesterC.png' %}" alt="image"></li>
</ul>
<h1>ASSIGNMENTS: </h1>
{% for assignment in assignments %}
<p>Assignment Name: {{assignment.name}}</p>
<p>Description: {{assignment.description}}</p>
<p>Perfect Score: {{assignment.max_points}}</p>
<p>Passing Score: {{assignment.passing_score}}</p>
<p>Course/Section: {{assignment.course.course_code}} {{assignment.course.course_title}} {{assignment.course.section}}</p><br>
{% endfor %}
\ No newline at end of file
{% extends 'base.html' %}
{% block content %}
<h1>Assignmets Per Course </h1>
<label>List of Courses:</label>
<ul>
{% for course in object_list %}
<li>{{course.course_code}} {{course.course_title}} {{course.section}}</li>
<ul>
{% for assignment in course.assignment.all %}
<li>
<a href="{% url 'assignment-detail' assignment.id %}">{{assignment}}</a>
</li>
{% endfor %}
</ul>
{% endfor %}
</ul>
{% endblock content %}
\ No newline at end of file
from django.urls import path from django.urls import path
from .views import assignments from .views import assignments, AssignmentDetailView, AssignmentListView
urlpatterns = [ urlpatterns = [
path('', assignments, name='assignments') path('', AssignmentListView.as_view(), name='assignments'),
path('<int:pk>/details/', AssignmentDetailView.as_view(), name='assignment-detail'),
] ]
\ No newline at end of file
from django.shortcuts import render from django.shortcuts import render
from .models import Assignment from .models import Assignment, Course
from django.views.generic.detail import DetailView
from django.views.generic.list import ListView
def assignments(request): def assignments(request):
assignments_context = Assignment.objects.all() assignments_context = Assignment.objects.all()
context = {'assignments':assignments_context courses = Course.objects.order_by('course_code')
context = {
'assignments':assignments_context,
'courses':courses,
} }
return render(request, 'assignments/assignments.html', context) return render(request, 'assignments/assignments.html', context)
class AssignmentListView(ListView):
model = Course
class AssignmentDetailView(DetailView):
model = Assignment
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<title>Francoconuts Widget</title>
</head>
<body>
<h1>WIDGET</h1>
<hr></hr>
{% block content %}
{% endblock content %}
</body>
</html>
\ No newline at end of file
...@@ -125,7 +125,11 @@ USE_TZ = True ...@@ -125,7 +125,11 @@ USE_TZ = True
# Static files (CSS, JavaScript, Images) # Static files (CSS, JavaScript, Images)
# 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, '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
......
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