-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #37 from Elthan/feature-33
Feature #33
- Loading branch information
Showing
9 changed files
with
52 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 5 additions & 17 deletions
22
trix/trix_student/templates/trix_student/assignments.django.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,11 @@ | ||
{% extends "trix_student/base.django.html" %} | ||
{% extends "trix_student/assignment_list_base.django.html" %} | ||
{% load i18n %} | ||
{% block title %}{% trans "Assignments" %}{% endblock title %} | ||
|
||
{% block body %} | ||
<div class="container"> | ||
<div class="page-header"> | ||
{% block pageheader %} | ||
<div id="assignments-heading" class="page-header"> | ||
<div class="container"> | ||
<h1>{% trans "Assignments" %}</h1> | ||
</div> | ||
</div> | ||
|
||
<div class="container"> | ||
<div class="assignment-list"> | ||
{% for assignment in object_list %} | ||
<h1>{{ assignment.title }}</h1> | ||
<p class="assignment-text"> {{ assignment.text }}</p> | ||
<p class="assignment-solution"> {{ assignment.solution }}</p> | ||
{% empty %} | ||
<h2>No assigments for the chosen tags</h2> | ||
{% endfor %} | ||
</div> | ||
</div> | ||
{% endblock body %} | ||
{% endblock pageheader %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,29 @@ | ||
from django.views.generic import ListView | ||
|
||
from trix.trix_core import models | ||
from trix.trix_student.views.common import AssignmentListViewBase | ||
|
||
|
||
class AssignmentListView(ListView): | ||
class AssignmentListView(AssignmentListViewBase): | ||
model = models.Assignment | ||
template_name = "trix_student/assignments.django.html" | ||
paginate_by = 20 | ||
|
||
def _get_user_is_admin(self): | ||
if self.request.user.is_authenticated(): | ||
if self.request.user.is_admin: | ||
return True | ||
else: | ||
return False | ||
else: | ||
return False | ||
|
||
def get_all_available_assignments(self): | ||
assignment_ids = filter(None, self.kwargs['assignment_ids'].split('&')) | ||
return models.Assignment.objects.filter(id__in=assignment_ids) | ||
|
||
def get_already_selected_tags(self): | ||
return [] | ||
|
||
def get_nonremoveable_tags(self): | ||
return [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters