|
After Width: | Height: | Size: 17 KiB |
|
After Width: | Height: | Size: 9.9 KiB |
|
After Width: | Height: | Size: 10 KiB |
|
After Width: | Height: | Size: 9.7 KiB |
|
After Width: | Height: | Size: 8.9 KiB |
|
After Width: | Height: | Size: 13 KiB |
|
After Width: | Height: | Size: 7.7 KiB |
|
After Width: | Height: | Size: 6.7 KiB |
|
After Width: | Height: | Size: 8.1 KiB |
|
After Width: | Height: | Size: 13 KiB |
|
After Width: | Height: | Size: 7.2 KiB |
|
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")
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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"))
|
||||
|
||||