PAOV 4 years ago
parent 1ead061246
commit f7a7dcba19
  1. 1
      .gitignore
  2. 2
      choose/templates/choose.html
  3. 64
      choose/templates/vote.html
  4. 3
      choose/views.py
  5. 22
      tea/settings.py
  6. 3
      tea/urls.py

1
.gitignore vendored

@ -1,3 +1,4 @@
/venv/
/db.sqlite3
/media/
/tea/.env

@ -5,6 +5,8 @@
<title>Title</title>
</head>
<body>
<script async src="https://telegram.org/js/telegram-widget.js?21" data-telegram-login="PAOV_Tea_bot" data-size="large"
data-auth-url="https://tea.paov.ru/auth/complete/telegram" data-request-access="write"></script>
<table>
<tbody>
<tr>

@ -0,0 +1,64 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
</body>
<style>
table {
border: none;
margin-bottom: 20px;
}
table th {
font-weight: bold;
text-align: left;
border: none;
padding: 10px 15px;
background: #d8d8d8;
font-size: 14px;
}
table tr th:first-child {
border-radius: 8px 0 0 8px;
}
table tr th:last-child {
border-radius: 0 8px 8px 0;
width: 35px;
}
table td {
text-align: left;
border: none;
padding: 10px 15px;
font-size: 14px;
vertical-align: top;
}
table tbody tr:nth-child(even) {
background: #f3f3f3;
}
table tr td:first-child {
border-radius: 8px 0 0 8px;
}
table tr td:last-child {
border-radius: 0 8px 8px 0;
}
table tr.category_tr th {
border-radius: 8px 8px 8px 8px;
background: #ececec;
}
table h3 {
margin-top: 0px;
margin-bottom: 0px;
}
</style>
</html>

@ -47,6 +47,9 @@ def list_of_teas():
return {'categories': dic, 'ms': [0, 50, 100, 150, 200, 250, 300, 350, 400, 450, 500]}
def list_of_choices():
pass
@login_requiered
def home(request):

@ -9,9 +9,13 @@ https://docs.djangoproject.com/en/4.1/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/4.1/ref/settings/
"""
import environ
from pathlib import Path
env = environ.Env(DEBUG=(bool, False))
root = environ.Path(__file__) - 2
environ.Env.read_env()
# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent
@ -20,14 +24,15 @@ BASE_DIR = Path(__file__).resolve().parent.parent
# See https://docs.djangoproject.com/en/4.1/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'django-insecure-u=yu7(3@719dv(dtgy3wz_%yaw((r9-sh4exp(qf@to8o-e=e@'
SECRET_KEY = env.str('SECRET_KEY', '!!! SET YOUR SECRET_KEY !!!')
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
DEBUG = env.bool('DEBUG', False)
ALLOWED_HOSTS = [
'127.0.0.1',
'10.15.0.1'
'10.15.0.1',
'tea.paov.ru'
]
@ -133,5 +138,12 @@ MEDIA_URL = '/media/'
CORS_ORIGIN_WHITELIST = [
'http://10.15.0.1:8000',
'http://localhost:8000',
'http://127.0.0.1:9000'
'http://127.0.0.1:9000',
]
SOCIAL_AUTH_TELEGRAM_BOT_TOKEN = env.str('SOCIAL_AUTH_TELEGRAM_BOT_TOKEN')
AUTHENTICATION_BACKENDS = (
'social_core.backends.telegram.TelegramAuth',
'django.contrib.auth.backends.ModelBackend',
)

@ -14,7 +14,7 @@ Including another URLconf
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path
from django.urls import path, include
from django.conf import settings
from django.conf.urls.static import static
@ -22,6 +22,7 @@ import choose.views
urlpatterns = [
path('admin/', admin.site.urls),
path('auth/', include('social_django.urls', namespace='social')),
path('', choose.views.home),
path('confirm-choice', choose.views.confirm_choose),
path('login', choose.views.login_view, name='login_view')

Loading…
Cancel
Save