|
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>
|
<title>TEST</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<h1>{{ text }}</h1>
|
|
||||||
|
|
||||||
<table>
|
{% for name, file_path, description in data %}
|
||||||
{% for i in list %}
|
<div class="product">
|
||||||
<tr>
|
<a title="{{ name }}">
|
||||||
<th>{{ i }}</th>
|
<div class="title" style="height: 32px;">
|
||||||
<th>{% widthratio i 1 i %}</th>
|
<span class="name" itemprop="name">{{ name }}</span>
|
||||||
</tr>
|
</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 %}
|
{% endfor %}
|
||||||
</table>
|
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</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 = [
|
urlpatterns = [
|
||||||
path("", views.index, name="index"),
|
path("", views.index, name="index"),
|
||||||
path("test", views.test, name="other")
|
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -1,16 +1,16 @@
|
|||||||
from django.http import HttpResponse
|
from django.http import HttpResponse
|
||||||
from django.shortcuts import render
|
from django.shortcuts import render
|
||||||
# from db_get_data import exec_query
|
from db_get_data import exec_query
|
||||||
|
|
||||||
|
|
||||||
def index(request):
|
def index(request):
|
||||||
context = {
|
context = {
|
||||||
"text": "test",
|
"data": exec_query("select name, file, description from images")
|
||||||
"list": range(101)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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))
|
return HttpResponse(render(request, "polls/index.html", context))
|
||||||
|
|
||||||
|
|
||||||
def test(req):
|
|
||||||
return HttpResponse("test")
|
|
||||||
|
|||||||
@@ -118,6 +118,10 @@ USE_TZ = True
|
|||||||
|
|
||||||
STATIC_URL = '/static/'
|
STATIC_URL = '/static/'
|
||||||
|
|
||||||
|
MEDIA_URL = '/images/'
|
||||||
|
MEDIA_ROOT = '/images'
|
||||||
|
|
||||||
|
|
||||||
# Default primary key field type
|
# Default primary key field type
|
||||||
# https://docs.djangoproject.com/en/4.2/ref/settings/#default-auto-field
|
# https://docs.djangoproject.com/en/4.2/ref/settings/#default-auto-field
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
from django.urls import path, include
|
from django.urls import path, include
|
||||||
|
|
||||||
|
from django.conf.urls.static import static
|
||||||
|
from django.conf import settings
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
path('admin/', admin.site.urls),
|
path('admin/', admin.site.urls),
|
||||||
path("", include("polls.urls"))
|
path("", include("polls.urls"))
|
||||||
|
|||||||