Commit 13f71a47 authored by Eugene Ezekiel P. Tan's avatar Eugene Ezekiel P. Tan

Merge branch 'master' of...

Merge branch 'master' of https://gitlab.discs.ateneo.edu/rajochristiancadorna/widget_placeholdername
parents 23d64715 70870119
<!DOCTYPE html>
<html lang="en">
<body>
<h1>Assignments:</h1>
{% for assignment in assignments %}
Assignment Name: {{assignment.name}} <br>
Description: {{assignment.description}} <br>
Perfect Score: {{assignment.max_points}} <br>
Passing Score: {{assignment.passing_score}} <br>
Course/Section: {{assignment.course.course_code}} | {{assignment.course.course_title}} | {{assignment.course.section}}
<br><br>
{% endfor %}
</body>
</html>
{% extends "assignments/base.html" %}
{% block content %}
<h3>{{assignment.course.course_code}} | {{assignment.course.course_title}} | {{assignment.course.section}}</h3>
<hr>
<img src= {{assignment.assignment_imageUrl}}>
<h2>{{assignment.name}}</h2>
Description: {{assignment.description}} <br>
Perfect Score: {{assignment.max_points}} <br>
Passing Score: {{assignment.passing_score}} <br>
{% endblock %}
{% extends "assignments/base.html" %}
{% block content %}
<h1>New Assignment</h1>
<hr>
<form action="./" method="post">
{% csrf_token %}
<label for="name">Name:</label><br>
<input type="text" name="name" id="name" style="width:400px"><br>
<label for="description">Description:</label><br>
<textarea name="description" id="description" style="width:400px; height:200px;"></textarea><br>
<label for="max_points">Max Points:</label><br>
<input type="number" name="max_points" id="max_points"><br>
<label for="course">Course:</label><br>
<select name="course" id="course">
{% for course in course_list %}
<option value="{{course}}">{{course.course_title}}</option>
{% endfor %}
</select><br>
<label for="Image">Image:</label><br>
<input type="text" name="assignment_imageUrl" id="assignment_imageUrl"><br><br>
<input type="submit" value="Submit">
</form>
<h5><a href ="{% url 'assignments/index'%}">Back to Assignments</h5>
{% endblock %}
{% extends "assignments/base.html" %}
{% block content %}
<h3>{{object.course.course_code}} | {{object.course.course_title}} | {{object.course.section}}</h3>
<hr>
<img src= {{object.assignment_imageUrl}}>
<h2>{{object.name}}</h2>
Description: {{object.description}} <br>
Perfect Score: {{object.max_points}} <br>
Passing Score: {{object.passing_score}} <br>
{% endblock %}
......@@ -7,7 +7,7 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" type="text/css" href="{% static 'assignments/style.css' %}">
<title></title>
<title>{% block title %}Assignments{% endblock %}</title>
</head>
<body>
{% block content %}
......
......@@ -9,7 +9,7 @@
<ul>
{% for assignment in assignments %}
{% if assignment.course.course_code == course.course_code %}
<li><a href ="{% url 'assignment' assignment.id%}">{{assignment.name}}</a></li>
<li><a href ="{% url 'assignment-detail' assignment.id%}">{{assignment.name}}</a></li>
{% endif %}
{% endfor %}
</ul>
......@@ -19,5 +19,6 @@
{% else %}
<p>No courses currently enrolled.</p>
{% endif %}
{%comment%}<h5><a href ="{% url 'assignment-add'%}">Create New Assignment</h5>{%endcomment%}
{% endblock %}
from django.urls import path
from . import views
from .views import HomePageView, AssignmentDetailView
urlpatterns = [
path('', views.index, name='index'),
path("<int:assignment_id>/details/", views.assignments, name='assignment')
path('', HomePageView.as_view(), name='assignments/index'),
path('assignment/<int:pk>/details/', AssignmentDetailView.as_view(), name='assignment-detail')
]
from django.http import HttpResponse
from . models import Assignment, Course
from django.shortcuts import render
from django.views import View
from django.views.generic.detail import DetailView
# Create your views here.
def index(request):
Assignments = Assignment.objects.all()
Courses = Course.objects.all()
course_list = Course.objects.order_by("course_code")
context ={
'assignments':Assignments,
'courses':Courses,
'course_list':course_list
}
return render(request, "assignments/view.html", context)
class HomePageView(View):
def get(self, request):
assignments = Assignment.objects.all()
course_list = Course.objects.order_by("course_code")
context ={
'assignments':assignments,
'course_list':course_list
}
return render(request, "assignments/index.html", context)
def assignments(request, assignment_id):
course_list = Course.objects.order_by("course_code")
try:
assignment = Assignment.objects.get(pk=assignment_id)
except Assignment.DoesNotExist:
raise Http404("Assignment does not exist")
return render(request, "assignments/assignment.html",{"assignment": assignment, 'course_list':course_list})
class AssignmentDetailView(DetailView):
model = Assignment
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