ci update
This commit is contained in:
parent
aed905414e
commit
bd9ffa20bc
@ -1,3 +1,4 @@
|
||||
from django.contrib.postgres.fields import ArrayField
|
||||
from django.db import models
|
||||
from django.contrib.auth.models import User
|
||||
|
||||
@ -14,6 +15,7 @@ class Task(models.Model):
|
||||
time_limit = models.IntegerField(default=10000)
|
||||
time_estimation = models.IntegerField(default=5)
|
||||
creator = models.ForeignKey(User, on_delete=models.SET_NULL, null=True)
|
||||
editors = ArrayField(models.TextField(), default=list)
|
||||
|
||||
def __str__(self):
|
||||
return self.name
|
||||
|
@ -7,6 +7,9 @@ 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)
|
||||
|
18
Main/views/UsersView.py
Normal file
18
Main/views/UsersView.py
Normal file
@ -0,0 +1,18 @@
|
||||
from django.contrib.auth.models import User
|
||||
|
||||
from SprintLib.BaseView import BaseView
|
||||
|
||||
|
||||
class UsersView(BaseView):
|
||||
endpoint = "users"
|
||||
|
||||
def get(self):
|
||||
startswith = self.request.GET.get("startswith", "")
|
||||
return {
|
||||
"users": [
|
||||
user.username
|
||||
for user in User.objects.filter(
|
||||
username__startswith=startswith
|
||||
).order_by("username")
|
||||
]
|
||||
}
|
@ -13,3 +13,4 @@ from Main.views.SolutionView import SolutionView
|
||||
from Main.views.ImageView import ImageView
|
||||
from Main.views.SendCodeView import SendCodeView
|
||||
from Main.views.SetSettingsView import SetSettingsView
|
||||
from Main.views.UsersView import UsersView
|
@ -94,6 +94,11 @@
|
||||
<button type="submit" class="btn btn-light" style="margin-top: 15px;"><i class="fa fa-save"></i> Сохранить</button>
|
||||
</form>
|
||||
<hr><hr>
|
||||
<h3>Редакторы</h3>
|
||||
{% for editor in task.editors %}
|
||||
<i class="fa fa-user"></i> <a href="/account?username={{ editor }}">{{ editor }}</a><br>
|
||||
{% endfor %}
|
||||
<hr><hr>
|
||||
<h3 style="margin-bottom: 40px;">Загрузка тестов и файлов</h3>
|
||||
<p style="color: red">{{ error_message }}</p>
|
||||
<table style="width: 80%;">
|
||||
|
@ -43,7 +43,7 @@
|
||||
{% endif %}
|
||||
</tr>
|
||||
</table>
|
||||
{% for task in user.userinfo.available_tasks %}
|
||||
{% for task in tasks %}
|
||||
<a href="/task?task_id={{ task.id }}">{{ task.name }}</a> {% if task.creator == user %}<a href="/admin/task?task_id={{ task.id }}"><i class="fa fa-pencil"></i> </a>{% endif %}<br>
|
||||
{% endfor %}
|
||||
{% endblock %}
|
Loading…
Reference in New Issue
Block a user