Commit 7d25b585 authored by Star Neptune R. Sy's avatar Star Neptune R. Sy

assignment-details.html is done

parent dfad8189
<head> <head>
<link rel="stylesheet" href="makeItBeautiful.css"> <link rel="stylesheet" href="templates/makeItBeautiful.css">
<title>{% block webTitle %}{% endblock %}</title> <title>{% block webTitle %}{% endblock %}</title>
</head> </head>
<body> <body>
{% block pageTitle %}{% endblock %} <div class="pageTitle"> <h1 class="pageTitle"> {% block pageTitle %}{% endblock %} </h1> </div>
{% block content %}{% endblock %} <div class="content">
{% block otherButtons %} {% endblock %} {% block content %}{% endblock %}
<div class="navButtons">
{% block otherButtons %} {% endblock %}
</div>
</div>
</body> </body>
\ No newline at end of file
{% extends 'base.html' %}
{% block webTitle %} {{object.assignment_name}} {% endblock %}
{% block pageTitle %} {{object.assignment_name}} {% endblock %}
{% block content %}
{% csrf_token %}
{{ form.as_p }}
<input type="submit" id="submitButton" value="Submit">
{% endblock %}
{% block otherButtons %}
{% endblock %}
\ No newline at end of file
from django.urls import path from django.urls import path
from .views import homeAssignmentsPage from .views import homeAssignmentsPage, AssignmentsDetailView
urlpatterns = [ urlpatterns = [
path('', homeAssignmentsPage, name='homePage'), path('', homeAssignmentsPage, name='homePage'),
path('<int:pk>/details/', AssignmentsDetailView.as_view(), name='assignment_details')
] ]
......
from django.shortcuts import render from django.shortcuts import render
from django.views.generic.detail import DetailView
from django.views.generic.list import ListView
from django.http import HttpResponse from django.http import HttpResponse
from .models import Assignment from .models import Assignment
def homeAssignmentsPage(request): def homeAssignmentsPage(request):
starter = "{% block content %}\ return render(request, 'templates/assignments.html', {"assignmentsList":Assignment.objects.all()})
<div class='content'>\
<ul style='list-style-type:square;'>\n"
middle = "" class AssignmentsDetailView(DetailView):
for assignment in Assignment.objects.all(): model = Assignment
middle = middle + "<li> <div class='assignmentLink'> \ template_name = "templates/assignment-details.html"
<a href='"+ str(assignment.get_absolute_url)+"'/details>" + str(assignment.assignment_name)+" </a> </div> </li>" pass
ender = "</ul>\
</div>\
{% endblock %}"
output = starter+middle+ender
return render(request, 'templates/assignments.html', {"addition":output})
def index(request): def index(request):
......
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