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

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()
current_answer = data_session.query(Answer).filter(Answer.quest == current_task.id).first()
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:
deadline = datetime.datetime.combine(form.deadline_date.data, form.deadline_time.data)
else:
deadline = None
deadline = current_task.deadline
current_task.deadline = deadline
if current_answer:
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()
if current_project:
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(
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(

View File

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

View File

@ -1,58 +1,61 @@
<!DOCTYPE html>
<html lang="ru">
<head>
<meta charset="UTF-8" />
<link rel="stylesheet" href="../../../static/css/base.css" />
<head>
<meta charset="UTF-8"/>
<link rel="stylesheet" href="../../../static/css/base.css"/>
<link
rel="stylesheet"
href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css"
integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh"
crossorigin="anonymous"
rel="stylesheet"
href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css"
integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh"
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>
</head>
<body>
<script
src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.1/dist/js/bootstrap.bundle.min.js"
integrity="sha384-u1OknCvxWvY5kfmNBILK2hRnQC3Pr17a+RTT6rIHI7NnikvbZlHgTPOOmMi466C8"
crossorigin="anonymous"
></script>
{% if current_user.is_authenticated %}
<nav class="navbar">
<div class="nav_panel">
</head>
<body>
<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"
integrity="sha384-u1OknCvxWvY5kfmNBILK2hRnQC3Pr17a+RTT6rIHI7NnikvbZlHgTPOOmMi466C8"
crossorigin="anonymous"
></script>
{% if current_user.is_authenticated %}
<nav class="navbar">
<div class="nav_panel">
<a class="nav_chapter" href="/profile">
<div class="nav_user">
<div class="nav_user_name_div"><p class="nav_user_name nav_chapter_text">{{current_user.name}}</p></div>
</div>
<div class="nav_user">
<div class="nav_user_name_div"><p class="nav_user_name nav_chapter_text">{{current_user.name}}</p></div>
</div>
</a>
<a class="nav_chapter" href="/projects">
<p class="nav_chapter_text">Проекты</p>
<p class="nav_chapter_text">Проекты</p>
</a>
<a class="nav_chapter" href="/showcase">
<p class="nav_chapter_text">Витрина</p>
<p class="nav_chapter_text">Витрина</p>
</a>
</div>
</nav>
{% else %}
<nav class="navbar" id="navbar">
<div class="container-fluid">
</div>
</nav>
{% else %}
<nav class="navbar" id="navbar">
<div class="container-fluid">
<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 class="auth_button" href="/login">Авторизация</a>
</div>
</nav>
{% endif %}
<!-- Begin page content -->
<main role="main">{% block content %}{% endblock %}</main>
<footer class="footer">
<div class="footer_block">
</div>
</nav>
{% endif %}
<!-- Begin page content -->
<main role="main">{% block content %}{% endblock %}</main>
<footer class="footer">
<div class="footer_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>
<strong class="footer_rights">© All rights reserved</strong>
</div>
</footer>
</body>
</div>
</footer>
</body>
</html>

View File

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

View File

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