mirror of
https://github.com/KUlishevgeniy/c22712.git
synced 2026-09-24 08:00:22 +00:00
Add files via upload
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
import psycopg2
|
||||
|
||||
def djselect():
|
||||
connection = psycopg2.connect(host='localhost', dbname='FHWDB', user='postgres', password='Q1w2e3r4')
|
||||
cursor = connection.cursor()
|
||||
cursor.execute('''SELECT * FROM public.parse ORDER BY id;''')
|
||||
arr = list(cursor.fetchall())
|
||||
res = ''
|
||||
k = 0
|
||||
while k != len(arr):
|
||||
i = arr[k]
|
||||
res = res + f'''<div class="grid__item shoes">
|
||||
<div class="slider">
|
||||
<div class="slider__item"><img src="/static/polls/images/PFDB{k}.jpg" alt="Dummy" /></div>
|
||||
</div>
|
||||
<div class="meta">
|
||||
<h3 class="meta__title">{i[1]}</h3>
|
||||
<span class="meta__brand">Скидка: {i[3]}</span>
|
||||
<span class="meta__price">{i[2]}</span>
|
||||
</div>
|
||||
<button class="action action--button action--buy"><i class="fa fa-shopping-cart"></i><span class="text-hidden">Add to cart</span></button>
|
||||
</div>
|
||||
'''
|
||||
k += 1
|
||||
|
||||
cursor.close()
|
||||
connection.close()
|
||||
return res
|
||||
@@ -0,0 +1,22 @@
|
||||
#!/usr/bin/env python
|
||||
"""Django's command-line utility for administrative tasks."""
|
||||
import os
|
||||
import sys
|
||||
|
||||
|
||||
def main():
|
||||
"""Run administrative tasks."""
|
||||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'mysite.settings')
|
||||
try:
|
||||
from django.core.management import execute_from_command_line
|
||||
except ImportError as exc:
|
||||
raise ImportError(
|
||||
"Couldn't import Django. Are you sure it's installed and "
|
||||
"available on your PYTHONPATH environment variable? Did you "
|
||||
"forget to activate a virtual environment?"
|
||||
) from exc
|
||||
execute_from_command_line(sys.argv)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
Reference in New Issue
Block a user