mirror of
https://github.com/Rushilwiz/pushup-contest.git
synced 2025-04-09 21:20:15 -04:00
started working
This commit is contained in:
parent
3183472908
commit
bc06642fe7
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -136,3 +136,6 @@ dmypy.json
|
||||||
|
|
||||||
# Cython debug symbols
|
# Cython debug symbols
|
||||||
cython_debug/
|
cython_debug/
|
||||||
|
|
||||||
|
#VSCODE
|
||||||
|
.vscode/*
|
||||||
|
|
0
config/__init__.py
Normal file
0
config/__init__.py
Normal file
16
config/asgi.py
Normal file
16
config/asgi.py
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
"""
|
||||||
|
ASGI config for config 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.1/howto/deployment/asgi/
|
||||||
|
"""
|
||||||
|
|
||||||
|
import os
|
||||||
|
|
||||||
|
from django.core.asgi import get_asgi_application
|
||||||
|
|
||||||
|
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'config.settings')
|
||||||
|
|
||||||
|
application = get_asgi_application()
|
132
config/settings.py
Normal file
132
config/settings.py
Normal file
|
@ -0,0 +1,132 @@
|
||||||
|
"""
|
||||||
|
Django settings for config project.
|
||||||
|
|
||||||
|
Generated by 'django-admin startproject' using Django 3.1.
|
||||||
|
|
||||||
|
For more information on this file, see
|
||||||
|
https://docs.djangoproject.com/en/3.1/topics/settings/
|
||||||
|
|
||||||
|
For the full list of settings and their values, see
|
||||||
|
https://docs.djangoproject.com/en/3.1/ref/settings/
|
||||||
|
"""
|
||||||
|
|
||||||
|
from pathlib import Path
|
||||||
|
import os
|
||||||
|
|
||||||
|
from my_secrets import secrets
|
||||||
|
|
||||||
|
# Build paths inside the project like this: BASE_DIR / 'subdir'.
|
||||||
|
BASE_DIR = Path(__file__).resolve(strict=True).parent.parent
|
||||||
|
|
||||||
|
|
||||||
|
# Quick-start development settings - unsuitable for production
|
||||||
|
# See https://docs.djangoproject.com/en/3.1/howto/deployment/checklist/
|
||||||
|
|
||||||
|
# SECURITY WARNING: keep the secret key used in production secret!
|
||||||
|
SECRET_KEY = secrets.SECRET_KEY
|
||||||
|
|
||||||
|
# SECURITY WARNING: don't run with debug turned on in production!
|
||||||
|
DEBUG = True
|
||||||
|
|
||||||
|
ALLOWED_HOSTS = []
|
||||||
|
|
||||||
|
|
||||||
|
# Application definition
|
||||||
|
|
||||||
|
INSTALLED_APPS = [
|
||||||
|
'pushup',
|
||||||
|
'users',
|
||||||
|
'django.contrib.admin',
|
||||||
|
'django.contrib.auth',
|
||||||
|
'django.contrib.contenttypes',
|
||||||
|
'django.contrib.sessions',
|
||||||
|
'django.contrib.messages',
|
||||||
|
'django.contrib.staticfiles',
|
||||||
|
|
||||||
|
'django_extensions',
|
||||||
|
'django_secrets'
|
||||||
|
#'chartjs',
|
||||||
|
]
|
||||||
|
|
||||||
|
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 = 'config.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 = 'config.wsgi.application'
|
||||||
|
|
||||||
|
|
||||||
|
# Database
|
||||||
|
# https://docs.djangoproject.com/en/3.1/ref/settings/#databases
|
||||||
|
|
||||||
|
DATABASES = {
|
||||||
|
'default': {
|
||||||
|
'ENGINE': 'django.db.backends.sqlite3',
|
||||||
|
'NAME': BASE_DIR / 'db.sqlite3',
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# Password validation
|
||||||
|
# https://docs.djangoproject.com/en/3.1/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.1/topics/i18n/
|
||||||
|
|
||||||
|
LANGUAGE_CODE = 'en-us'
|
||||||
|
|
||||||
|
TIME_ZONE = 'America/New_York'
|
||||||
|
|
||||||
|
USE_I18N = True
|
||||||
|
|
||||||
|
USE_L10N = True
|
||||||
|
|
||||||
|
USE_TZ = True
|
||||||
|
|
||||||
|
|
||||||
|
# Static files (CSS, JavaScript, Images)
|
||||||
|
# https://docs.djangoproject.com/en/3.1/howto/static-files/
|
||||||
|
|
||||||
|
STATIC_URL = '/static/'
|
||||||
|
STATICFILES_DIRS = (
|
||||||
|
os.path.join(BASE_DIR, 'static'),
|
||||||
|
)
|
28
config/urls.py
Normal file
28
config/urls.py
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
"""config URL Configuration
|
||||||
|
|
||||||
|
The `urlpatterns` list routes URLs to views. For more information please see:
|
||||||
|
https://docs.djangoproject.com/en/3.1/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 path
|
||||||
|
|
||||||
|
from pushup import views as pushup_views
|
||||||
|
from users import views as users_views
|
||||||
|
|
||||||
|
urlpatterns = [
|
||||||
|
path('admin/', admin.site.urls),
|
||||||
|
path('', pushup_views.home, name="home"),
|
||||||
|
path('login/', users_views.login, name="login"),
|
||||||
|
path('signup/', users_views.signup, name="signup"),
|
||||||
|
path('logout/', users_views.logout, name="logout")
|
||||||
|
]
|
16
config/wsgi.py
Normal file
16
config/wsgi.py
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
"""
|
||||||
|
WSGI config for config 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.1/howto/deployment/wsgi/
|
||||||
|
"""
|
||||||
|
|
||||||
|
import os
|
||||||
|
|
||||||
|
from django.core.wsgi import get_wsgi_application
|
||||||
|
|
||||||
|
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'config.settings')
|
||||||
|
|
||||||
|
application = get_wsgi_application()
|
25
manage.py
Executable file
25
manage.py
Executable file
|
@ -0,0 +1,25 @@
|
||||||
|
#!/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', 'config.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__':
|
||||||
|
|
||||||
|
from django_secrets.startup import check
|
||||||
|
check()
|
||||||
|
main()
|
1
my_secrets/.gitignore
vendored
Normal file
1
my_secrets/.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
secrets.py
|
0
my_secrets/__init__.py
Normal file
0
my_secrets/__init__.py
Normal file
11
my_secrets/definitions.py
Normal file
11
my_secrets/definitions.py
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
# coding=utf-8
|
||||||
|
|
||||||
|
# Add your secrets to this list and run manage.py to set their values.
|
||||||
|
# Use them in settings.py like this:
|
||||||
|
# from secrets import secrets
|
||||||
|
# SECRET_KEY = secrets.SECRET_KEY
|
||||||
|
|
||||||
|
SECRET_KEYS = [
|
||||||
|
# start with your Django secret key like this:
|
||||||
|
"SECRET_KEY",
|
||||||
|
]
|
0
pushup/__init__.py
Normal file
0
pushup/__init__.py
Normal file
5
pushup/admin.py
Normal file
5
pushup/admin.py
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
from django.contrib import admin
|
||||||
|
from .models import StockValue
|
||||||
|
|
||||||
|
# Register your models here.
|
||||||
|
admin.site.register(StockValue)
|
5
pushup/apps.py
Normal file
5
pushup/apps.py
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
from django.apps import AppConfig
|
||||||
|
|
||||||
|
|
||||||
|
class PushupConfig(AppConfig):
|
||||||
|
name = 'pushup'
|
22
pushup/migrations/0001_initial.py
Normal file
22
pushup/migrations/0001_initial.py
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
# Generated by Django 3.1.2 on 2020-10-19 03:38
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
initial = True
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='StockValue',
|
||||||
|
fields=[
|
||||||
|
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||||
|
('value', models.TextField()),
|
||||||
|
('time', models.DateTimeField(auto_now_add=True)),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
]
|
18
pushup/migrations/0002_auto_20201019_0341.py
Normal file
18
pushup/migrations/0002_auto_20201019_0341.py
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
# Generated by Django 3.1.2 on 2020-10-19 03:41
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('pushup', '0001_initial'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='stockvalue',
|
||||||
|
name='value',
|
||||||
|
field=models.DecimalField(decimal_places=3, max_digits=5),
|
||||||
|
),
|
||||||
|
]
|
20
pushup/migrations/0003_auto_20201019_0153.py
Normal file
20
pushup/migrations/0003_auto_20201019_0153.py
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
# Generated by Django 3.1.2 on 2020-10-19 05:53
|
||||||
|
|
||||||
|
import datetime
|
||||||
|
from django.db import migrations, models
|
||||||
|
from django.utils.timezone import utc
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('pushup', '0002_auto_20201019_0341'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='stockvalue',
|
||||||
|
name='time',
|
||||||
|
field=models.DateTimeField(default=datetime.datetime(2020, 10, 19, 5, 53, 55, 274646, tzinfo=utc)),
|
||||||
|
),
|
||||||
|
]
|
19
pushup/migrations/0004_auto_20201019_0156.py
Normal file
19
pushup/migrations/0004_auto_20201019_0156.py
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
# Generated by Django 3.1.2 on 2020-10-19 05:56
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
import pushup.models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('pushup', '0003_auto_20201019_0153'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='stockvalue',
|
||||||
|
name='time',
|
||||||
|
field=models.DateTimeField(default=pushup.models.get_time),
|
||||||
|
),
|
||||||
|
]
|
0
pushup/migrations/__init__.py
Normal file
0
pushup/migrations/__init__.py
Normal file
14
pushup/models.py
Normal file
14
pushup/models.py
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
from django.db import models
|
||||||
|
from django.utils import timezone
|
||||||
|
|
||||||
|
# Create your models here.
|
||||||
|
|
||||||
|
def get_time():
|
||||||
|
return timezone.localtime(timezone.now())
|
||||||
|
|
||||||
|
class StockValue(models.Model):
|
||||||
|
value = models.DecimalField(max_digits=5, decimal_places=3)
|
||||||
|
time = models.DateTimeField(default=get_time)
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return f"Price at {self.time}"
|
51
pushup/templates/pushup/base.html
Normal file
51
pushup/templates/pushup/base.html
Normal file
|
@ -0,0 +1,51 @@
|
||||||
|
{% load static %}
|
||||||
|
|
||||||
|
<!doctype html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<title>Pushup Contest</title>
|
||||||
|
<!-- Required meta tags -->
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||||
|
|
||||||
|
<!-- Bootstrap CSS -->
|
||||||
|
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
|
||||||
|
<link rel="stylesheet" href="{% static 'css/styles.css' %}">
|
||||||
|
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
|
||||||
|
<a class="navbar-brand" href="{% url 'home' %}">Push-Up Contest</a>
|
||||||
|
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav">
|
||||||
|
<span class="navbar-toggler-icon"></span>
|
||||||
|
</button>
|
||||||
|
<div class="collapse navbar-collapse" id="navbarNav">
|
||||||
|
<ul class="navbar-nav mr-auto"></ul>
|
||||||
|
<ul class="navbar-nav">
|
||||||
|
{% if user.is_authenticated %}
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" href="{% url 'logout' %}">Logout</a>
|
||||||
|
</li>
|
||||||
|
{% else %}
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" href="{% url 'login' %}">Login</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" href="{% url 'signup' %}">Signup</a>
|
||||||
|
</li>
|
||||||
|
{% endif %}
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
{% endblock content %}
|
||||||
|
|
||||||
|
<!-- Optional JavaScript -->
|
||||||
|
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
|
||||||
|
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
|
||||||
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
|
||||||
|
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
58
pushup/templates/pushup/index.html
Normal file
58
pushup/templates/pushup/index.html
Normal file
|
@ -0,0 +1,58 @@
|
||||||
|
{% extends 'pushup/base.html' %}
|
||||||
|
{% block content %}
|
||||||
|
|
||||||
|
<div class="row mt-md-3">
|
||||||
|
<div class="col-md">
|
||||||
|
<canvas id="stockChart"></canvas>
|
||||||
|
</div>
|
||||||
|
<div class="col-md">
|
||||||
|
<div class="content-section">
|
||||||
|
<h3>Leaderboard</h3>
|
||||||
|
<table class="table table-striped table-responsive">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th scope="col">#</th>
|
||||||
|
<th scope="col">Name</th>
|
||||||
|
<th scope="col">Push-Ups</th>
|
||||||
|
<tbody>
|
||||||
|
{% for profile in users %}
|
||||||
|
<tr>
|
||||||
|
<th scope="row">{{forloop.counter}}</th>
|
||||||
|
<td>{{profile.user.first_name}} {{profile.user.last_name}}</td>
|
||||||
|
<td>{{profile.pushups}}</td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/chart.js@2.9.3/dist/Chart.min.js"></script>
|
||||||
|
<script>
|
||||||
|
for (x in {{times|safe}}) {
|
||||||
|
console.log({{times|safe}}[x]);
|
||||||
|
}
|
||||||
|
|
||||||
|
var ctx = document.getElementById('stockChart').getContext('2d');
|
||||||
|
var chart = new Chart(ctx, {
|
||||||
|
// The type of chart we want to create
|
||||||
|
type: 'line',
|
||||||
|
|
||||||
|
// The data for our dataset
|
||||||
|
data: {
|
||||||
|
labels: {{times|safe}},
|
||||||
|
datasets: [{
|
||||||
|
label: 'My First dataset',
|
||||||
|
backgroundColor: 'rgb(255, 99, 132)',
|
||||||
|
borderColor: 'rgb(255, 99, 132)',
|
||||||
|
data: {{values|safe}}
|
||||||
|
}]
|
||||||
|
},
|
||||||
|
|
||||||
|
// Configuration options go here
|
||||||
|
options: {}
|
||||||
|
});
|
||||||
|
|
||||||
|
</script>
|
||||||
|
{% endblock content %}
|
3
pushup/tests.py
Normal file
3
pushup/tests.py
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
from django.test import TestCase
|
||||||
|
|
||||||
|
# Create your tests here.
|
28
pushup/views.py
Normal file
28
pushup/views.py
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
from django.shortcuts import render
|
||||||
|
|
||||||
|
from users.models import Profile
|
||||||
|
from .models import StockValue
|
||||||
|
|
||||||
|
import datetime
|
||||||
|
|
||||||
|
# Create your views here.
|
||||||
|
|
||||||
|
def home(request):
|
||||||
|
times = []
|
||||||
|
values = []
|
||||||
|
users = Profile.objects.order_by('-pushups')
|
||||||
|
print(users)
|
||||||
|
|
||||||
|
queryset = StockValue.objects.order_by('time')
|
||||||
|
for stock in queryset:
|
||||||
|
times.append(stock.time.strftime("%m-%d %I:%M%p"))
|
||||||
|
values.append(float(stock.value))
|
||||||
|
|
||||||
|
print(values)
|
||||||
|
context = {
|
||||||
|
'times': times,
|
||||||
|
'values': values,
|
||||||
|
'users': users,
|
||||||
|
}
|
||||||
|
|
||||||
|
return render(request, 'pushup/index.html', context=context)
|
17
requirements.txt
Normal file
17
requirements.txt
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
asgiref==3.2.10
|
||||||
|
astroid==2.4.2
|
||||||
|
Django==3.1.2
|
||||||
|
django-extensions==3.0.9
|
||||||
|
django-secrets==1.0.2
|
||||||
|
future==0.18.2
|
||||||
|
isort==5.6.4
|
||||||
|
lazy-object-proxy==1.4.3
|
||||||
|
mccabe==0.6.1
|
||||||
|
pylint==2.6.0
|
||||||
|
pytz==2020.1
|
||||||
|
six==1.15.0
|
||||||
|
sqlparse==0.4.1
|
||||||
|
toml==0.10.1
|
||||||
|
typed-ast==1.4.1
|
||||||
|
Werkzeug==1.0.1
|
||||||
|
wrapt==1.12.1
|
0
static/css/styles.css
Normal file
0
static/css/styles.css
Normal file
0
users/__init__.py
Normal file
0
users/__init__.py
Normal file
5
users/admin.py
Normal file
5
users/admin.py
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
from django.contrib import admin
|
||||||
|
from .models import Profile
|
||||||
|
|
||||||
|
# Register your models here.
|
||||||
|
admin.site.register(Profile)
|
5
users/apps.py
Normal file
5
users/apps.py
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
from django.apps import AppConfig
|
||||||
|
|
||||||
|
|
||||||
|
class UsersConfig(AppConfig):
|
||||||
|
name = 'users'
|
28
users/migrations/0001_initial.py
Normal file
28
users/migrations/0001_initial.py
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
# Generated by Django 3.1.2 on 2020-10-19 05:53
|
||||||
|
|
||||||
|
from django.conf import settings
|
||||||
|
from django.db import migrations, models
|
||||||
|
import django.db.models.deletion
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
initial = True
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='Profile',
|
||||||
|
fields=[
|
||||||
|
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||||
|
('key', models.TextField(max_length=20)),
|
||||||
|
('pushups', models.IntegerField(default=0)),
|
||||||
|
('isEnabled', models.BooleanField(default=False)),
|
||||||
|
('party', models.TextField(max_length=20)),
|
||||||
|
('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
]
|
18
users/migrations/0002_auto_20201019_0157.py
Normal file
18
users/migrations/0002_auto_20201019_0157.py
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
# Generated by Django 3.1.2 on 2020-10-19 05:57
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('users', '0001_initial'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='profile',
|
||||||
|
name='pushups',
|
||||||
|
field=models.PositiveSmallIntegerField(default=0),
|
||||||
|
),
|
||||||
|
]
|
0
users/migrations/__init__.py
Normal file
0
users/migrations/__init__.py
Normal file
14
users/models.py
Normal file
14
users/models.py
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
from django.db import models
|
||||||
|
from django.contrib.auth.models import User
|
||||||
|
|
||||||
|
# Create your models here.
|
||||||
|
|
||||||
|
class Profile(models.Model):
|
||||||
|
user = models.OneToOneField(User, on_delete=models.CASCADE)
|
||||||
|
key = models.TextField(max_length=20)
|
||||||
|
pushups = models.DecimalField(max_digits=5, decimal_places=3)
|
||||||
|
isEnabled = models.BooleanField(default=False)
|
||||||
|
party = models.TextField(max_length=20)
|
||||||
|
|
||||||
|
def __str__ (self):
|
||||||
|
return f"{self.user.username}'s Profile"
|
3
users/tests.py
Normal file
3
users/tests.py
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
from django.test import TestCase
|
||||||
|
|
||||||
|
# Create your tests here.
|
0
users/urls.py
Normal file
0
users/urls.py
Normal file
11
users/views.py
Normal file
11
users/views.py
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
from django.shortcuts import render
|
||||||
|
|
||||||
|
# Create your views here.
|
||||||
|
def login(request):
|
||||||
|
return None
|
||||||
|
|
||||||
|
def signup(request):
|
||||||
|
return None
|
||||||
|
|
||||||
|
def logout(request):
|
||||||
|
return None
|
Loading…
Reference in New Issue
Block a user