From 7f3e635dc3ec87a14154f246862edf09fc49caf6 Mon Sep 17 00:00:00 2001 From: Erik Schindler Date: Sun, 19 Apr 2020 11:56:18 +0200 Subject: [PATCH] Added betting_with_django project --- .../betting_with_django/__init__.py | 0 .../__pycache__/__init__.cpython-38.pyc | Bin 0 -> 165 bytes .../__pycache__/settings.cpython-38.pyc | Bin 0 -> 2375 bytes .../__pycache__/urls.cpython-38.pyc | Bin 0 -> 1006 bytes .../__pycache__/wsgi.cpython-38.pyc | Bin 0 -> 592 bytes .../betting_with_django/asgi.py | 16 +++ .../betting_with_django/settings.py | 121 ++++++++++++++++++ .../betting_with_django/urls.py | 22 ++++ .../betting_with_django/wsgi.py | 16 +++ eriks/betting_with_django/db.sqlite3 | Bin 0 -> 143360 bytes eriks/betting_with_django/manage.py | 21 +++ eriks/betting_with_django/polls/__init__.py | 0 .../polls/__pycache__/__init__.cpython-38.pyc | Bin 0 -> 151 bytes .../polls/__pycache__/admin.cpython-38.pyc | Bin 0 -> 266 bytes .../polls/__pycache__/apps.cpython-38.pyc | Bin 0 -> 369 bytes .../polls/__pycache__/models.cpython-38.pyc | Bin 0 -> 1279 bytes .../polls/__pycache__/urls.cpython-38.pyc | Bin 0 -> 494 bytes .../polls/__pycache__/views.cpython-38.pyc | Bin 0 -> 1196 bytes eriks/betting_with_django/polls/admin.py | 7 + eriks/betting_with_django/polls/apps.py | 5 + .../polls/migrations/0001_initial.py | 32 +++++ .../polls/migrations/__init__.py | 0 .../__pycache__/0001_initial.cpython-38.pyc | Bin 0 -> 1015 bytes .../__pycache__/__init__.cpython-38.pyc | Bin 0 -> 162 bytes eriks/betting_with_django/polls/models.py | 25 ++++ .../polls/templates/polls/detail.html | 6 + .../polls/templates/polls/index.html | 9 ++ eriks/betting_with_django/polls/tests.py | 3 + eriks/betting_with_django/polls/urls.py | 21 +++ eriks/betting_with_django/polls/views.py | 28 ++++ 30 files changed, 332 insertions(+) create mode 100644 eriks/betting_with_django/betting_with_django/__init__.py create mode 100644 eriks/betting_with_django/betting_with_django/__pycache__/__init__.cpython-38.pyc create mode 100644 eriks/betting_with_django/betting_with_django/__pycache__/settings.cpython-38.pyc create mode 100644 eriks/betting_with_django/betting_with_django/__pycache__/urls.cpython-38.pyc create mode 100644 eriks/betting_with_django/betting_with_django/__pycache__/wsgi.cpython-38.pyc create mode 100644 eriks/betting_with_django/betting_with_django/asgi.py create mode 100644 eriks/betting_with_django/betting_with_django/settings.py create mode 100644 eriks/betting_with_django/betting_with_django/urls.py create mode 100644 eriks/betting_with_django/betting_with_django/wsgi.py create mode 100644 eriks/betting_with_django/db.sqlite3 create mode 100755 eriks/betting_with_django/manage.py create mode 100644 eriks/betting_with_django/polls/__init__.py create mode 100644 eriks/betting_with_django/polls/__pycache__/__init__.cpython-38.pyc create mode 100644 eriks/betting_with_django/polls/__pycache__/admin.cpython-38.pyc create mode 100644 eriks/betting_with_django/polls/__pycache__/apps.cpython-38.pyc create mode 100644 eriks/betting_with_django/polls/__pycache__/models.cpython-38.pyc create mode 100644 eriks/betting_with_django/polls/__pycache__/urls.cpython-38.pyc create mode 100644 eriks/betting_with_django/polls/__pycache__/views.cpython-38.pyc create mode 100644 eriks/betting_with_django/polls/admin.py create mode 100644 eriks/betting_with_django/polls/apps.py create mode 100644 eriks/betting_with_django/polls/migrations/0001_initial.py create mode 100644 eriks/betting_with_django/polls/migrations/__init__.py create mode 100644 eriks/betting_with_django/polls/migrations/__pycache__/0001_initial.cpython-38.pyc create mode 100644 eriks/betting_with_django/polls/migrations/__pycache__/__init__.cpython-38.pyc create mode 100644 eriks/betting_with_django/polls/models.py create mode 100644 eriks/betting_with_django/polls/templates/polls/detail.html create mode 100644 eriks/betting_with_django/polls/templates/polls/index.html create mode 100644 eriks/betting_with_django/polls/tests.py create mode 100644 eriks/betting_with_django/polls/urls.py create mode 100644 eriks/betting_with_django/polls/views.py diff --git a/eriks/betting_with_django/betting_with_django/__init__.py b/eriks/betting_with_django/betting_with_django/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/eriks/betting_with_django/betting_with_django/__pycache__/__init__.cpython-38.pyc b/eriks/betting_with_django/betting_with_django/__pycache__/__init__.cpython-38.pyc new file mode 100644 index 0000000000000000000000000000000000000000..1f4da664ec133a0251f91d191a36d646aad801d3 GIT binary patch literal 165 zcmWIL<>g`kf{p(I;z0Cc5P=LBfgA@QE@lA|DGb33nv8xc8Hzx{2;!HQenx(7s(xxw zX10DwYHopkL1jrsex80(YDr0EUV40aW=TeTN>*ZCdOlXM`1s7c%#!$cy@JYH95%W6 PDWy57b|5=G12F>t4%jNK literal 0 HcmV?d00001 diff --git a/eriks/betting_with_django/betting_with_django/__pycache__/settings.cpython-38.pyc b/eriks/betting_with_django/betting_with_django/__pycache__/settings.cpython-38.pyc new file mode 100644 index 0000000000000000000000000000000000000000..324c2958d9b1dac78a1c788fce5b3c7382c25858 GIT binary patch literal 2375 zcmb7FTXWM!6qXfXJ0^xexTHW^QLcs}0ilKIv^0vX1Q*}NvPrAyR3m%W@+P{WT@kF` z!b5rNbN@zvfnGb)nf`&!&|ylCWGC@Bo@pw1k9W^~&wgjsEfxzLJiq?Y{^`dhj{7}X zOh0*8tizzc0YRM3p$y{fjGn=n9scKqDJtL-Z!^iOXVHS5LxP^SIDHYFKv|SSd9;WM z=%kg?3up-y(J6EqEu%B&EO1Vu6@3Yvvp6K6^XLM)h*r@@mOwJ-(i_3b=tXo{KZUNK zkJD(UaTa~@mPeny;YmhcMk2Zjnj-ovrPoq=on$OQKZ9=QXVFc41#&qD<2;ND=$3vF z@fugUZ9d6xT%odKx|SzW%ouSkDh|9r?2Q-39$`ZRjTQXB+rfP%6$)F}#evB%5_==@ z)>wScL=JI9%FKXGG;fI^1&`t+z?yVlS_A7%@b7p57Ksa?9Fq~x72(H*1cDPAe-63e z!jLhaekIGu>r-hQV?Tqw=g8QV!J*7NpY*A`pS(PF&xTkWgtjf(gfh_^9B$5Z5d^{{ z5MP;gi0S`{72v^Cpg#c)TqAn;_@+M!9=MN2-vm#bJL{Hz_0H}W-nGzqSR!}nOZvKW z4db3=;GKIn?hg=IH#*S;-?MEhnZ8e@Rx&Mn?toa)x$!=wzUQ)l^rW<=(aJ10WW(t4 z3^OsoE@LAf)9B)ikYY-q%0~qb2uuqsF3nmnIG28M8Z^2$kvRk*8}FF`mMHFr0bwIa zn@s8lvgpyQt4VNa%3d4urmRXwgTOI6o-38pzyDCB!9Xelc|q{rlm6+?#tM=g?c7t}sI*f@vqzzl76fOFJ4tR#JD6NcBK0x&1@5+7&P##XhV#zI4> zt3eK$J$g2?i4;w~N$H*!AOkKGg3@qOm*PNSNehPzYs4Y8nRLsGv4$5!Pmk-VPF&)I zP7S*j8y?z!dtCc*^Ry;89y(Y*u7gJC;DGdxc!+s~qoNuHo{!}X9N5H-@-kfi&`fe^ zHO?6Z+}wr{^B#=_-(*8L1QNJ_|2Sv%Xv)bOMsmd%hMwP0G&MQexS*-!w%ReCt3Sji zD(XgeD=sRvT60^i7|)toM~hEY8(IfgzyLgGaiLzVRBGzB(pKZ8cC*#CtQ0Uh}+q+NaRq%oe=9^7xl*@V~8VJ97kR8F$_g$qPL zP)h#(P9Ay=mZ7Y>a?;nbKVn1AmFFONE^q&1C;6i||Fz?x(8f>UOU}_(K!m0I!j+t` zAn-z#&rH4Vgp*UN4F66j2tvx?5BTr-5Bz)KgRm^*65i53FfZ~PaD^lEFJT2@jNk0P DE?p@> literal 0 HcmV?d00001 diff --git a/eriks/betting_with_django/betting_with_django/__pycache__/urls.cpython-38.pyc b/eriks/betting_with_django/betting_with_django/__pycache__/urls.cpython-38.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f3d073c00019a0d07e1b00b413426e1694c7d755 GIT binary patch literal 1006 zcma)5%Z}496m`<{L1qT{1n=5NotVe20t6Z{VkE?3U^ZQlNn^KhiS5XC8CtO`Kf~9s z&z2RxzyfjYrc#9lX)MLDt?P5oIoJ2<_DmEz{Cm4YqeyBO$#LmljLdoh*(wg z!VnisAiW{+>o2(gEHjDESF&*Ic4tPa~Rk<;zGZ01(Q2)n5*^+5TB=tt^>AV3f z&;E{VTzs0F%z=!Oe;8fJqFPa?D45{$IcWtHbMMcEHwFV0D36O}qXf@eD$Ow^=a+fqq#OS9a1=Fro6-3*=yMOPJj5dgGt_|b#o;9=)DIR5h& DMx8rL literal 0 HcmV?d00001 diff --git a/eriks/betting_with_django/betting_with_django/__pycache__/wsgi.cpython-38.pyc b/eriks/betting_with_django/betting_with_django/__pycache__/wsgi.cpython-38.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b72f30551dfd3e80436ed7e4fff44d3cbce4d41f GIT binary patch literal 592 zcmZuv&2AGh5cY1;CM*~VaYG1EscjTg(n@KClmm{tp6ojKPir?Jz49Qy zkt46;YfroahYD|2NI7IA&uC^e^L;bp>w|*~Mfv@3`T2W-(0$`wH7geV$IxVE^tu`!pGjaAEXZlz47xd;{JK zUDB2C73B-2OM`7~7Et&+%SIl?^=+F_V(rNWjcthLz#B5?)DIg2YQ!i%m*1 z1su<2%vvc5=7rI-S?qTf5tXR{3mw7LCV`EP&4t5rA>k!<09oa|b#Dmarf_*n>OZH# zC<2S^nP9!b literal 0 HcmV?d00001 diff --git a/eriks/betting_with_django/betting_with_django/asgi.py b/eriks/betting_with_django/betting_with_django/asgi.py new file mode 100644 index 0000000..7d18c66 --- /dev/null +++ b/eriks/betting_with_django/betting_with_django/asgi.py @@ -0,0 +1,16 @@ +""" +ASGI config for betting_with_django project. + +It exposes the ASGI callable as a module-level variable named ``application``. + +For more information on this file, see +https://docs.djangoproject.com/en/3.0/howto/deployment/asgi/ +""" + +import os + +from django.core.asgi import get_asgi_application + +os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'betting_with_django.settings') + +application = get_asgi_application() diff --git a/eriks/betting_with_django/betting_with_django/settings.py b/eriks/betting_with_django/betting_with_django/settings.py new file mode 100644 index 0000000..e0ef121 --- /dev/null +++ b/eriks/betting_with_django/betting_with_django/settings.py @@ -0,0 +1,121 @@ +""" +Django settings for betting_with_django project. + +Generated by 'django-admin startproject' using Django 3.0.3. + +For more information on this file, see +https://docs.djangoproject.com/en/3.0/topics/settings/ + +For the full list of settings and their values, see +https://docs.djangoproject.com/en/3.0/ref/settings/ +""" + +import os + +# Build paths inside the project like this: os.path.join(BASE_DIR, ...) +BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) + + +# Quick-start development settings - unsuitable for production +# See https://docs.djangoproject.com/en/3.0/howto/deployment/checklist/ + +# SECURITY WARNING: keep the secret key used in production secret! +SECRET_KEY = '7&pyr1n4y=r8m*@gp!*k5o#um2)i+sqsx)#eebg_ej-%0fdi@_' + +# SECURITY WARNING: don't run with debug turned on in production! +DEBUG = True + +ALLOWED_HOSTS = [] + + +# Application definition + +INSTALLED_APPS = [ + 'polls.apps.PollsConfig', + 'django.contrib.admin', + 'django.contrib.auth', + 'django.contrib.contenttypes', + 'django.contrib.sessions', + 'django.contrib.messages', + 'django.contrib.staticfiles', +] + +MIDDLEWARE = [ + 'django.middleware.security.SecurityMiddleware', + 'django.contrib.sessions.middleware.SessionMiddleware', + 'django.middleware.common.CommonMiddleware', + 'django.middleware.csrf.CsrfViewMiddleware', + 'django.contrib.auth.middleware.AuthenticationMiddleware', + 'django.contrib.messages.middleware.MessageMiddleware', + 'django.middleware.clickjacking.XFrameOptionsMiddleware', +] + +ROOT_URLCONF = 'betting_with_django.urls' + +TEMPLATES = [ + { + 'BACKEND': 'django.template.backends.django.DjangoTemplates', + 'DIRS': [], + 'APP_DIRS': True, + 'OPTIONS': { + 'context_processors': [ + 'django.template.context_processors.debug', + 'django.template.context_processors.request', + 'django.contrib.auth.context_processors.auth', + 'django.contrib.messages.context_processors.messages', + ], + }, + }, +] + +WSGI_APPLICATION = 'betting_with_django.wsgi.application' + + +# Database +# https://docs.djangoproject.com/en/3.0/ref/settings/#databases + +DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.sqlite3', + 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), + } +} + + +# Password validation +# https://docs.djangoproject.com/en/3.0/ref/settings/#auth-password-validators + +AUTH_PASSWORD_VALIDATORS = [ + { + 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', + }, + { + 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', + }, + { + 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', + }, + { + 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', + }, +] + + +# Internationalization +# https://docs.djangoproject.com/en/3.0/topics/i18n/ + +LANGUAGE_CODE = 'de' + +TIME_ZONE = 'Europe/Berlin' + +USE_I18N = True + +USE_L10N = True + +USE_TZ = True + + +# Static files (CSS, JavaScript, Images) +# https://docs.djangoproject.com/en/3.0/howto/static-files/ + +STATIC_URL = '/static/' diff --git a/eriks/betting_with_django/betting_with_django/urls.py b/eriks/betting_with_django/betting_with_django/urls.py new file mode 100644 index 0000000..d50fb9a --- /dev/null +++ b/eriks/betting_with_django/betting_with_django/urls.py @@ -0,0 +1,22 @@ +"""betting_with_django URL Configuration + +The `urlpatterns` list routes URLs to views. For more information please see: + https://docs.djangoproject.com/en/3.0/topics/http/urls/ +Examples: +Function views + 1. Add an import: from my_app import views + 2. Add a URL to urlpatterns: path('', views.home, name='home') +Class-based views + 1. Add an import: from other_app.views import Home + 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') +Including another URLconf + 1. Import the include() function: from django.urls import include, path + 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) +""" +from django.contrib import admin +from django.urls import include, path + +urlpatterns = [ + path('polls/', include('polls.urls')), + path('admin/', admin.site.urls), +] diff --git a/eriks/betting_with_django/betting_with_django/wsgi.py b/eriks/betting_with_django/betting_with_django/wsgi.py new file mode 100644 index 0000000..9caa43b --- /dev/null +++ b/eriks/betting_with_django/betting_with_django/wsgi.py @@ -0,0 +1,16 @@ +""" +WSGI config for betting_with_django project. + +It exposes the WSGI callable as a module-level variable named ``application``. + +For more information on this file, see +https://docs.djangoproject.com/en/3.0/howto/deployment/wsgi/ +""" + +import os + +from django.core.wsgi import get_wsgi_application + +os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'betting_with_django.settings') + +application = get_wsgi_application() diff --git a/eriks/betting_with_django/db.sqlite3 b/eriks/betting_with_django/db.sqlite3 new file mode 100644 index 0000000000000000000000000000000000000000..d9d7072420a646acdb5d89f82ffc4acbf5c3f22f GIT binary patch literal 143360 zcmeI5Uu+x6eaCl2QY0;rBgvL|ceX4_vd$)SvdATue|)*#>1fj&o{J2qgbu%Stxck96Ku~&ZH7@G$lVbYW{>rq#($Mg zQc=sAQdaLMC9RTg7J5376Oo9t=%-Gu8BW3}!^viYdMc@n=7Ai=q(~xu!ABikH611G zj+nQD2$Et_Jo?fg_4BgnCt>*6QcFe3r&@0)YA&Z}^?J3glqqmEuQhtsE}Tq8r1=5r zY{_&MSL)jB&0<|sveimct2CQCHLao0MwWWHNT$MaEb{yz>f$BSg>0`E2UM!&ixs7^ zS!(MbW=kcL@pvlsoR|7A+d3Sx`)IML)|x#ll1xOTX!4wgdNA8M9JPDU%4)H6pSDiQ zQaF-)!A+g4npKeuCstoONMk3X$y74+LcdFxUYxgMWE3gia&@bPS7Cg))1G)GITe$Z zTy(TiO}TQhLR~}^%9FNCeTTQRnr+e%rL33KypkKDT~W%0E6H+Y z$f9Gd%G~x+lSm{Y(Qw$o$G+*J=h!!!HX+Aiae1zfGMzS=?q5KPC6bARNYPDqqT9b< zI1!6UZ2s>dIf48;`5O5$*&?4KpC-RU6Yv575C8!X009sH0T2KI5C8!X009tqUj&AT zV_M`Zf5viy<8Z%YMr4b0wl%q+&*zx%@I=1aHaO@Q_wp!P%^CJPLSEg+?M)Ap4=gyeqR-YF$jPF2!H?xfB*=900@8p2!H?xfB+*fzMx^b2)|SDchXCVS7L5bPA)R?1%uH z|N9&?7GN*RG(CaYwT#K;60 zBBK9${%`vK#{VV%Z}?yLSNtFMFZw0_xPQ?11K+>+{+fPIz;F9LLml7+0w4eaAOHd& z00JNY0w4eaAh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ymjz)*0pz1$-bEo+I`_9JxLT5 zcVDr8*4c$9bU#5UsTr-Llxf?Sltes}i{_#k-taw?J9{>M55xUEw|yqs1u-%$O>DP~ z%c325Y04dlM#Xz6`{$#*WDgCl_NMP)@j%UQ>D#kabk)7H>5gsCzGG|1YMtE8Ww)d2lZTD!7WwKgQ%XCUR zb{}c>24nZdtl?*Gi5(>-LxSMgZ2x>l397P%UP)*5r?m zXE_tgNb#`UV5+ASRHv$rs5lkPJCX2L1o+|6~7W{dIrZf5t!J`!C<$`u@Q8 zx^KldHTZ+UuMPhG;A?|FGx(9gk%503cyr)42YzirTiKKi=z{S_!gfP>-G*rxvH?JoMq18hvQ2WuqsURwr~T{r7d7m7ZW& zofxB56Csb9qfb8M4^LwkqcPLVaqh*<)tFEJYUwc(P9LLIGf}sp$V_H-h9)!V^b@+J zp~_5VmWD1fY4UMuIX&xU%FHxVn;D;cjN9~cb;dKJTjGrPlL2ZIiu4=WY*vOe)9$El zXDGAT8N!T|;3&15n(1e{Y(@;35uG_gEoKugy#=e4rdDY-cWPQonehP0AWNJ(OpPN? zy9{|omT7KCY%4IL7cg{o6fm^f3xtMgff?Dw1b0|7(RS10L)3Kql#?rGPvUGzW|1JF zxl=PvL#ml?Xyg`t-NMjjS{R~O^a&re7@Kx7F=jSX!QP)3qIy;jJN*g8&GC00@8p z2!H?xfB*=900@A!3m z00ck)1V8`;KmY_l00cnbVIuHYFR_F43j>aMyekDQ*toUhqhAUz=JBSh&0u*mTVUt^ z`^dZW`G4eH^8H@Lkp==F00JNY0w4eaAOHd&00JNY0wC~E5^xDlhga-l&;R>B#fMv6 literal 0 HcmV?d00001 diff --git a/eriks/betting_with_django/manage.py b/eriks/betting_with_django/manage.py new file mode 100755 index 0000000..beb2586 --- /dev/null +++ b/eriks/betting_with_django/manage.py @@ -0,0 +1,21 @@ +#!/usr/bin/env python +"""Django's command-line utility for administrative tasks.""" +import os +import sys + + +def main(): + os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'betting_with_django.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() diff --git a/eriks/betting_with_django/polls/__init__.py b/eriks/betting_with_django/polls/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/eriks/betting_with_django/polls/__pycache__/__init__.cpython-38.pyc b/eriks/betting_with_django/polls/__pycache__/__init__.cpython-38.pyc new file mode 100644 index 0000000000000000000000000000000000000000..71dfbdcc0d9735c2f3255cbe101046057dd0d188 GIT binary patch literal 151 zcmWIL<>g`k0`K~uI1v39L?8o3AjbiSi&=m~3PUi1CZpdb>P+5|ZpQoRcT2hjkmmXi9S&|W-l9ia3p08h!pOaIpA0MBYmst`YuUAlc Ui^C>2KczG$)edCpXCP((04@6@3;+NC literal 0 HcmV?d00001 diff --git a/eriks/betting_with_django/polls/__pycache__/admin.cpython-38.pyc b/eriks/betting_with_django/polls/__pycache__/admin.cpython-38.pyc new file mode 100644 index 0000000000000000000000000000000000000000..0e7f04800181509bdf81afd5af3674fd935c1c91 GIT binary patch literal 266 zcmYjLOKJi^6zrbvks+w($ZYI&KtfI+#NcKY5lug4TKh9}KM~1gbeSv7He}%yvdU}S zq~O(~ih`=uWb(iWi=XBDC;jg%{zH&>p-YcMnrUvC;|=Fb7h2fDiAHb+d?(K(h)ee6 z8>`DJrCH5~a-*H`SAJL3>j4s);1~6%nd;rfw_)}XJVvvP1!abj3mR;SG7Fgu!cawM zO+tuYELLRS==Vu=!GVHk_6ouEsy|^DyxIby@$LF(uv_07R3EHO>b7LopN48qB?k-7 Mc~#0yV>vGV03-}VR{#J2 literal 0 HcmV?d00001 diff --git a/eriks/betting_with_django/polls/__pycache__/apps.cpython-38.pyc b/eriks/betting_with_django/polls/__pycache__/apps.cpython-38.pyc new file mode 100644 index 0000000000000000000000000000000000000000..30d898002bd976f5e37999ab6d4728fbdc83769b GIT binary patch literal 369 zcmYjMy-ve05I)DLl$KWF5m>X-D+5AB3=BvW0(J3#6|hMH@eheB)QJIJhF9{+#49lM z>>$yT?&tG&_uYB3Sj+(J`u+BPgZVpxL(37Y(1#NY5+vzB6HW+Rfy^ZR1W6V7pgfcL z9h8$F?1GYn>4kHb);zWKV|+O@f?$O{9Ai+xi3FS`oXQLpXgIpDT{n!weBvTlmw70J zFqKw9gqaZ9%54|xxe%}0s{3Q|n7^PeP&tL)Q`T6mnCjaX=9PBL?R;Ymdr;oDrWS9l zZ-jiVOl?_O#VY59rQ7usHR9)o3`0Q@UdQvs?q%%jBbS)}m18wUA{1xio#*k(NoP*? D#F|t* literal 0 HcmV?d00001 diff --git a/eriks/betting_with_django/polls/__pycache__/models.cpython-38.pyc b/eriks/betting_with_django/polls/__pycache__/models.cpython-38.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f2502a51bf5d3608187368ac6b25cd02d92f702b GIT binary patch literal 1279 zcma)6&2AGh5VrRxyGfH$3X}p8aLpx=IHC%*N+}>jB`93>fVGX?WK-{MYCE*4xWTng zz@gW_oJ|U zHLCLvUaQ;i?L=skb#my#Gw$vchC?GBkEgor+Ypj6%&q`hV%;o1wjtWsw5_9rhD{6w zd0NPWOQKdF@YmDsFi%BSsN}F~L^|${r)HRE-F;z9k`35#Vup;5;%tz2$GMccTO!vP zPwm=qtl7L7rbJ(4MoycMS7Q}~o<5qP(fN1mUkG4Z1p+lt5P?0w5U1BVs&HjSoEWtX z$3+LFxCy2W7}G{Eb_0xA0W0$Ys>9uO!-kAyaVi+I4aT6KiA250*wG}G<%vQj*m`dm ztDQthu5P2<+6F}51D2%^`K(q^+(ChWE(okiA*n;y8bwH(wBdwq;q8Otk2UB22Dlfw zCxCUM8mDJY6o3|Thr7VVI_M2#A?QmL3!4=SYrSEf^pWZHJYz6<0n9*lDa2J(bN8rEI596bv^?Iz2;#%jX<;%v)Xh4Wd~dz5oCK literal 0 HcmV?d00001 diff --git a/eriks/betting_with_django/polls/__pycache__/urls.cpython-38.pyc b/eriks/betting_with_django/polls/__pycache__/urls.cpython-38.pyc new file mode 100644 index 0000000000000000000000000000000000000000..82bc47e9a6b36db08b9b198a9a1a8300d7840301 GIT binary patch literal 494 zcmZXQu};G<5Qd$^Y0{=C6$?_|pi8|XR8>3yOU06b5IC!GN$g-dEzLXdAWZB$idUvS z01Fd#=>V!v{(YbCY@hEoO$W%1$@}u|!$auP!QT;ExVBT>TLF|I@W8LU+RuCsK>)Z4 zYMf!~hgnE{=uy1xK?Lz@V5x5@g29mzOEC9|W9QB{hxvQo2V zx3`a?sb_Fg=yGrCa}aJA-6|6vG7T~z<3L|r7B6brozEH9SI;d~nhBmWSP;_#stZ9CN5R3qegIkWiKqYo literal 0 HcmV?d00001 diff --git a/eriks/betting_with_django/polls/__pycache__/views.cpython-38.pyc b/eriks/betting_with_django/polls/__pycache__/views.cpython-38.pyc new file mode 100644 index 0000000000000000000000000000000000000000..65229f17ac3341bacbab61bb59154cf081cde098 GIT binary patch literal 1196 zcmb7Dy>HYo6t|sRF74fwYiWT>2xa7kUKqL{A%w)jR0#?L8Hny;w@I7C!S?mzxK4$U zk&U5UkoqrWW$M4c#Cy&iY7q;TY(K}(e!marU9Y!HpndCmB33w&LviioZqbTbg%^2t?dI*mk9>$*-1|(TCEn&f%*%Xp79o~hx z%X_Or$otxs#o`giRJh}BrvIX`^h$JwqF@jL0ES& zcq4QrODzVp_FqqgHkm9FiucSLP$Mq%m(cZN7z{a}7mU+Opu?RnY?GW(?#^gN&zNy$ z0DZ>J9f0Re`xai10hp5jK~9&ps>wL!BO`XMTX0#uouH$ELWDwPhoKQg6;`Jv zm1Q^<#$@Gwe4Lpy<_Dv4Uxv3ety>ladaV%xVe8bV>JCH+mR>Z}2^m?P9ztMMqQ;NFbpnuk-?FT+(w2ma^$u16v6_$&GGI z9ln>7V5CHlOL+)t1|t)gR0NA8xfd+p1)t7_S4>&!y*;Ulk%1*rP-{5+g&It?bv9s6 zTeX?G5AlD3-e^D{Nh1O%8YHRA5;1+WzzrJ+Tb8$Qs&zzk?;o&SylL|WrUwx340?4t zj=4m|)kreH zxHuf?v)iLhV2ft)nG6~p1H=RN28zy-8nCPd;j%a`NwyaP#e}@y=1yWsDs_87d4}mXcac#?wk{+sW}7gt-(F2 z@xHPTmc<<_>-7{1U8mw9>?*#ulm#8}D zm=Ci8Md~N0x@QX_A@M?9eI-d8MmqWzBE~e3V`WXILjgp2+0*tB!8k0&2oB4&lq9=Z zQZ-IOjDdt7jI(frsy!Howu?FV?VE!-5o0QI83mDoxN0IfQ!S{ZkA&hr28am10p{SGR0x2tTI>K zlICFhXt2HWQnj)PF0SJjBX=lZX@2gz<19g!T5{@2OeXGRCdXOo4pGW54aECUjzvZ7 zma@1v_uAdu+#^Q%{>QYg5qt29@Q>2NX(+pj t(1&5EP9@00>&<@ke)`L@a?M}*-c(Ypp3s4^o>vWdp>-{EQmf3W{RP_CC#wJe literal 0 HcmV?d00001 diff --git a/eriks/betting_with_django/polls/migrations/__pycache__/__init__.cpython-38.pyc b/eriks/betting_with_django/polls/migrations/__pycache__/__init__.cpython-38.pyc new file mode 100644 index 0000000000000000000000000000000000000000..4b850849b274d6b659d4d6a3f5cab4a77f998e81 GIT binary patch literal 162 zcmWIL<>g`k0`K~uI1v39L?8o3AjbiSi&=m~3PUi1CZpdb>P+5|ZpQoRcT2hjkmmXi9S&|W-l9ia3p08h!pOaIppPQLplvt9PpI59O fAD@|*SrQ+wS5SG2!zMRBr8Fni4rIY+AZ7pn`d=u6 literal 0 HcmV?d00001 diff --git a/eriks/betting_with_django/polls/models.py b/eriks/betting_with_django/polls/models.py new file mode 100644 index 0000000..b67b87c --- /dev/null +++ b/eriks/betting_with_django/polls/models.py @@ -0,0 +1,25 @@ +import datetime + +from django.utils import timezone +from django.db import models + +# Create your models here. + +class Question(models.Model): + question_text = models.CharField(max_length=200) + pub_date = models.DateTimeField('date published') + + def was_published_recently(self): + return self.pub_date >= timezone.now() - datetime.timedelta(days=1) + + def __str__(self): + return self.question_text + + +class Choice(models.Model): + question = models.ForeignKey(Question, on_delete=models.CASCADE) + choice_text = models.CharField(max_length=200) + votes = models.IntegerField(default=0) + + def __str__(self): + return self.choice_text \ No newline at end of file diff --git a/eriks/betting_with_django/polls/templates/polls/detail.html b/eriks/betting_with_django/polls/templates/polls/detail.html new file mode 100644 index 0000000..4e1bd67 --- /dev/null +++ b/eriks/betting_with_django/polls/templates/polls/detail.html @@ -0,0 +1,6 @@ +

{{ question.question_text }}

+
    +{% for choice in question.choice_set.all %} +
  • {{ choice.choice_text }}
  • +{% endfor %} +
\ No newline at end of file diff --git a/eriks/betting_with_django/polls/templates/polls/index.html b/eriks/betting_with_django/polls/templates/polls/index.html new file mode 100644 index 0000000..cc41400 --- /dev/null +++ b/eriks/betting_with_django/polls/templates/polls/index.html @@ -0,0 +1,9 @@ +{% if latest_question_list %} + +{% else %} +

No polls are available.

+{% endif %} \ No newline at end of file diff --git a/eriks/betting_with_django/polls/tests.py b/eriks/betting_with_django/polls/tests.py new file mode 100644 index 0000000..7ce503c --- /dev/null +++ b/eriks/betting_with_django/polls/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/eriks/betting_with_django/polls/urls.py b/eriks/betting_with_django/polls/urls.py new file mode 100644 index 0000000..84acfd7 --- /dev/null +++ b/eriks/betting_with_django/polls/urls.py @@ -0,0 +1,21 @@ +'''polls/urls.py''' + +from django.urls import path + +from . import views + +app_name = 'polls' + +urlpatterns = [ + # ex: /polls/ + path('', views.index, name='index'), + + # ex: /polls/5/ + path('/', views.detail, name='detail'), + + # ex: /polls/5/results/ + path('/results/', views.results, name='results'), + + # ex: /polls/5/vote/ + path('/vote/', views.vote, name='vote'), +] \ No newline at end of file diff --git a/eriks/betting_with_django/polls/views.py b/eriks/betting_with_django/polls/views.py new file mode 100644 index 0000000..dbf1e49 --- /dev/null +++ b/eriks/betting_with_django/polls/views.py @@ -0,0 +1,28 @@ +'''polls/views.py''' + +from django.shortcuts import render, get_object_or_404 +from django.http import Http404, HttpResponse + +from polls.models import Question + +# Create your views here. + +def index(request): + '''polls index view''' + latest_question_list = Question.objects.order_by('-pub_date')[:5] + context = {'latest_question_list': latest_question_list} + return render(request, 'polls/index.html', context) + +def detail(request, question_id): + '''polls detail view''' + question = get_object_or_404(Question, pk=question_id) + return render(request, 'polls/detail.html', {'question': question}) + +def results(request, question_id): + '''polls results view''' + return HttpResponse('You are looking at the results of question {}.'.format(question_id)) + +def vote(request, question_id): + '''polls vote for choice''' + return HttpResponse('You are voting on question {}.'.format(question_id)) +