new
This commit is contained in:
@@ -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
|
||||
|
@@ -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)
|
||||
|
Reference in New Issue
Block a user