diff --git a/Задания/task1/Yaroshevskiy/test_site/__pycache__/config.cpython-311.pyc b/Задания/task1/Yaroshevskiy/test_site/__pycache__/config.cpython-311.pyc new file mode 100644 index 0000000..27d13e8 Binary files /dev/null and b/Задания/task1/Yaroshevskiy/test_site/__pycache__/config.cpython-311.pyc differ diff --git a/Задания/task1/Yaroshevskiy/test_site/__pycache__/db_get_data.cpython-311.pyc b/Задания/task1/Yaroshevskiy/test_site/__pycache__/db_get_data.cpython-311.pyc new file mode 100644 index 0000000..f93f3f6 Binary files /dev/null and b/Задания/task1/Yaroshevskiy/test_site/__pycache__/db_get_data.cpython-311.pyc differ diff --git a/Задания/task1/Yaroshevskiy/test_site/polls/__pycache__/urls.cpython-311.pyc b/Задания/task1/Yaroshevskiy/test_site/polls/__pycache__/urls.cpython-311.pyc index 9f5cb9e..be9e01d 100644 Binary files a/Задания/task1/Yaroshevskiy/test_site/polls/__pycache__/urls.cpython-311.pyc and b/Задания/task1/Yaroshevskiy/test_site/polls/__pycache__/urls.cpython-311.pyc differ diff --git a/Задания/task1/Yaroshevskiy/test_site/polls/__pycache__/views.cpython-311.pyc b/Задания/task1/Yaroshevskiy/test_site/polls/__pycache__/views.cpython-311.pyc index b8a8c17..ddfbc13 100644 Binary files a/Задания/task1/Yaroshevskiy/test_site/polls/__pycache__/views.cpython-311.pyc and b/Задания/task1/Yaroshevskiy/test_site/polls/__pycache__/views.cpython-311.pyc differ diff --git a/Задания/task1/Yaroshevskiy/test_site/polls/static/polls/images/0.jpg b/Задания/task1/Yaroshevskiy/test_site/polls/static/polls/images/0.jpg new file mode 100644 index 0000000..b370f6f Binary files /dev/null and b/Задания/task1/Yaroshevskiy/test_site/polls/static/polls/images/0.jpg differ diff --git a/Задания/task1/Yaroshevskiy/test_site/polls/static/polls/images/1.jpg b/Задания/task1/Yaroshevskiy/test_site/polls/static/polls/images/1.jpg new file mode 100644 index 0000000..ba271bd Binary files /dev/null and b/Задания/task1/Yaroshevskiy/test_site/polls/static/polls/images/1.jpg differ diff --git a/Задания/task1/Yaroshevskiy/test_site/polls/static/polls/images/10.jpg b/Задания/task1/Yaroshevskiy/test_site/polls/static/polls/images/10.jpg new file mode 100644 index 0000000..a1c7d29 Binary files /dev/null and b/Задания/task1/Yaroshevskiy/test_site/polls/static/polls/images/10.jpg differ diff --git a/Задания/task1/Yaroshevskiy/test_site/polls/static/polls/images/11.jpg b/Задания/task1/Yaroshevskiy/test_site/polls/static/polls/images/11.jpg new file mode 100644 index 0000000..38fe42f Binary files /dev/null and b/Задания/task1/Yaroshevskiy/test_site/polls/static/polls/images/11.jpg differ diff --git a/Задания/task1/Yaroshevskiy/test_site/polls/static/polls/images/2.jpg b/Задания/task1/Yaroshevskiy/test_site/polls/static/polls/images/2.jpg new file mode 100644 index 0000000..2f8a26f Binary files /dev/null and b/Задания/task1/Yaroshevskiy/test_site/polls/static/polls/images/2.jpg differ diff --git a/Задания/task1/Yaroshevskiy/test_site/polls/static/polls/images/3.jpg b/Задания/task1/Yaroshevskiy/test_site/polls/static/polls/images/3.jpg new file mode 100644 index 0000000..b054d37 Binary files /dev/null and b/Задания/task1/Yaroshevskiy/test_site/polls/static/polls/images/3.jpg differ diff --git a/Задания/task1/Yaroshevskiy/test_site/polls/static/polls/images/4.jpg b/Задания/task1/Yaroshevskiy/test_site/polls/static/polls/images/4.jpg new file mode 100644 index 0000000..8081c10 Binary files /dev/null and b/Задания/task1/Yaroshevskiy/test_site/polls/static/polls/images/4.jpg differ diff --git a/Задания/task1/Yaroshevskiy/test_site/polls/static/polls/images/5.jpg b/Задания/task1/Yaroshevskiy/test_site/polls/static/polls/images/5.jpg new file mode 100644 index 0000000..72c250b Binary files /dev/null and b/Задания/task1/Yaroshevskiy/test_site/polls/static/polls/images/5.jpg differ diff --git a/Задания/task1/Yaroshevskiy/test_site/polls/static/polls/images/6.jpg b/Задания/task1/Yaroshevskiy/test_site/polls/static/polls/images/6.jpg new file mode 100644 index 0000000..3d9ceb3 Binary files /dev/null and b/Задания/task1/Yaroshevskiy/test_site/polls/static/polls/images/6.jpg differ diff --git a/Задания/task1/Yaroshevskiy/test_site/polls/static/polls/images/7.jpg b/Задания/task1/Yaroshevskiy/test_site/polls/static/polls/images/7.jpg new file mode 100644 index 0000000..6544bcf Binary files /dev/null and b/Задания/task1/Yaroshevskiy/test_site/polls/static/polls/images/7.jpg differ diff --git a/Задания/task1/Yaroshevskiy/test_site/polls/static/polls/images/8.jpg b/Задания/task1/Yaroshevskiy/test_site/polls/static/polls/images/8.jpg new file mode 100644 index 0000000..c3de8f2 Binary files /dev/null and b/Задания/task1/Yaroshevskiy/test_site/polls/static/polls/images/8.jpg differ diff --git a/Задания/task1/Yaroshevskiy/test_site/polls/static/polls/images/9.jpg b/Задания/task1/Yaroshevskiy/test_site/polls/static/polls/images/9.jpg new file mode 100644 index 0000000..5992aec Binary files /dev/null and b/Задания/task1/Yaroshevskiy/test_site/polls/static/polls/images/9.jpg differ diff --git a/Задания/task1/Yaroshevskiy/test_site/polls/templates/polls/index.html b/Задания/task1/Yaroshevskiy/test_site/polls/templates/polls/index.html index dcf7be9..435182f 100644 --- a/Задания/task1/Yaroshevskiy/test_site/polls/templates/polls/index.html +++ b/Задания/task1/Yaroshevskiy/test_site/polls/templates/polls/index.html @@ -6,16 +6,23 @@ TEST -

{{ text }}

- - - {% for i in list %} - - - - - {% endfor %} -
{{ i }}{% widthratio i 1 i %}
+ {% for name, file_path, description in data %} +
+ +
+ {{ name }} +
+
+ + + {{ name }} + +

{{ description }}

+
+ {{ price }} +
+
+ {% endfor %} diff --git a/Задания/task1/Yaroshevskiy/test_site/polls/templates/polls/marketplace.html b/Задания/task1/Yaroshevskiy/test_site/polls/templates/polls/marketplace.html new file mode 100644 index 0000000..42dd860 --- /dev/null +++ b/Задания/task1/Yaroshevskiy/test_site/polls/templates/polls/marketplace.html @@ -0,0 +1,18 @@ +
+ +
+ {{ name }} +
+
+ + + {{ + + +

{{ description }}

+ +
+ {{ price }} +
+
+ diff --git a/Задания/task1/Yaroshevskiy/test_site/polls/urls.py b/Задания/task1/Yaroshevskiy/test_site/polls/urls.py index 7c211a3..7175bcb 100644 --- a/Задания/task1/Yaroshevskiy/test_site/polls/urls.py +++ b/Задания/task1/Yaroshevskiy/test_site/polls/urls.py @@ -4,5 +4,4 @@ from . import views urlpatterns = [ path("", views.index, name="index"), - path("test", views.test, name="other") ] diff --git a/Задания/task1/Yaroshevskiy/test_site/polls/views.py b/Задания/task1/Yaroshevskiy/test_site/polls/views.py index 908c983..3f99302 100644 --- a/Задания/task1/Yaroshevskiy/test_site/polls/views.py +++ b/Задания/task1/Yaroshevskiy/test_site/polls/views.py @@ -1,16 +1,16 @@ from django.http import HttpResponse from django.shortcuts import render -# from db_get_data import exec_query - +from db_get_data import exec_query def index(request): context = { - "text": "test", - "list": range(101) + "data": exec_query("select name, file, description from images") } + for i in range(len(context["data"])): + context["data"][i] = list(context["data"][i]) + context["data"][i][1] = "polls/images/" + context["data"][i][1].split("/")[-1] + + print(context["data"]) return HttpResponse(render(request, "polls/index.html", context)) - -def test(req): - return HttpResponse("test") diff --git a/Задания/task1/Yaroshevskiy/test_site/test_site/__pycache__/settings.cpython-311.pyc b/Задания/task1/Yaroshevskiy/test_site/test_site/__pycache__/settings.cpython-311.pyc index 0c410e6..292155e 100644 Binary files a/Задания/task1/Yaroshevskiy/test_site/test_site/__pycache__/settings.cpython-311.pyc and b/Задания/task1/Yaroshevskiy/test_site/test_site/__pycache__/settings.cpython-311.pyc differ diff --git a/Задания/task1/Yaroshevskiy/test_site/test_site/__pycache__/urls.cpython-311.pyc b/Задания/task1/Yaroshevskiy/test_site/test_site/__pycache__/urls.cpython-311.pyc index 1d61633..03e1136 100644 Binary files a/Задания/task1/Yaroshevskiy/test_site/test_site/__pycache__/urls.cpython-311.pyc and b/Задания/task1/Yaroshevskiy/test_site/test_site/__pycache__/urls.cpython-311.pyc differ diff --git a/Задания/task1/Yaroshevskiy/test_site/test_site/settings.py b/Задания/task1/Yaroshevskiy/test_site/test_site/settings.py index c8db66a..a9b8131 100644 --- a/Задания/task1/Yaroshevskiy/test_site/test_site/settings.py +++ b/Задания/task1/Yaroshevskiy/test_site/test_site/settings.py @@ -118,6 +118,10 @@ USE_TZ = True STATIC_URL = '/static/' +MEDIA_URL = '/images/' +MEDIA_ROOT = '/images' + + # Default primary key field type # https://docs.djangoproject.com/en/4.2/ref/settings/#default-auto-field diff --git a/Задания/task1/Yaroshevskiy/test_site/test_site/urls.py b/Задания/task1/Yaroshevskiy/test_site/test_site/urls.py index 195fc78..ad2aa46 100644 --- a/Задания/task1/Yaroshevskiy/test_site/test_site/urls.py +++ b/Задания/task1/Yaroshevskiy/test_site/test_site/urls.py @@ -1,6 +1,9 @@ from django.contrib import admin from django.urls import path, include +from django.conf.urls.static import static +from django.conf import settings + urlpatterns = [ path('admin/', admin.site.urls), path("", include("polls.urls"))