Убрал возможность участникам проекта редактировать информацию о нем

This commit is contained in:
Andrei 2023-02-27 23:54:42 +05:00
parent ab82863761
commit ed88142524
5 changed files with 52 additions and 44 deletions

View File

@ -97,11 +97,11 @@ def task_project(id_project, id_task):
form = AnswerTask() form = AnswerTask()
current_answer = data_session.query(Answer).filter(Answer.quest == current_task.id).first() current_answer = data_session.query(Answer).filter(Answer.quest == current_task.id).first()
list_files = None list_files = None
if form.validate_on_submit(): if form.submit.data and request.method == 'POST':
if form.deadline_date.data and form.deadline_time.data: if form.deadline_date.data and form.deadline_time.data:
deadline = datetime.datetime.combine(form.deadline_date.data, form.deadline_time.data) deadline = datetime.datetime.combine(form.deadline_date.data, form.deadline_time.data)
else: else:
deadline = None deadline = current_task.deadline
current_task.deadline = deadline current_task.deadline = deadline
if current_answer: if current_answer:
current_answer.text = form.text.data current_answer.text = form.text.data
@ -201,7 +201,7 @@ def edit_project(id_project):
current_project = data_session.query(Projects).filter(Projects.id == id_project).first() current_project = data_session.query(Projects).filter(Projects.id == id_project).first()
if current_project: if current_project:
staff = data_session.query(StaffProjects).filter(StaffProjects.project == current_project.id).all() staff = data_session.query(StaffProjects).filter(StaffProjects.project == current_project.id).all()
if current_user.id == current_project.creator or current_user.id in list(map(lambda x: x.user, staff)): if current_user.id == current_project.creator:
list_users = list( list_users = list(
map(lambda x: get_user_data(x), data_session.query(User).filter(User.id != current_user.id).all())) map(lambda x: get_user_data(x), data_session.query(User).filter(User.id != current_user.id).all()))
staff = list(map(lambda x: get_user_data(x), data_session.query(User).filter( staff = list(map(lambda x: get_user_data(x), data_session.query(User).filter(

View File

@ -6,6 +6,7 @@ body {
min-height: 100%; min-height: 100%;
} }
.navbar { .navbar {
margin-top: -1.1vw;
background-color: #dcb495; background-color: #dcb495;
display: inline-flex; display: inline-flex;
height: 8vw; height: 8vw;

View File

@ -1,25 +1,28 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="ru"> <html lang="ru">
<head> <head>
<meta charset="UTF-8" /> <meta charset="UTF-8"/>
<link rel="stylesheet" href="../../../static/css/base.css" /> <link rel="stylesheet" href="../../../static/css/base.css"/>
<link <link
rel="stylesheet" rel="stylesheet"
href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css"
integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh"
crossorigin="anonymous" crossorigin="anonymous"
/> />
<link rel="icon" href="../../../static/images/logo_b.ico" type="image/x-icon" /> <link rel="icon" href="../../../static/images/logo_b.ico" type="image/x-icon"/>
<title>{{title}}</title> <title>{{title}}</title>
</head> </head>
<body> <body>
<script <div class="alert alert-danger" role="alert">
<h4 style="text-align:center;">Это деманстрационная версия сайта, пока что мы не рекомендуем сохранять здесь важные данные</h4>
</div>
<script
src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.1/dist/js/bootstrap.bundle.min.js" src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.1/dist/js/bootstrap.bundle.min.js"
integrity="sha384-u1OknCvxWvY5kfmNBILK2hRnQC3Pr17a+RTT6rIHI7NnikvbZlHgTPOOmMi466C8" integrity="sha384-u1OknCvxWvY5kfmNBILK2hRnQC3Pr17a+RTT6rIHI7NnikvbZlHgTPOOmMi466C8"
crossorigin="anonymous" crossorigin="anonymous"
></script> ></script>
{% if current_user.is_authenticated %} {% if current_user.is_authenticated %}
<nav class="navbar"> <nav class="navbar">
<div class="nav_panel"> <div class="nav_panel">
<a class="nav_chapter" href="/profile"> <a class="nav_chapter" href="/profile">
<div class="nav_user"> <div class="nav_user">
@ -33,26 +36,26 @@
<p class="nav_chapter_text">Витрина</p> <p class="nav_chapter_text">Витрина</p>
</a> </a>
</div> </div>
</nav> </nav>
{% else %} {% else %}
<nav class="navbar" id="navbar"> <nav class="navbar" id="navbar">
<div class="container-fluid"> <div class="container-fluid">
<a class="navbar-brand" href="/"> <a class="navbar-brand" href="/">
<img src="../../../static/images/logo_b.png" class="nav_logo" /> <img src="../../../static/images/logo_b.png" class="nav_logo"/>
</a> </a>
<a class="auth_button" href="/login">Авторизация</a> <a class="auth_button" href="/login">Авторизация</a>
</div> </div>
</nav> </nav>
{% endif %} {% endif %}
<!-- Begin page content --> <!-- Begin page content -->
<main role="main">{% block content %}{% endblock %}</main> <main role="main">{% block content %}{% endblock %}</main>
<footer class="footer"> <footer class="footer">
<div class="footer_block"> <div class="footer_block">
<a href="/#header_block" <a href="/#header_block"
><img class="footer_logo" src="../../../static/images/logo_w.png" ><img class="footer_logo" src="../../../static/images/logo_w.png"
/></a> /></a>
<strong class="footer_rights">© All rights reserved</strong> <strong class="footer_rights">© All rights reserved</strong>
</div> </div>
</footer> </footer>
</body> </body>
</html> </html>

View File

@ -8,7 +8,7 @@
<a class="open_button" data-bs-toggle="collapse" href="#collapseExample" role="button" aria-expanded="false" <a class="open_button" data-bs-toggle="collapse" href="#collapseExample" role="button" aria-expanded="false"
aria-controls="collapseExample"> aria-controls="collapseExample">
<div class="open_button_text"> <div class="open_button_text">
Редикторовать Редактировать
</div> </div>
</a> </a>
<a class="profile_button" id="logout_button" href="/logout"> <a class="profile_button" id="logout_button" href="/logout">

View File

@ -8,9 +8,13 @@
</div> </div>
<div class="project_header"> <div class="project_header">
<div class="edit_block"> <div class="edit_block">
{% if current_user.id == project.creator %}
<a id="edit_button" class="edit_button" href=""> <a id="edit_button" class="edit_button" href="">
<img class="edit_button_image" src="../static/images/pen_b.png"> <img class="edit_button_image" src="../static/images/pen_b.png">
</a> </a>
{% else %}
<p class="edit_button"> </p>
{% endif %}
</div> </div>
<div class="brand_block"> <div class="brand_block">
<img class="project_logo" src="../{{project.photo}}"/> <img class="project_logo" src="../{{project.photo}}"/>