Skip to content

Commit

Permalink
added delete button for assignments on assignment details page
Browse files Browse the repository at this point in the history
  • Loading branch information
dabslee committed Jul 2, 2021
1 parent 1fb5d1b commit 91bf28d
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 19 deletions.
25 changes: 13 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,13 @@
A free, open-source learning management system (LMS) build on Django and deployed on Heroku.

## Dev Notes
* 6/19/2021 (v.0.1.1): Patch refining existing features:
* 7/2/2021 (v0.1.2): Minor UI additions patch:
* Now use an iframe to display GitHub readme on home pages
* Added "report an issue" button to page footer
* Added social media sharing buttons to page footer
* Now display cumulative grade on student assignments overview
* Added delete button for assignments on assignment details page
* 6/19/2021 (v0.1.1): Patch refining existing features:
* Used CloudFlare proxy for HTTPS protocol to get website working on secure browsers (still unsafe due to half of protocol being unsecure)
* Clicking on students on the Students page for teachers now shows a tabular summary of the student assignments.
* Assignment page for students and teachers has been switched from a simple list of assignment names to a tabular summary of grades and submissions.
Expand All @@ -13,22 +19,17 @@ A free, open-source learning management system (LMS) build on Django and deploye
* Creating assignments as a teacher and grading student submissions.
* Submitting text submissions to assignments as a student and viewing the grades once available.

## Priority Backlog (Next Patch)
- [X] Use an iframe to display readme on home pages
- [X] Add "report an issue" button
- [X] Add social media sharing buttons
- [X] Display cumulative grade on student assignments overview
- [ ] Email notifications for assignment updates
- [ ] Delete option for assignments
## Priority Backlog (Next Patch - v0.1.3)
- [X] "Unsaved changes" confirmation dialogue before leaving form pages
- [X] Show assignment details on new submission form
- [X] File attachment uploading for assignments and submissions

## Backlog
* "Unsaved changes" confirmation dialogue before leaving form pages
* Show assignment details on new submission form
* File uploads for assignments and submissions
* Email notifications for assignment updates
* Status tags instead of unread/read formatting for assignments
* Feature voting
* Non-assignment pages
* Actual SSL certification
* Full SSL certification
* Switch session course tracking method from cookies to request kwargs
* Render readme iframe as formatted HTML
* A breadcrumbs navigation bar
Expand Down
Binary file modified db.sqlite3
Binary file not shown.
Binary file modified forum/__pycache__/urls.cpython-39.pyc
Binary file not shown.
Binary file modified forum/__pycache__/views.cpython-39.pyc
Binary file not shown.
24 changes: 18 additions & 6 deletions forum/templates/assignmentdetails_teacher.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,24 @@
{% block content %}
<form action="{% url 'forum:assignmentdetails' assignment.id %}" method="POST">
{% csrf_token %}
<h2>Assignment: <input name="title" type="text" value="{{assignment.title}}"></input></h2>
<p><i>
<b>Start date: </b><input name="start" type="datetime-local" value="{{assignment.start_datetime|date:'Y-m-d\TH:i'}}"></input><br>
<b>End date: </b><input name="end" type="datetime-local" value="{{assignment.end_datetime|date:'Y-m-d\TH:i'}}"></input><br>
<b>Total points: </b><input name="points" type="number" value="{{assignment.total_points}}"></input><br>
</i></p>
<div style="display: flex; flex-direction: row; justify-content: space-between;">
<div>
<h2>Assignment: <input name="title" type="text" value="{{assignment.title}}"></input></h2>
<p><i>
<b>Start date: </b><input name="start" type="datetime-local" value="{{assignment.start_datetime|date:'Y-m-d\TH:i'}}"></input><br>
<b>End date: </b><input name="end" type="datetime-local" value="{{assignment.end_datetime|date:'Y-m-d\TH:i'}}"></input><br>
<b>Total points: </b><input name="points" type="number" value="{{assignment.total_points}}"></input><br>
</i></p>
</div>
<div class="button" onclick="delete_assn()" style="height: fit-content; background-color: #df3838;">Delete assignment</div>
<script>
function delete_assn() {
if (confirm("Are you sure you want to delete this assignment?")) {
location.href = "{% url 'forum:delete_assignment' assignment.id %}";
}
}
</script>
</div>
<p><b><i>Description:</i></b></p>
<textarea name="description">{{assignment.description}}</textarea>
<br>
Expand Down
1 change: 1 addition & 0 deletions forum/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@
path('assignments/newassignment', views.newassignment, name='newassignment'),
path('assignments/<assignment_id>', views.assignmentdetails, name='assignmentdetails'),
path('assignments/<assignment_id>/submit', views.newsubmission, name='newsubmission'),
path('assignments/<assignment_id>/delete', views.delete_assignment, name='delete_assignment'),
path('assignments/submissions/assignment_id=<assignment_id>/student_id=<student_id>', views.viewsubmission, name='viewsubmission'),
]
11 changes: 10 additions & 1 deletion forum/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,4 +263,13 @@ def studentgrades(request, student_id):
context["student"] = student
return render(request, "studentgrades.html", context)
else:
return redirect('home')
return redirect('home')

def delete_assignment(request, assignment_id):
if not request.user.is_authenticated:
return redirect('home')
course = Course.objects.filter(id=request.session.get('selected_course_id')).first()
if (course.owner != request.user):
return redirect('home')
Assignment.objects.filter(id=assignment_id).delete()
return redirect('forum:assignments')

0 comments on commit 91bf28d

Please sign in to comment.