Открыть боковую панель
peteroshkvarkov
Project-38
Коммиты
bb2565d6
Коммит
bb2565d6
создал
Сен 02, 2023
по автору
AdLeGeR
Просмотр файлов
тип проекта -> уровень проекта, добавил другие типы проекта
владелец
3639501d
Изменения
6
Развернуть все
Скрыть пробелы
Построчно
Рядом
portal/projects/migrations/0003_project__level.py
0 → 100644
Просмотр файла @
bb2565d6
# Generated by Django 4.2.3 on 2023-09-02 18:29
from
django.db
import
migrations
,
models
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
"projects"
,
"0002_file_name_project__type"
),
]
operations
=
[
migrations
.
AddField
(
model_name
=
"project"
,
name
=
"_level"
,
field
=
models
.
CharField
(
max_length
=
10
,
null
=
True
),
),
]
portal/projects/models.py
Просмотр файла @
bb2565d6
...
...
@@ -16,7 +16,9 @@ class Project(Model):
_statuses
=
[
"send request"
,
"on work"
,
"send to verification"
,
"done"
]
_status
=
CharField
(
max_length
=
30
)
_subjects
=
CharField
(
max_length
=
100
,
null
=
True
)
_types
=
[
'Проект'
,
'НОУ'
]
_levels
=
[
'Проект'
,
'НОУ'
]
_level
=
CharField
(
max_length
=
10
,
null
=
True
)
_types
=
[
'Исследовательский'
,
'Информационный'
,
'Прикладной'
,
'Ролевой(игровой)'
,
'Социальный'
,
'Технологическийт (инженерный)'
,
'Бизнес-план'
]
_type
=
CharField
(
max_length
=
10
,
null
=
True
)
problem
=
CharField
(
max_length
=
1000
,
null
=
True
)
relevance
=
CharField
(
max_length
=
1000
,
null
=
True
)
...
...
@@ -47,12 +49,21 @@ class Project(Model):
return
self
.
_status
def
set_type
(
self
,
project_type
):
print
(
project_type
,
project_type
in
self
.
_types
,
self
.
_types
)
if
project_type
in
self
.
_types
:
self
.
_type
=
project_type
self
.
save
()
def
get_type
(
self
):
return
self
.
_type
def
set_level
(
self
,
project_level
):
if
project_level
in
self
.
_levels
:
self
.
_level
=
project_level
self
.
save
()
def
get_level
(
self
):
return
self
.
_level
# эта константа показывает сколько версий может быть у одного файла
...
...
portal/projects/views.py
Просмотр файла @
bb2565d6
...
...
@@ -66,6 +66,7 @@ def index(request: HttpRequest):
"status"
:
project
.
get_status
(),
"subjects"
:
project
.
get_subjects
(),
"description"
:
project
.
description
,
"project_level"
:
project
.
get_level
(),
"project_type"
:
project
.
get_type
(),
'problem'
:
project
.
problem
,
"relevance"
:
project
.
relevance
,
...
...
@@ -190,19 +191,20 @@ def correct_project(request: HttpRequest):
return
render
(
request
,
"NotEnoughPermissions.html"
)
name
=
request
.
POST
.
get
(
"name"
,
-
1
)
description
=
request
.
POST
.
get
(
"description"
,
-
1
)
project_
type
=
request
.
POST
.
get
(
'project-
type
'
,
-
1
)
project_
level
=
request
.
POST
.
get
(
'project-
level
'
,
-
1
)
problem
=
request
.
POST
.
get
(
'problem'
,
-
1
)
relevance
=
request
.
POST
.
get
(
'relevance'
,
-
1
)
target
=
request
.
POST
.
get
(
'target'
,
-
1
)
tasks
=
request
.
POST
.
get
(
'tasks'
,
-
1
)
expected_results
=
request
.
POST
.
get
(
'expected-results'
,
-
1
)
project_type
=
request
.
POST
.
get
(
'project-type'
,
-
1
)
print
(
project_type
)
if
name
!=
-
1
:
project
.
name
=
name
if
description
!=
-
1
:
project
.
description
=
description
if
project_
type
!=
-
1
:
project
.
set_
type
(
project_
type
)
if
project_
level
!=
-
1
:
project
.
set_
level
(
project_
level
)
if
problem
!=
-
1
:
project
.
problem
=
problem
if
relevance
!=
-
1
:
...
...
portal/static/css/projects/project_page_work.css
Просмотр файла @
bb2565d6
...
...
@@ -120,13 +120,13 @@
align-items
:
center
;
}
.
type
-line
{
.
level
-line
{
width
:
60%
;
height
:
1px
;
background
:
rgba
(
0
,
0
,
0
,
0.3
);
}
.
type
-label
{
.
level
-label
{
padding-top
:
55px
;
display
:
flex
;
flex-direction
:
column
;
...
...
@@ -137,11 +137,21 @@
cursor
:
pointer
;
}
.
type
-label
:last-child
{
.
level
-label
:last-child
{
background-image
:
url("../../img/project/noy.svg")
;
background-size
:
45px
45px
;
}
.type-label
{
display
:
flex
;
flex-direction
:
column
;
align-items
:
center
;
min-width
:
50px
;
cursor
:
pointer
;
display
:
flex
;
flex-direction
:
row
;
}
.form-input
{
margin-bottom
:
15px
;
display
:
block
;
...
...
portal/static/js/projects/project_page_on_work.js
Просмотр файла @
bb2565d6
...
...
@@ -61,21 +61,33 @@ function checking(name, is_click) {
}
}
}
else
if
(
name
==
'
cb5
'
)
{
if
(
$
(
'
.file-name
'
)[
0
].
innerText
!=
''
)
{
if
(
is_click
)
{
let
content_status
=
$
(
'
.content-status
'
)[
4
];
$
(
content_status
).
html
(
ok
);
$
(
'
.next-btn
'
).
css
({
'
pointer-events
'
:
'
auto
'
});
}
else
{
let
content_status
=
$
(
'
.content-status
'
)[
4
];
$
(
content_status
).
html
(
not_ok
);
if
(
!
is_opened
)
{
$
(
'
.next-btn
'
).
css
({
'
pointer-events
'
:
'
none
'
});
}
}
if
(
$
(
'
.file-name
'
)[
1
].
innerText
!=
''
)
{
}
else
if
(
name
==
'
cb6
'
)
{
if
(
$
(
'
.file-name
'
)[
0
].
innerText
!=
''
)
{
let
content_status
=
$
(
'
.content-status
'
)[
5
];
$
(
content_status
).
html
(
ok
);
}
else
{
let
content_status
=
$
(
'
.content-status
'
)[
5
];
$
(
content_status
).
html
(
not_ok
);
}
if
(
$
(
'
.file-name
'
)[
1
].
innerText
!=
''
)
{
let
content_status
=
$
(
'
.content-status
'
)[
6
];
$
(
content_status
).
html
(
ok
);
}
else
{
let
content_status
=
$
(
'
.content-status
'
)[
6
];
$
(
content_status
).
html
(
not_ok
);
}
}
}
...
...
@@ -108,7 +120,7 @@ if (is_opened) {
checking
(
'
cb
'
+
num_of_cb
);
if
(
num_of_cb
!=
5
)
{
if
(
num_of_cb
!=
6
)
{
if
(
$
(
$
(
new_cb
)[
0
].
childNodes
[
3
].
childNodes
[
1
]).
attr
(
'
class
'
)
==
'
not_ok
'
)
{
if
(
!
is_opened
)
{
$
(
'
.next-btn
'
).
css
({
'
pointer-events
'
:
'
none
'
});
...
...
@@ -119,7 +131,7 @@ if (is_opened) {
if
(
num_of_cb
==
4
)
{
$
(
'
.skip-btn
'
).
css
({
'
display
'
:
'
block
'
});
}
else
if
(
num_of_cb
==
5
)
{
else
if
(
num_of_cb
==
6
)
{
$
(
'
.next-btn
'
).
css
({
'
background-url
'
:
'
none
'
,
'
text-align
'
:
'
center
'
...
...
@@ -137,7 +149,7 @@ if (is_opened) {
$
(
new_cb
).
addClass
(
'
content-block-open
'
);
num_of_cb
++
;
if
(
num_of_cb
!=
5
)
{
if
(
num_of_cb
!=
6
)
{
if
(
$
(
$
(
new_cb
)[
0
].
childNodes
[
3
].
childNodes
[
1
]).
attr
(
'
class
'
)
==
'
not_ok
'
)
{
if
(
!
is_opened
)
{
$
(
'
.next-btn
'
).
css
({
'
pointer-events
'
:
'
none
'
});
...
...
@@ -146,7 +158,7 @@ if (is_opened) {
}
if
(
num_of_cb
==
5
)
{
if
(
num_of_cb
==
6
)
{
$
(
'
.next-btn
'
).
css
({
'
background-url
'
:
'
none
'
,
'
text-align
'
:
'
center
'
...
...
@@ -159,17 +171,26 @@ if (is_opened) {
}
}
// выбор типа проекта
//установление типа проекта
$
(
'
.project-type
'
).
each
(
function
(
i
,
item
)
{
if
(
item
.
value
==
project_type
){
item
.
checked
=
true
;
item
.
onchange
();
}
});
// выбор уровня проекта
$
(
'
.project-
type
'
).
on
(
'
click
'
,
function
()
{
$
(
'
.project-
level
'
).
on
(
'
click
'
,
function
()
{
if
(
$
(
this
).
attr
(
'
id
'
)
==
'
noy
'
)
{
$
(
'
.input-cb
2
'
).
val
(
'
НОУ
'
);
$
(
'
.input-cb
5
'
).
val
(
'
НОУ
'
);
}
else
if
(
$
(
this
).
attr
(
'
id
'
)
==
'
project
'
)
{
$
(
'
.input-cb
2
'
).
val
(
'
Проект
'
);
$
(
'
.input-cb
5
'
).
val
(
'
Проект
'
);
}
});
let
projec_type
=
$
(
'
.input-cb
2
'
).
val
();
let
projec_type
=
$
(
'
.input-cb
5
'
).
val
();
if
(
projec_type
==
'
НОУ
'
)
{
$
(
'
#noy
'
).
click
();
...
...
portal/templates/projects/project_page.html
Просмотр файла @
bb2565d6
Это отличие свёрнуто
Нажмите, чтобы развернуть
Редактирование
Предварительный просмотр
Поддерживает Markdown
0%
Попробовать снова
или
прикрепить новый файл
.
Отмена
You are about to add
0
people
to the discussion. Proceed with caution.
Сначала завершите редактирование этого сообщения!
Отмена
Пожалуйста,
зарегистрируйтесь
или
войдите
чтобы прокомментировать