This commit is contained in:
pErfEcto2
2023-05-21 20:20:50 +03:00
parent 02a9414ce8
commit 264e6a4b74
24 changed files with 49 additions and 18 deletions
Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

@@ -6,16 +6,23 @@
<title>TEST</title>
</head>
<body>
<h1>{{ text }}</h1>
<table>
{% for i in list %}
<tr>
<th>{{ i }}</th>
<th>{% widthratio i 1 i %}</th>
</tr>
{% endfor %}
</table>
{% for name, file_path, description in data %}
<div class="product">
<a title="{{ name }}">
<div class="title" style="height: 32px;">
<span class="name" itemprop="name">{{ name }}</span>
</div>
</a>
<a title="{{ name }}">
<img itemprop="image" alt="{{ name }}" src="{% static file_path %}">
</a>
<p class="product-desc">{{ description }}</p>
<div itemprop="offers" class="offers">
<span>{{ price }}</span>
</div>
</div>
{% endfor %}
</body>
</html>
@@ -0,0 +1,18 @@
<div class="product">
<a title={{ name }}>
<div class="title" style="height: 32px;">
<span class="name" itemprop="name">{{ name }}</span>
</div>
</a>
<a title={{ name }}>
<img itemprop="image" alt={{ name }} src={{ file_path }}>
</a>
<p class="product-desc">{{ description }}</p>
<div itemprop="offers" class="offers">
<span>{{ price }}</span>
</div>
</div>
@@ -4,5 +4,4 @@ from . import views
urlpatterns = [
path("", views.index, name="index"),
path("test", views.test, name="other")
]
@@ -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")