Открыть боковую панель
peteroshkvarkov
Project-38
Коммиты
42c23765
Не подтверждена
Коммит
42c23765
создал
Сен 01, 2023
по автору
AdLeGeR
Зафиксировано автором
GitHub
Сен 01, 2023
Просмотр файлов
Merge pull request #163 from RushanCources/for_merging_issue-158_to_main
Commit_1
владельцы
d1186699
34acce71
Изменения
4
Скрыть пробелы
Построчно
Рядом
portal/static/js/theme_list/theme_list.js
Просмотр файла @
42c23765
...
...
@@ -159,13 +159,13 @@ $('.edit').on('click', function () {
subs_arr
.
push
(
subs
)
}
let
sub
=
[
"
Математика
"
,
"
Алгебра
"
,
"
Геометрия
"
,
"
Теория вероятностей и статистика
"
,
"
Информатика
"
,
"
География
"
,
"
Биология
"
,
"
Физика
"
,
"
Химия
"
,
"
Основы безопасности жизнедеятельности
"
,
"
Естествознание
"
,
"
Экология
"
,
"
Астрономия
"
,
"
История
"
,
"
Обществознание
"
,
"
Экономика
"
,
"
Право
"
,
"
Разговоры о важном
"
,
"
Краеведение
"
,
"
Основы религиозных культур и светской этики
"
,
"
Родная литература
"
,
"
Русский язык
"
,
"
Литература
"
,
"
Иностранный язык(Английский)
"
,
"
Иностранный язык(Французский)
"
,
"
Иностранный язык(Немецкий)
"
,
"
Труд
"
,
"
Технология
"
,
"
Черчение
"
,
"
Индивидуальный проект
"
,
"
Физическая культура
"
,
"
Музыка
"
,
"
Изобразительное искусств
"
]
"
География
"
,
"
Биология
"
,
"
Физика
"
,
"
Химия
"
,
"
Основы безопасности жизнедеятельности
"
,
"
Естествознание
"
,
"
Экология
"
,
"
Астрономия
"
,
"
История
"
,
"
Обществознание
"
,
"
Экономика
"
,
"
Право
"
,
"
Разговоры о важном
"
,
"
Краеведение
"
,
"
Основы религиозных культур и светской этики
"
,
"
Родная литература
"
,
"
Русский язык
"
,
"
Литература
"
,
"
Иностранный язык(Английский)
"
,
"
Иностранный язык(Французский)
"
,
"
Иностранный язык(Немецкий)
"
,
"
Труд
"
,
"
Технология
"
,
"
Черчение
"
,
"
Индивидуальный проект
"
,
"
Физическая культура
"
,
"
Музыка
"
,
"
Изобразительное искусств
"
]
for
(
let
i
=
0
;
i
<
subs_arr
.
length
;
i
++
)
{
let
li
=
document
.
createElement
(
'
li
'
);
let
ul
=
$
(
'
.new-theme-subjects-list
'
);
...
...
@@ -199,4 +199,8 @@ $('.edit').on('click', function () {
function
set_color
(
color
)
{
console
.
log
(
color
)
}
\ Нет новой строки в конце файла
}
$
(
"
ul li.list-li
"
).
click
(
function
()
{
$
(
"
#subject-filter
"
).
val
(
$
(
this
).
text
());
});
\ Нет новой строки в конце файла
portal/subjects/urls.py
Просмотр файла @
42c23765
...
...
@@ -3,8 +3,7 @@ from subjects import views
urlpatterns
=
[
path
(
'theme_list/'
,
views
.
without_filter
,
name
=
'theme_list'
),
path
(
'theme_create_test/'
,
views
.
create_test
,
name
=
'create_auto'
),
path
(
'new_theme_create/'
,
views
.
new_theme_create
,
name
=
'new_theme_create'
),
path
(
'new_theme_create/'
,
views
.
new_theme_create
,
name
=
'new_theme_create'
),
path
(
'search_results_view'
,
views
.
search
,
name
=
'search_results_view'
),
path
(
route
=
'use_theme'
,
view
=
views
.
use_theme
,
name
=
'use_theme'
),
]
portal/subjects/views.py
Просмотр файла @
42c23765
...
...
@@ -8,18 +8,16 @@ import random
def
without_filter
(
request
):
themes
=
Theme
.
objects
.
all
()
subjects
=
Subject
.
objects
.
all
()
return
render
(
request
,
'theme_list/theme_list.html'
,
{
'themes'
:
themes
,
'subjects'
:
subjects
})
return
render
(
request
,
'theme_list/theme_list.html'
,
{
'themes'
:
themes
,
'subjects'
:
subjects
})
def
create_test
(
request
):
theme
=
Theme
.
objects
.
create
(
Name
=
"123"
,
Author
=
"123"
,
Subject
=
"123"
,
Status
=
"Свободно"
,
Descript
=
"Тут что-то"
,
Class_of_subject
=
"sub2"
,
Class_of_tag
=
"tag-open"
)
return
redirect
(
'theme_list'
)
def
new_theme_create
(
request
):
if
request
.
method
==
'POST'
:
theme_id
=
request
.
POST
.
get
(
'theme_id'
)
if
theme_id
==
'0'
:
theme
=
Theme
.
objects
.
create
(
class_of_tag
=
'tag-open'
,
status
=
'Свободно'
)
theme
=
Theme
.
objects
.
create
(
class_of_tag
=
'tag-open'
,
status
=
'Свободно'
)
else
:
theme
=
Theme
.
objects
.
get
(
id
=
theme_id
)
...
...
@@ -30,23 +28,43 @@ def new_theme_create(request):
theme_subject
=
request
.
POST
.
get
(
'subjects_input'
)
theme_subject
=
theme_subject
.
split
(
','
)[
0
]
if
(
not
Subject
.
objects
.
filter
(
name
=
theme_subject
).
exists
()):
color
=
str
(
random
.
randint
(
45
,
255
))
+
','
+
str
(
random
.
randint
(
45
,
255
))
+
','
+
str
(
random
.
randint
(
45
,
255
))
Subject
.
objects
.
create
(
name
=
theme_subject
,
color
=
color
)
color
=
str
(
random
.
randint
(
45
,
255
))
+
','
+
\
str
(
random
.
randint
(
45
,
255
))
+
','
+
\
str
(
random
.
randint
(
45
,
255
))
Subject
.
objects
.
create
(
name
=
theme_subject
,
color
=
color
)
theme
.
subject_color
=
color
else
:
subject
=
Subject
.
objects
.
get
(
name
=
theme_subject
)
theme
.
subject_color
=
subject
.
color
theme
.
subject_color
=
subject
.
color
theme
.
save
()
return
redirect
(
'theme_list'
)
def
search
(
request
):
if
request
.
method
==
'POST'
:
filters_subject
=
request
.
POST
.
get
(
'subject'
)
print
(
filters_subject
)
print
(
*
request
.
POST
.
items
())
subjects
=
Subject
.
objects
.
all
()
search_object
=
request
.
POST
.
get
(
'search_input'
)
search_result
=
Theme
.
objects
.
filter
(
name__icontains
=
search_object
)
return
render
(
request
,
'theme_list/theme_list.html'
,
{
'themes'
:
search_result
})
filters_open
=
request
.
POST
.
get
(
'open'
)
filters_close
=
request
.
POST
.
get
(
'close'
)
filters_past_year
=
request
.
POST
.
get
(
'past_year'
)
search_result
=
Theme
.
objects
.
all
()
if
filters_open
!=
None
:
search_result
=
search_result
.
filter
(
status
=
'Свободно'
)
if
filters_close
!=
None
:
search_result
=
search_result
.
filter
(
status
=
'Занято'
)
if
filters_past_year
!=
None
:
search_result
=
search_result
.
filter
(
status
=
'Прошлых лет'
)
if
filters_subject
!=
'Не указано'
:
search_result
=
search_result
.
filter
(
subjects__icontains
=
filters_subject
)
search_result
=
search_result
.
filter
(
name__icontains
=
search_object
)
return
render
(
request
,
'theme_list/theme_list.html'
,
{
'themes'
:
search_result
,
'subjects'
:
subjects
})
def
use_theme
(
request
:
HttpRequest
):
...
...
@@ -54,7 +72,7 @@ def use_theme(request: HttpRequest):
try
:
theme
=
Theme
.
objects
.
get
(
id
=
theme_id
)
context
=
{
'name'
:
theme
.
name
,
'description'
:
theme
.
descript
}
'description'
:
theme
.
descript
}
return
send_create_form
(
request
,
context_theme
=
context
)
except
Theme
.
DoesNotExist
:
redirect
(
'theme_list'
)
portal/templates/theme_list/theme_list.html
Просмотр файла @
42c23765
...
...
@@ -19,9 +19,10 @@
<div
class=
"checkboxes"
>
<div
class=
"div-list"
>
<div
class=
"list-name"
>
Предмет
</div>
<input
type=
"hidden"
id=
"subject-filter"
name=
"subject"
/>
<div
class=
"list-names"
>
<div
class=
"list-p"
name=
"subject"
>
Не указано
</div>
<ul
class=
"list"
>
<div
class=
"list-p"
>
Не указано
</div>
<ul
class=
"list"
name=
"subject"
>
<li
class=
"list-li"
>
Не указано
</li>
{% for subject in subjects %}
<li
class=
"list-li"
>
{{subject.name}}
</li>
...
...
@@ -59,7 +60,9 @@
</svg>
</button>
{% for theme in themes %}
<div
class=
"theme-block theme-block-close"
style=
"background: linear-gradient(248deg, rgb({{theme.subject_color}}) 44%, rgba({{theme.subject_color}}, 0.9) 98%);"
id=
"{{theme.id}}"
>
<div
class=
"theme-block theme-block-close"
style=
"background: linear-gradient(248deg, rgb({{theme.subject_color}}) 44%, rgba({{theme.subject_color}}, 0.9) 98%);"
id=
"{{theme.id}}"
>
<h2
class=
"theme-block-title"
>
{{ theme.subjects }}
</h2>
<div
class=
"descr"
>
<h2
class=
"theme-name theme-name-close"
>
{{ theme.name }}
</h2>
...
...
@@ -71,7 +74,8 @@
<a
class=
"info-link"
href=
"#"
title=
"Автор темы"
>
{{ theme.author }}
</a>
<span
class=
"tag {{theme.class_of_tag}}"
>
{{ theme.status }}
</span>
</div>
<button
class=
"theme-btn-take"
,
onclick=
"window.location = '{% url 'use_theme' %}?theme_id={{theme.id}}'"
>
Взять проект
</button>
<button
class=
"theme-btn-take"
,
onclick=
"window.location = '{% url 'use_theme' %}?theme_id={{theme.id}}'"
>
Взять проект
</button>
</div>
<button
class=
"edit"
>
<svg
height=
"18px"
version=
"1.1"
viewBox=
"0 0 18 18"
width=
"18px"
xmlns=
"http://www.w3.org/2000/svg"
...
...
@@ -96,8 +100,10 @@
{% csrf_token %}
<h2
class=
"new-theme-title"
>
Создание новой темы
</h2>
<div
class=
"new-theme-inputs"
>
<input
type=
"text"
class=
"new-theme-input form-input"
name=
"name_input"
placeholder=
"Название темы"
required
/>
<textarea
class=
"new-theme-textarea form-input"
name=
"descript_input"
placeholder=
"Описание темы"
required
></textarea>
<input
type=
"text"
class=
"new-theme-input form-input"
name=
"name_input"
placeholder=
"Название темы"
required
/>
<textarea
class=
"new-theme-textarea form-input"
name=
"descript_input"
placeholder=
"Описание темы"
required
></textarea>
<div
class=
"new-theme-subjects"
>
<input
type=
"text"
class=
"new-theme-subjects-input form-input"
placeholder=
"Введите названние предметной области"
id=
"theme_subject"
>
...
...
Редактирование
Предварительный просмотр
Поддерживает Markdown
0%
Попробовать снова
или
прикрепить новый файл
.
Отмена
You are about to add
0
people
to the discussion. Proceed with caution.
Сначала завершите редактирование этого сообщения!
Отмена
Пожалуйста,
зарегистрируйтесь
или
войдите
чтобы прокомментировать