diff --git a/Main/templatetags/filters.py b/Main/templatetags/filters.py index 9bd6204..1e7e00b 100644 --- a/Main/templatetags/filters.py +++ b/Main/templatetags/filters.py @@ -1,4 +1,15 @@ from django import template +from Main.models import Solution register = template.Library() + + +@register.filter('solved') +def solved(user, task): + solutions = Solution.objects.filter(user=user, task=task) + if len(solutions.filter(result='OK')) != 0: + return True + if len(solutions) != 0: + return False + return None diff --git a/Main/views/TasksView.py b/Main/views/TasksView.py index 2c2bba2..e00e856 100644 --- a/Main/views/TasksView.py +++ b/Main/views/TasksView.py @@ -7,9 +7,6 @@ class TasksView(BaseView): required_login = True endpoint = "tasks" - def get(self): - self.context["tasks"] = Task.objects.filter(public=True).order_by('-time_estimation') - def post(self): task_name = self.request.POST["name"] task = Task.objects.create(name=task_name, creator=self.request.user) diff --git a/templates/set.html b/templates/set.html index cec06b9..38a277d 100644 --- a/templates/set.html +++ b/templates/set.html @@ -4,11 +4,14 @@ {% block main %}
{{ set.description }}