v2 initial commit
This commit is contained in:
10
.dockerignore
Normal file
10
.dockerignore
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
.editorconfig
|
||||||
|
.gitattributes
|
||||||
|
.github
|
||||||
|
.gitignore
|
||||||
|
.gitlab-ci.yml
|
||||||
|
.idea
|
||||||
|
.pre-commit-config.yaml
|
||||||
|
.readthedocs.yml
|
||||||
|
.travis.yml
|
||||||
|
venv
|
||||||
27
.editorconfig
Normal file
27
.editorconfig
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
# http://editorconfig.org
|
||||||
|
|
||||||
|
root = true
|
||||||
|
|
||||||
|
[*]
|
||||||
|
charset = utf-8
|
||||||
|
end_of_line = lf
|
||||||
|
insert_final_newline = true
|
||||||
|
trim_trailing_whitespace = true
|
||||||
|
|
||||||
|
[*.{py,rst,ini}]
|
||||||
|
indent_style = space
|
||||||
|
indent_size = 4
|
||||||
|
|
||||||
|
[*.{html,css,scss,json,yml,xml}]
|
||||||
|
indent_style = space
|
||||||
|
indent_size = 2
|
||||||
|
|
||||||
|
[*.md]
|
||||||
|
trim_trailing_whitespace = false
|
||||||
|
|
||||||
|
[Makefile]
|
||||||
|
indent_style = tab
|
||||||
|
|
||||||
|
[nginx.conf]
|
||||||
|
indent_style = space
|
||||||
|
indent_size = 2
|
||||||
1
.gitattributes
vendored
Normal file
1
.gitattributes
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
* text=auto
|
||||||
323
.gitignore
vendored
323
.gitignore
vendored
@@ -1,37 +1,15 @@
|
|||||||
# Django #
|
### Python template
|
||||||
*.log
|
# Byte-compiled / optimized / DLL files
|
||||||
*.pot
|
__pycache__/
|
||||||
*.pyc
|
|
||||||
__pycache__
|
|
||||||
*.sqlite3
|
|
||||||
media
|
|
||||||
/data
|
|
||||||
|
|
||||||
# Backup files #
|
|
||||||
*.bak
|
|
||||||
|
|
||||||
# If you are using PyCharm #
|
|
||||||
.idea/**/workspace.xml
|
|
||||||
.idea/**/tasks.xml
|
|
||||||
.idea/dictionaries
|
|
||||||
.idea/**/dataSources/
|
|
||||||
.idea/**/dataSources.ids
|
|
||||||
.idea/**/dataSources.xml
|
|
||||||
.idea/**/dataSources.local.xml
|
|
||||||
.idea/**/sqlDataSources.xml
|
|
||||||
.idea/**/dynamic.xml
|
|
||||||
.idea/**/uiDesigner.xml
|
|
||||||
.idea/**/gradle.xml
|
|
||||||
.idea/**/libraries
|
|
||||||
*.iws /out/
|
|
||||||
.idea/
|
|
||||||
|
|
||||||
# Python #
|
|
||||||
*.py[cod]
|
*.py[cod]
|
||||||
*$py.class
|
*$py.class
|
||||||
|
|
||||||
|
# C extensions
|
||||||
|
*.so
|
||||||
|
|
||||||
# Distribution / packaging
|
# Distribution / packaging
|
||||||
.Python build/
|
.Python
|
||||||
|
build/
|
||||||
develop-eggs/
|
develop-eggs/
|
||||||
dist/
|
dist/
|
||||||
downloads/
|
downloads/
|
||||||
@@ -46,6 +24,10 @@ wheels/
|
|||||||
*.egg-info/
|
*.egg-info/
|
||||||
.installed.cfg
|
.installed.cfg
|
||||||
*.egg
|
*.egg
|
||||||
|
|
||||||
|
# PyInstaller
|
||||||
|
# Usually these files are written by a python script from a template
|
||||||
|
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
||||||
*.manifest
|
*.manifest
|
||||||
*.spec
|
*.spec
|
||||||
|
|
||||||
@@ -59,29 +41,36 @@ htmlcov/
|
|||||||
.coverage
|
.coverage
|
||||||
.coverage.*
|
.coverage.*
|
||||||
.cache
|
.cache
|
||||||
.pytest_cache/
|
|
||||||
nosetests.xml
|
nosetests.xml
|
||||||
coverage.xml
|
coverage.xml
|
||||||
*.cover
|
*.cover
|
||||||
.hypothesis/
|
.hypothesis/
|
||||||
|
|
||||||
|
# Translations
|
||||||
|
*.mo
|
||||||
|
*.pot
|
||||||
|
|
||||||
|
# Django stuff:
|
||||||
|
staticfiles/
|
||||||
|
|
||||||
|
# Sphinx documentation
|
||||||
|
docs/_build/
|
||||||
|
|
||||||
|
# PyBuilder
|
||||||
|
target/
|
||||||
|
|
||||||
# pyenv
|
# pyenv
|
||||||
.python-version
|
.python-version
|
||||||
|
|
||||||
# celery
|
|
||||||
celerybeat-schedule.*
|
|
||||||
|
|
||||||
# SageMath parsed files
|
|
||||||
*.sage.py
|
|
||||||
|
|
||||||
# Environments
|
# Environments
|
||||||
.env
|
|
||||||
.venv
|
.venv
|
||||||
env/
|
|
||||||
venv/
|
venv/
|
||||||
ENV/
|
ENV/
|
||||||
env.bak/
|
|
||||||
venv.bak/
|
# Rope project settings
|
||||||
|
.ropeproject
|
||||||
|
|
||||||
# mkdocs documentation
|
# mkdocs documentation
|
||||||
/site
|
/site
|
||||||
@@ -89,7 +78,255 @@ venv.bak/
|
|||||||
# mypy
|
# mypy
|
||||||
.mypy_cache/
|
.mypy_cache/
|
||||||
|
|
||||||
scripts/
|
|
||||||
/.idea/benchcoach.iml
|
### Node template
|
||||||
/db_back.sqlite3
|
# Logs
|
||||||
/benchcoachproject/fixtures/minimal.json
|
logs
|
||||||
|
*.log
|
||||||
|
npm-debug.log*
|
||||||
|
yarn-debug.log*
|
||||||
|
yarn-error.log*
|
||||||
|
|
||||||
|
# Runtime data
|
||||||
|
pids
|
||||||
|
*.pid
|
||||||
|
*.seed
|
||||||
|
*.pid.lock
|
||||||
|
|
||||||
|
# Directory for instrumented libs generated by jscoverage/JSCover
|
||||||
|
lib-cov
|
||||||
|
|
||||||
|
# Coverage directory used by tools like istanbul
|
||||||
|
coverage
|
||||||
|
|
||||||
|
# nyc test coverage
|
||||||
|
.nyc_output
|
||||||
|
|
||||||
|
# Bower dependency directory (https://bower.io/)
|
||||||
|
bower_components
|
||||||
|
|
||||||
|
# node-waf configuration
|
||||||
|
.lock-wscript
|
||||||
|
|
||||||
|
# Compiled binary addons (http://nodejs.org/api/addons.html)
|
||||||
|
build/Release
|
||||||
|
|
||||||
|
# Dependency directories
|
||||||
|
node_modules/
|
||||||
|
jspm_packages/
|
||||||
|
|
||||||
|
# Typescript v1 declaration files
|
||||||
|
typings/
|
||||||
|
|
||||||
|
# Optional npm cache directory
|
||||||
|
.npm
|
||||||
|
|
||||||
|
# Optional eslint cache
|
||||||
|
.eslintcache
|
||||||
|
|
||||||
|
# Optional REPL history
|
||||||
|
.node_repl_history
|
||||||
|
|
||||||
|
# Output of 'npm pack'
|
||||||
|
*.tgz
|
||||||
|
|
||||||
|
# Yarn Integrity file
|
||||||
|
.yarn-integrity
|
||||||
|
|
||||||
|
|
||||||
|
### Linux template
|
||||||
|
*~
|
||||||
|
|
||||||
|
# temporary files which can be created if a process still has a handle open of a deleted file
|
||||||
|
.fuse_hidden*
|
||||||
|
|
||||||
|
# KDE directory preferences
|
||||||
|
.directory
|
||||||
|
|
||||||
|
# Linux trash folder which might appear on any partition or disk
|
||||||
|
.Trash-*
|
||||||
|
|
||||||
|
# .nfs files are created when an open file is removed but is still being accessed
|
||||||
|
.nfs*
|
||||||
|
|
||||||
|
|
||||||
|
### VisualStudioCode template
|
||||||
|
.vscode/*
|
||||||
|
!.vscode/settings.json
|
||||||
|
!.vscode/tasks.json
|
||||||
|
!.vscode/launch.json
|
||||||
|
!.vscode/extensions.json
|
||||||
|
*.code-workspace
|
||||||
|
|
||||||
|
# Local History for Visual Studio Code
|
||||||
|
.history/
|
||||||
|
|
||||||
|
|
||||||
|
# Provided default Pycharm Run/Debug Configurations should be tracked by git
|
||||||
|
# In case of local modifications made by Pycharm, use update-index command
|
||||||
|
# for each changed file, like this:
|
||||||
|
# git update-index --assume-unchanged .idea/benchcoach.iml
|
||||||
|
### JetBrains template
|
||||||
|
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
|
||||||
|
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
|
||||||
|
|
||||||
|
# User-specific stuff:
|
||||||
|
.idea/**/workspace.xml
|
||||||
|
.idea/**/tasks.xml
|
||||||
|
.idea/dictionaries
|
||||||
|
|
||||||
|
# Sensitive or high-churn files:
|
||||||
|
.idea/**/dataSources/
|
||||||
|
.idea/**/dataSources.ids
|
||||||
|
.idea/**/dataSources.xml
|
||||||
|
.idea/**/dataSources.local.xml
|
||||||
|
.idea/**/sqlDataSources.xml
|
||||||
|
.idea/**/dynamic.xml
|
||||||
|
.idea/**/uiDesigner.xml
|
||||||
|
|
||||||
|
# Gradle:
|
||||||
|
.idea/**/gradle.xml
|
||||||
|
.idea/**/libraries
|
||||||
|
|
||||||
|
# CMake
|
||||||
|
cmake-build-debug/
|
||||||
|
|
||||||
|
# Mongo Explorer plugin:
|
||||||
|
.idea/**/mongoSettings.xml
|
||||||
|
|
||||||
|
## File-based project format:
|
||||||
|
*.iws
|
||||||
|
|
||||||
|
## Plugin-specific files:
|
||||||
|
|
||||||
|
# IntelliJ
|
||||||
|
out/
|
||||||
|
|
||||||
|
# mpeltonen/sbt-idea plugin
|
||||||
|
.idea_modules/
|
||||||
|
|
||||||
|
# JIRA plugin
|
||||||
|
atlassian-ide-plugin.xml
|
||||||
|
|
||||||
|
# Cursive Clojure plugin
|
||||||
|
.idea/replstate.xml
|
||||||
|
|
||||||
|
# Crashlytics plugin (for Android Studio and IntelliJ)
|
||||||
|
com_crashlytics_export_strings.xml
|
||||||
|
crashlytics.properties
|
||||||
|
crashlytics-build.properties
|
||||||
|
fabric.properties
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Windows template
|
||||||
|
# Windows thumbnail cache files
|
||||||
|
Thumbs.db
|
||||||
|
ehthumbs.db
|
||||||
|
ehthumbs_vista.db
|
||||||
|
|
||||||
|
# Dump file
|
||||||
|
*.stackdump
|
||||||
|
|
||||||
|
# Folder config file
|
||||||
|
Desktop.ini
|
||||||
|
|
||||||
|
# Recycle Bin used on file shares
|
||||||
|
$RECYCLE.BIN/
|
||||||
|
|
||||||
|
# Windows Installer files
|
||||||
|
*.cab
|
||||||
|
*.msi
|
||||||
|
*.msm
|
||||||
|
*.msp
|
||||||
|
|
||||||
|
# Windows shortcuts
|
||||||
|
*.lnk
|
||||||
|
|
||||||
|
|
||||||
|
### macOS template
|
||||||
|
# General
|
||||||
|
*.DS_Store
|
||||||
|
.AppleDouble
|
||||||
|
.LSOverride
|
||||||
|
|
||||||
|
# Icon must end with two \r
|
||||||
|
Icon
|
||||||
|
|
||||||
|
# Thumbnails
|
||||||
|
._*
|
||||||
|
|
||||||
|
# Files that might appear in the root of a volume
|
||||||
|
.DocumentRevisions-V100
|
||||||
|
.fseventsd
|
||||||
|
.Spotlight-V100
|
||||||
|
.TemporaryItems
|
||||||
|
.Trashes
|
||||||
|
.VolumeIcon.icns
|
||||||
|
.com.apple.timemachine.donotpresent
|
||||||
|
|
||||||
|
# Directories potentially created on remote AFP share
|
||||||
|
.AppleDB
|
||||||
|
.AppleDesktop
|
||||||
|
Network Trash Folder
|
||||||
|
Temporary Items
|
||||||
|
.apdisk
|
||||||
|
|
||||||
|
|
||||||
|
### SublimeText template
|
||||||
|
# Cache files for Sublime Text
|
||||||
|
*.tmlanguage.cache
|
||||||
|
*.tmPreferences.cache
|
||||||
|
*.stTheme.cache
|
||||||
|
|
||||||
|
# Workspace files are user-specific
|
||||||
|
*.sublime-workspace
|
||||||
|
|
||||||
|
# Project files should be checked into the repository, unless a significant
|
||||||
|
# proportion of contributors will probably not be using Sublime Text
|
||||||
|
# *.sublime-project
|
||||||
|
|
||||||
|
# SFTP configuration file
|
||||||
|
sftp-config.json
|
||||||
|
|
||||||
|
# Package control specific files
|
||||||
|
Package Control.last-run
|
||||||
|
Package Control.ca-list
|
||||||
|
Package Control.ca-bundle
|
||||||
|
Package Control.system-ca-bundle
|
||||||
|
Package Control.cache/
|
||||||
|
Package Control.ca-certs/
|
||||||
|
Package Control.merged-ca-bundle
|
||||||
|
Package Control.user-ca-bundle
|
||||||
|
oscrypto-ca-bundle.crt
|
||||||
|
bh_unicode_properties.cache
|
||||||
|
|
||||||
|
# Sublime-github package stores a github token in this file
|
||||||
|
# https://packagecontrol.io/packages/sublime-github
|
||||||
|
GitHub.sublime-settings
|
||||||
|
|
||||||
|
|
||||||
|
### Vim template
|
||||||
|
# Swap
|
||||||
|
[._]*.s[a-v][a-z]
|
||||||
|
[._]*.sw[a-p]
|
||||||
|
[._]s[a-v][a-z]
|
||||||
|
[._]sw[a-p]
|
||||||
|
|
||||||
|
# Session
|
||||||
|
Session.vim
|
||||||
|
|
||||||
|
# Temporary
|
||||||
|
.netrwhist
|
||||||
|
|
||||||
|
# Auto-generated tag files
|
||||||
|
tags
|
||||||
|
|
||||||
|
### Project template
|
||||||
|
benchcoach/media/
|
||||||
|
|
||||||
|
.pytest_cache/
|
||||||
|
.ipython/
|
||||||
|
.env
|
||||||
|
.envs/*
|
||||||
|
/certs/
|
||||||
|
|||||||
98
.idea/.gitignore
generated
vendored
98
.idea/.gitignore
generated
vendored
@@ -1,90 +1,8 @@
|
|||||||
# Django #
|
# Default ignored files
|
||||||
*.log
|
/shelf/
|
||||||
*.pot
|
/workspace.xml
|
||||||
*.pyc
|
# Datasource local storage ignored files
|
||||||
__pycache__
|
/dataSources/
|
||||||
db.sqlite3
|
/dataSources.local.xml
|
||||||
media
|
# Editor-based HTTP Client requests
|
||||||
|
/httpRequests/
|
||||||
# Backup files #
|
|
||||||
*.bak
|
|
||||||
|
|
||||||
# If you are using PyCharm #
|
|
||||||
.idea/**/workspace.xml
|
|
||||||
.idea/**/tasks.xml
|
|
||||||
.idea/dictionaries
|
|
||||||
.idea/**/dataSources/
|
|
||||||
.idea/**/dataSources.ids
|
|
||||||
.idea/**/dataSources.xml
|
|
||||||
.idea/**/dataSources.local.xml
|
|
||||||
.idea/**/sqlDataSources.xml
|
|
||||||
.idea/**/dynamic.xml
|
|
||||||
.idea/**/uiDesigner.xml
|
|
||||||
.idea/**/gradle.xml
|
|
||||||
.idea/**/libraries
|
|
||||||
*.iws /out/
|
|
||||||
|
|
||||||
# Python #
|
|
||||||
*.py[cod]
|
|
||||||
*$py.class
|
|
||||||
|
|
||||||
# Distribution / packaging
|
|
||||||
.Python build/
|
|
||||||
develop-eggs/
|
|
||||||
dist/
|
|
||||||
downloads/
|
|
||||||
eggs/
|
|
||||||
.eggs/
|
|
||||||
lib/
|
|
||||||
lib64/
|
|
||||||
parts/
|
|
||||||
sdist/
|
|
||||||
var/
|
|
||||||
wheels/
|
|
||||||
*.egg-info/
|
|
||||||
.installed.cfg
|
|
||||||
*.egg
|
|
||||||
*.manifest
|
|
||||||
*.spec
|
|
||||||
|
|
||||||
# Installer logs
|
|
||||||
pip-log.txt
|
|
||||||
pip-delete-this-directory.txt
|
|
||||||
|
|
||||||
# Unit test / coverage reports
|
|
||||||
htmlcov/
|
|
||||||
.tox/
|
|
||||||
.coverage
|
|
||||||
.coverage.*
|
|
||||||
.cache
|
|
||||||
.pytest_cache/
|
|
||||||
nosetests.xml
|
|
||||||
coverage.xml
|
|
||||||
*.cover
|
|
||||||
.hypothesis/
|
|
||||||
|
|
||||||
# pyenv
|
|
||||||
.python-version
|
|
||||||
|
|
||||||
# celery
|
|
||||||
celerybeat-schedule.*
|
|
||||||
|
|
||||||
# SageMath parsed files
|
|
||||||
*.sage.py
|
|
||||||
|
|
||||||
# Environments
|
|
||||||
.env
|
|
||||||
.venv
|
|
||||||
env/
|
|
||||||
venv/
|
|
||||||
ENV/
|
|
||||||
env.bak/
|
|
||||||
venv.bak/
|
|
||||||
|
|
||||||
# mkdocs documentation
|
|
||||||
/site
|
|
||||||
|
|
||||||
# mypy
|
|
||||||
.mypy_cache/
|
|
||||||
|
|
||||||
scripts/
|
|
||||||
|
|||||||
45
.idea/benchcoach.iml
generated
Normal file
45
.idea/benchcoach.iml
generated
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module type="PYTHON_MODULE" version="4">
|
||||||
|
<component name="FacetManager">
|
||||||
|
<facet type="django" name="Django">
|
||||||
|
<configuration>
|
||||||
|
<option name="rootFolder" value="$MODULE_DIR$" />
|
||||||
|
<option name="settingsModule" value="config/settings/local.py" />
|
||||||
|
<option name="manageScript" value="manage.py" />
|
||||||
|
<option name="environment" value="<map> <entry> <string>USE_DOCKER</string> <string>yes</string> </entry> <entry> <string>DATABASE_URL</string> <string>postgres://postgres:debug@127.0.0.1:5432/benchcoach</string> </entry> </map>" />
|
||||||
|
<option name="doNotUseTestRunner" value="false" />
|
||||||
|
<option name="trackFilePattern" value="migrations" />
|
||||||
|
</configuration>
|
||||||
|
</facet>
|
||||||
|
</component>
|
||||||
|
<component name="NewModuleRootManager">
|
||||||
|
<content url="file://$MODULE_DIR$">
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/.envs/.local" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/.envs/.production" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/docs/_build" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/venv" />
|
||||||
|
</content>
|
||||||
|
<orderEntry type="jdk" jdkName="Python 3.9 (benchcoach) (2)" jdkType="Python SDK" />
|
||||||
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
|
</component>
|
||||||
|
<component name="PackageRequirementsSettings">
|
||||||
|
<option name="requirementsPath" value="$MODULE_DIR$/requirements/local.txt" />
|
||||||
|
</component>
|
||||||
|
<component name="PyDocumentationSettings">
|
||||||
|
<option name="renderExternalDocumentation" value="true" />
|
||||||
|
</component>
|
||||||
|
<component name="ReSTService">
|
||||||
|
<option name="DOC_DIR" value="$MODULE_DIR$/docs" />
|
||||||
|
</component>
|
||||||
|
<component name="TemplatesService">
|
||||||
|
<option name="TEMPLATE_CONFIGURATION" value="Django" />
|
||||||
|
<option name="TEMPLATE_FOLDERS">
|
||||||
|
<list>
|
||||||
|
<option value="$MODULE_DIR$/benchcoach/templates" />
|
||||||
|
</list>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
<component name="TestRunnerService">
|
||||||
|
<option name="PROJECT_TEST_RUNNER" value="pytest" />
|
||||||
|
</component>
|
||||||
|
</module>
|
||||||
16
.idea/inspectionProfiles/Project_Default.xml
generated
Normal file
16
.idea/inspectionProfiles/Project_Default.xml
generated
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
<component name="InspectionProjectProfileManager">
|
||||||
|
<profile version="1.0">
|
||||||
|
<option name="myName" value="Project Default" />
|
||||||
|
<inspection_tool class="Eslint" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||||
|
<inspection_tool class="PyPackageRequirementsInspection" enabled="true" level="WARNING" enabled_by_default="true">
|
||||||
|
<option name="ignoredPackages">
|
||||||
|
<value>
|
||||||
|
<list size="2">
|
||||||
|
<item index="0" class="java.lang.String" itemvalue="psycopg2" />
|
||||||
|
<item index="1" class="java.lang.String" itemvalue="django-bootstrap-v5" />
|
||||||
|
</list>
|
||||||
|
</value>
|
||||||
|
</option>
|
||||||
|
</inspection_tool>
|
||||||
|
</profile>
|
||||||
|
</component>
|
||||||
7
.idea/misc.xml
generated
Normal file
7
.idea/misc.xml
generated
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="JavaScriptSettings">
|
||||||
|
<option name="languageLevel" value="ES6" />
|
||||||
|
</component>
|
||||||
|
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.9 (benchcoach) (2)" project-jdk-type="Python SDK" />
|
||||||
|
</project>
|
||||||
8
.idea/modules.xml
generated
Normal file
8
.idea/modules.xml
generated
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ProjectModuleManager">
|
||||||
|
<modules>
|
||||||
|
<module fileurl="file://$PROJECT_DIR$/.idea/benchcoach.iml" filepath="$PROJECT_DIR$/.idea/benchcoach.iml" />
|
||||||
|
</modules>
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
16
.idea/runConfigurations/docker_compose_up_django.xml
generated
Normal file
16
.idea/runConfigurations/docker_compose_up_django.xml
generated
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
<component name="ProjectRunConfigurationManager">
|
||||||
|
<configuration name="docker-compose up django" type="docker-deploy" factoryName="docker-compose.yml" server-name="Docker">
|
||||||
|
<deployment type="docker-compose.yml">
|
||||||
|
<settings>
|
||||||
|
<option name="envFilePath" value=""/>
|
||||||
|
<option name="services">
|
||||||
|
<list>
|
||||||
|
<option value="django"/>
|
||||||
|
</list>
|
||||||
|
</option>
|
||||||
|
<option name="sourceFilePath" value="local.yml"/>
|
||||||
|
</settings>
|
||||||
|
</deployment>
|
||||||
|
<method v="2"/>
|
||||||
|
</configuration>
|
||||||
|
</component>
|
||||||
16
.idea/runConfigurations/docker_compose_up_docs.xml
generated
Normal file
16
.idea/runConfigurations/docker_compose_up_docs.xml
generated
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
<component name="ProjectRunConfigurationManager">
|
||||||
|
<configuration name="docker-compose up docs" type="docker-deploy" factoryName="docker-compose.yml" server-name="Docker">
|
||||||
|
<deployment type="docker-compose.yml">
|
||||||
|
<settings>
|
||||||
|
<option name="envFilePath" value=""/>
|
||||||
|
<option name="services">
|
||||||
|
<list>
|
||||||
|
<option value="docs"/>
|
||||||
|
</list>
|
||||||
|
</option>
|
||||||
|
<option name="sourceFilePath" value="local.yml"/>
|
||||||
|
</settings>
|
||||||
|
</deployment>
|
||||||
|
<method v="2"/>
|
||||||
|
</configuration>
|
||||||
|
</component>
|
||||||
21
.idea/runConfigurations/merge_production_dotenvs_in_dotenv.xml
generated
Normal file
21
.idea/runConfigurations/merge_production_dotenvs_in_dotenv.xml
generated
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
<component name="ProjectRunConfigurationManager">
|
||||||
|
<configuration default="false" name="merge_production_dotenvs_in_dotenv" type="PythonConfigurationType" factoryName="Python" singleton="true">
|
||||||
|
<module name="benchcoach" />
|
||||||
|
<option name="INTERPRETER_OPTIONS" value="" />
|
||||||
|
<option name="PARENT_ENVS" value="true" />
|
||||||
|
<envs>
|
||||||
|
<env name="PYTHONUNBUFFERED" value="1" />
|
||||||
|
</envs>
|
||||||
|
<option name="SDK_HOME" value="" />
|
||||||
|
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
|
||||||
|
<option name="IS_MODULE_SDK" value="true" />
|
||||||
|
<option name="ADD_CONTENT_ROOTS" value="true" />
|
||||||
|
<option name="ADD_SOURCE_ROOTS" value="true" />
|
||||||
|
<EXTENSION ID="PythonCoverageRunConfigurationExtension" enabled="false" sample_coverage="true" runner="coverage.py" />
|
||||||
|
<option name="SCRIPT_NAME" value="merge_production_dotenvs_in_dotenv.py" />
|
||||||
|
<option name="PARAMETERS" value="" />
|
||||||
|
<option name="SHOW_COMMAND_LINE" value="false" />
|
||||||
|
<option name="EMULATE_TERMINAL" value="false" />
|
||||||
|
<method />
|
||||||
|
</configuration>
|
||||||
|
</component>
|
||||||
32
.idea/runConfigurations/migrate.xml
generated
Normal file
32
.idea/runConfigurations/migrate.xml
generated
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
<component name="ProjectRunConfigurationManager">
|
||||||
|
<configuration default="false" name="migrate" type="Python.DjangoServer" factoryName="Django server" singleton="true">
|
||||||
|
<module name="benchcoach" />
|
||||||
|
<option name="INTERPRETER_OPTIONS" value="" />
|
||||||
|
<option name="PARENT_ENVS" value="true" />
|
||||||
|
<envs>
|
||||||
|
<env name="PYTHONUNBUFFERED" value="1" />
|
||||||
|
<env name="DJANGO_SETTINGS_MODULE" value="config.settings.local" />
|
||||||
|
</envs>
|
||||||
|
<option name="SDK_HOME" value="" />
|
||||||
|
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
|
||||||
|
<option name="IS_MODULE_SDK" value="true" />
|
||||||
|
<option name="ADD_CONTENT_ROOTS" value="true" />
|
||||||
|
<option name="ADD_SOURCE_ROOTS" value="true" />
|
||||||
|
<PathMappingSettings>
|
||||||
|
<option name="pathMappings">
|
||||||
|
<list>
|
||||||
|
<mapping local-root="$PROJECT_DIR$" remote-root="/app" />
|
||||||
|
</list>
|
||||||
|
</option>
|
||||||
|
</PathMappingSettings>
|
||||||
|
<option name="launchJavascriptDebuger" value="false" />
|
||||||
|
<option name="host" value="" />
|
||||||
|
<option name="additionalOptions" value="" />
|
||||||
|
<option name="browserUrl" value="" />
|
||||||
|
<option name="runTestServer" value="false" />
|
||||||
|
<option name="runNoReload" value="false" />
|
||||||
|
<option name="useCustomRunCommand" value="true" />
|
||||||
|
<option name="customRunCommand" value="migrate" />
|
||||||
|
<method />
|
||||||
|
</configuration>
|
||||||
|
</component>
|
||||||
25
.idea/runConfigurations/pytest___.xml
generated
Normal file
25
.idea/runConfigurations/pytest___.xml
generated
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
<component name="ProjectRunConfigurationManager">
|
||||||
|
<configuration default="false" name="pytest: ." type="tests" factoryName="py.test" singleton="true">
|
||||||
|
<module name="benchcoach" />
|
||||||
|
<option name="INTERPRETER_OPTIONS" value="" />
|
||||||
|
<option name="PARENT_ENVS" value="true" />
|
||||||
|
<option name="SDK_HOME" value="" />
|
||||||
|
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
|
||||||
|
<option name="IS_MODULE_SDK" value="true" />
|
||||||
|
<option name="ADD_CONTENT_ROOTS" value="true" />
|
||||||
|
<option name="ADD_SOURCE_ROOTS" value="true" />
|
||||||
|
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
|
||||||
|
<PathMappingSettings>
|
||||||
|
<option name="pathMappings">
|
||||||
|
<list>
|
||||||
|
<mapping local-root="$PROJECT_DIR$" remote-root="/app" />
|
||||||
|
</list>
|
||||||
|
</option>
|
||||||
|
</PathMappingSettings>
|
||||||
|
<option name="_new_keywords" value="""" />
|
||||||
|
<option name="_new_additionalArguments" value="""" />
|
||||||
|
<option name="_new_target" value=""."" />
|
||||||
|
<option name="_new_targetType" value=""PATH"" />
|
||||||
|
<method />
|
||||||
|
</configuration>
|
||||||
|
</component>
|
||||||
25
.idea/runConfigurations/pytest__users.xml
generated
Normal file
25
.idea/runConfigurations/pytest__users.xml
generated
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
<component name="ProjectRunConfigurationManager">
|
||||||
|
<configuration default="false" name="pytest: users" type="tests" factoryName="py.test" singleton="true">
|
||||||
|
<module name="benchcoach" />
|
||||||
|
<option name="INTERPRETER_OPTIONS" value="" />
|
||||||
|
<option name="PARENT_ENVS" value="true" />
|
||||||
|
<option name="SDK_HOME" value="" />
|
||||||
|
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
|
||||||
|
<option name="IS_MODULE_SDK" value="true" />
|
||||||
|
<option name="ADD_CONTENT_ROOTS" value="true" />
|
||||||
|
<option name="ADD_SOURCE_ROOTS" value="true" />
|
||||||
|
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
|
||||||
|
<PathMappingSettings>
|
||||||
|
<option name="pathMappings">
|
||||||
|
<list>
|
||||||
|
<mapping local-root="$PROJECT_DIR$" remote-root="/app" />
|
||||||
|
</list>
|
||||||
|
</option>
|
||||||
|
</PathMappingSettings>
|
||||||
|
<option name="_new_keywords" value="""" />
|
||||||
|
<option name="_new_additionalArguments" value="""" />
|
||||||
|
<option name="_new_target" value=""./benchcoach/users/"" />
|
||||||
|
<option name="_new_targetType" value=""PATH"" />
|
||||||
|
<method />
|
||||||
|
</configuration>
|
||||||
|
</component>
|
||||||
28
.idea/runConfigurations/runserver.xml
generated
Normal file
28
.idea/runConfigurations/runserver.xml
generated
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
<component name="ProjectRunConfigurationManager">
|
||||||
|
<configuration default="false" name="runserver" type="Python.DjangoServer" factoryName="Django server" singleton="true">
|
||||||
|
<module name="benchcoach" />
|
||||||
|
<option name="INTERPRETER_OPTIONS" value="" />
|
||||||
|
<option name="PARENT_ENVS" value="true" />
|
||||||
|
<envs>
|
||||||
|
<env name="PYTHONUNBUFFERED" value="1" />
|
||||||
|
<env name="DJANGO_SETTINGS_MODULE" value="config.settings.local" />
|
||||||
|
<env name="DATABASE_URL" value="postgres://postgres:debug@127.0.0.1:5432/benchcoach" />
|
||||||
|
<env name="USE_DOCKER" value="yes" />
|
||||||
|
</envs>
|
||||||
|
<option name="SDK_HOME" value="" />
|
||||||
|
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
|
||||||
|
<option name="IS_MODULE_SDK" value="true" />
|
||||||
|
<option name="ADD_CONTENT_ROOTS" value="true" />
|
||||||
|
<option name="ADD_SOURCE_ROOTS" value="true" />
|
||||||
|
<option name="launchJavascriptDebuger" value="false" />
|
||||||
|
<option name="port" value="8000" />
|
||||||
|
<option name="host" value="0.0.0.0" />
|
||||||
|
<option name="additionalOptions" value="" />
|
||||||
|
<option name="browserUrl" value="" />
|
||||||
|
<option name="runTestServer" value="false" />
|
||||||
|
<option name="runNoReload" value="false" />
|
||||||
|
<option name="useCustomRunCommand" value="false" />
|
||||||
|
<option name="customRunCommand" value="" />
|
||||||
|
<method v="2" />
|
||||||
|
</configuration>
|
||||||
|
</component>
|
||||||
28
.idea/runConfigurations/runserver_plus.xml
generated
Normal file
28
.idea/runConfigurations/runserver_plus.xml
generated
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
<component name="ProjectRunConfigurationManager">
|
||||||
|
<configuration default="false" name="runserver_plus" type="Python.DjangoServer" factoryName="Django server" singleton="true">
|
||||||
|
<module name="benchcoach" />
|
||||||
|
<option name="INTERPRETER_OPTIONS" value="" />
|
||||||
|
<option name="PARENT_ENVS" value="true" />
|
||||||
|
<envs>
|
||||||
|
<env name="PYTHONUNBUFFERED" value="1" />
|
||||||
|
<env name="DJANGO_SETTINGS_MODULE" value="config.settings.local" />
|
||||||
|
<env name="DATABASE_URL" value="postgres://postgres:debug@127.0.0.1:5432/benchcoach" />
|
||||||
|
<env name="USE_DOCKER" value="yes" />
|
||||||
|
</envs>
|
||||||
|
<option name="SDK_HOME" value="" />
|
||||||
|
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
|
||||||
|
<option name="IS_MODULE_SDK" value="true" />
|
||||||
|
<option name="ADD_CONTENT_ROOTS" value="true" />
|
||||||
|
<option name="ADD_SOURCE_ROOTS" value="true" />
|
||||||
|
<option name="launchJavascriptDebuger" value="false" />
|
||||||
|
<option name="port" value="8000" />
|
||||||
|
<option name="host" value="127.0.0.1" />
|
||||||
|
<option name="additionalOptions" value="--cert-file ./certs/benchcoach.ascorrea.com+4.pem --key-file certs/benchcoach.ascorrea.com+4-key.pem" />
|
||||||
|
<option name="browserUrl" value="https://127.0.0.1:8000/" />
|
||||||
|
<option name="runTestServer" value="false" />
|
||||||
|
<option name="runNoReload" value="false" />
|
||||||
|
<option name="useCustomRunCommand" value="true" />
|
||||||
|
<option name="customRunCommand" value="runserver_plus" />
|
||||||
|
<method v="2" />
|
||||||
|
</configuration>
|
||||||
|
</component>
|
||||||
6
.idea/vcs.xml
generated
Normal file
6
.idea/vcs.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="VcsDirectoryMappings">
|
||||||
|
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
14
.idea/webResources.xml
generated
Normal file
14
.idea/webResources.xml
generated
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="WebResourcesPaths">
|
||||||
|
<contentEntries>
|
||||||
|
<entry url="file://$PROJECT_DIR$">
|
||||||
|
<entryData>
|
||||||
|
<resourceRoots>
|
||||||
|
<path value="file://$PROJECT_DIR$/benchcoach/static" />
|
||||||
|
</resourceRoots>
|
||||||
|
</entryData>
|
||||||
|
</entry>
|
||||||
|
</contentEntries>
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
39
.pre-commit-config.yaml
Normal file
39
.pre-commit-config.yaml
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
exclude: "^docs/|/migrations/"
|
||||||
|
default_stages: [commit]
|
||||||
|
|
||||||
|
repos:
|
||||||
|
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||||
|
rev: v4.2.0
|
||||||
|
hooks:
|
||||||
|
- id: trailing-whitespace
|
||||||
|
- id: end-of-file-fixer
|
||||||
|
- id: check-yaml
|
||||||
|
|
||||||
|
- repo: https://github.com/asottile/pyupgrade
|
||||||
|
rev: v2.32.1
|
||||||
|
hooks:
|
||||||
|
- id: pyupgrade
|
||||||
|
args: [--py39-plus]
|
||||||
|
|
||||||
|
- repo: https://github.com/psf/black
|
||||||
|
rev: 22.3.0
|
||||||
|
hooks:
|
||||||
|
- id: black
|
||||||
|
|
||||||
|
- repo: https://github.com/PyCQA/isort
|
||||||
|
rev: 5.10.1
|
||||||
|
hooks:
|
||||||
|
- id: isort
|
||||||
|
|
||||||
|
- repo: https://github.com/PyCQA/flake8
|
||||||
|
rev: 4.0.1
|
||||||
|
hooks:
|
||||||
|
- id: flake8
|
||||||
|
args: ["--config=setup.cfg"]
|
||||||
|
additional_dependencies: [flake8-isort]
|
||||||
|
|
||||||
|
# sets up .pre-commit-ci.yaml to ensure pre-commit dependencies stay up to date
|
||||||
|
ci:
|
||||||
|
autoupdate_schedule: weekly
|
||||||
|
skip: []
|
||||||
|
submodules: false
|
||||||
14
.pylintrc
Normal file
14
.pylintrc
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
[MASTER]
|
||||||
|
load-plugins=pylint_django
|
||||||
|
django-settings-module=config.settings.base
|
||||||
|
[FORMAT]
|
||||||
|
max-line-length=120
|
||||||
|
|
||||||
|
[MESSAGES CONTROL]
|
||||||
|
disable=missing-docstring,invalid-name
|
||||||
|
|
||||||
|
[DESIGN]
|
||||||
|
max-parents=13
|
||||||
|
|
||||||
|
[TYPECHECK]
|
||||||
|
generated-members=REQUEST,acl_users,aq_parent,"[a-zA-Z]+_set{1,2}",save,delete
|
||||||
12
.readthedocs.yml
Normal file
12
.readthedocs.yml
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
version: 2
|
||||||
|
|
||||||
|
sphinx:
|
||||||
|
configuration: docs/conf.py
|
||||||
|
|
||||||
|
build:
|
||||||
|
image: testing
|
||||||
|
|
||||||
|
python:
|
||||||
|
version: 3.9
|
||||||
|
install:
|
||||||
|
- requirements: requirements/local.txt
|
||||||
1
CONTRIBUTORS.txt
Normal file
1
CONTRIBUTORS.txt
Normal file
@@ -0,0 +1 @@
|
|||||||
|
Anthony Correa
|
||||||
9
LICENSE
Normal file
9
LICENSE
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
|
||||||
|
The MIT License (MIT)
|
||||||
|
Copyright (c) 2022, Anthony Correa
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
54
README.md
Normal file
54
README.md
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
# BenchCoach
|
||||||
|
|
||||||
|
An assistant coach for TeamSnap
|
||||||
|
|
||||||
|
[](https://github.com/cookiecutter/cookiecutter-django/)
|
||||||
|
[](https://github.com/ambv/black)
|
||||||
|
|
||||||
|
License: MIT
|
||||||
|
|
||||||
|
## Settings
|
||||||
|
|
||||||
|
Moved to [settings](http://cookiecutter-django.readthedocs.io/en/latest/settings.html).
|
||||||
|
|
||||||
|
## Basic Commands
|
||||||
|
|
||||||
|
### Setting Up Your Users
|
||||||
|
|
||||||
|
- To create a **normal user account**, just go to Sign Up and fill out the form. Once you submit it, you'll see a "Verify Your E-mail Address" page. Go to your console to see a simulated email verification message. Copy the link into your browser. Now the user's email should be verified and ready to go.
|
||||||
|
|
||||||
|
- To create a **superuser account**, use this command:
|
||||||
|
|
||||||
|
$ python manage.py createsuperuser
|
||||||
|
|
||||||
|
For convenience, you can keep your normal user logged in on Chrome and your superuser logged in on Firefox (or similar), so that you can see how the site behaves for both kinds of users.
|
||||||
|
|
||||||
|
### Type checks
|
||||||
|
|
||||||
|
Running type checks with mypy:
|
||||||
|
|
||||||
|
$ mypy benchcoach
|
||||||
|
|
||||||
|
### Test coverage
|
||||||
|
|
||||||
|
To run the tests, check your test coverage, and generate an HTML coverage report:
|
||||||
|
|
||||||
|
$ coverage run -m pytest
|
||||||
|
$ coverage html
|
||||||
|
$ open htmlcov/index.html
|
||||||
|
|
||||||
|
#### Running tests with pytest
|
||||||
|
|
||||||
|
$ pytest
|
||||||
|
|
||||||
|
### Live reloading and Sass CSS compilation
|
||||||
|
|
||||||
|
Moved to [Live reloading and SASS compilation](https://cookiecutter-django.readthedocs.io/en/latest/developing-locally.html#sass-compilation-live-reloading).
|
||||||
|
|
||||||
|
## Deployment
|
||||||
|
|
||||||
|
The following details how to deploy this application.
|
||||||
|
|
||||||
|
### Docker
|
||||||
|
|
||||||
|
See detailed [cookiecutter-django Docker documentation](http://cookiecutter-django.readthedocs.io/en/latest/deployment-with-docker.html).
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
__version__ = "0.1.0"
|
||||||
|
__version_info__ = tuple(
|
||||||
|
int(num) if num.isdigit() else num
|
||||||
|
for num in __version__.replace("-", ".", 1).split(".")
|
||||||
|
)
|
||||||
|
|||||||
@@ -1,11 +0,0 @@
|
|||||||
from django.contrib import admin
|
|
||||||
from .models import Event, Availability, Positioning, Team, Venue, Player, StatLine
|
|
||||||
|
|
||||||
# Register your models here.
|
|
||||||
admin.site.register(Event)
|
|
||||||
admin.site.register(Availability)
|
|
||||||
admin.site.register(Positioning)
|
|
||||||
admin.site.register(Team)
|
|
||||||
admin.site.register(Venue)
|
|
||||||
admin.site.register(Player)
|
|
||||||
admin.site.register(StatLine)
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
from django.apps import AppConfig
|
|
||||||
|
|
||||||
|
|
||||||
class BenchcoachConfig(AppConfig):
|
|
||||||
default_auto_field = 'django.db.models.BigAutoField'
|
|
||||||
name = 'benchcoach'
|
|
||||||
14
benchcoach/conftest.py
Normal file
14
benchcoach/conftest.py
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
import pytest
|
||||||
|
|
||||||
|
from benchcoach.users.models import User
|
||||||
|
from benchcoach.users.tests.factories import UserFactory
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture(autouse=True)
|
||||||
|
def media_storage(settings, tmpdir):
|
||||||
|
settings.MEDIA_ROOT = tmpdir.strpath
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture
|
||||||
|
def user() -> User:
|
||||||
|
return UserFactory()
|
||||||
5
benchcoach/contrib/__init__.py
Normal file
5
benchcoach/contrib/__init__.py
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
"""
|
||||||
|
To understand why this file is here, please read:
|
||||||
|
|
||||||
|
http://cookiecutter-django.readthedocs.io/en/latest/faq.html#why-is-there-a-django-contrib-sites-directory-in-cookiecutter-django
|
||||||
|
"""
|
||||||
5
benchcoach/contrib/sites/__init__.py
Normal file
5
benchcoach/contrib/sites/__init__.py
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
"""
|
||||||
|
To understand why this file is here, please read:
|
||||||
|
|
||||||
|
http://cookiecutter-django.readthedocs.io/en/latest/faq.html#why-is-there-a-django-contrib-sites-directory-in-cookiecutter-django
|
||||||
|
"""
|
||||||
42
benchcoach/contrib/sites/migrations/0001_initial.py
Normal file
42
benchcoach/contrib/sites/migrations/0001_initial.py
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
import django.contrib.sites.models
|
||||||
|
from django.contrib.sites.models import _simple_domain_name_validator
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = []
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.CreateModel(
|
||||||
|
name="Site",
|
||||||
|
fields=[
|
||||||
|
(
|
||||||
|
"id",
|
||||||
|
models.AutoField(
|
||||||
|
verbose_name="ID",
|
||||||
|
serialize=False,
|
||||||
|
auto_created=True,
|
||||||
|
primary_key=True,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"domain",
|
||||||
|
models.CharField(
|
||||||
|
max_length=100,
|
||||||
|
verbose_name="domain name",
|
||||||
|
validators=[_simple_domain_name_validator],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
("name", models.CharField(max_length=50, verbose_name="display name")),
|
||||||
|
],
|
||||||
|
options={
|
||||||
|
"ordering": ("domain",),
|
||||||
|
"db_table": "django_site",
|
||||||
|
"verbose_name": "site",
|
||||||
|
"verbose_name_plural": "sites",
|
||||||
|
},
|
||||||
|
bases=(models.Model,),
|
||||||
|
managers=[("objects", django.contrib.sites.models.SiteManager())],
|
||||||
|
)
|
||||||
|
]
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
import django.contrib.sites.models
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [("sites", "0001_initial")]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="site",
|
||||||
|
name="domain",
|
||||||
|
field=models.CharField(
|
||||||
|
max_length=100,
|
||||||
|
unique=True,
|
||||||
|
validators=[django.contrib.sites.models._simple_domain_name_validator],
|
||||||
|
verbose_name="domain name",
|
||||||
|
),
|
||||||
|
)
|
||||||
|
]
|
||||||
@@ -0,0 +1,63 @@
|
|||||||
|
"""
|
||||||
|
To understand why this file is here, please read:
|
||||||
|
|
||||||
|
http://cookiecutter-django.readthedocs.io/en/latest/faq.html#why-is-there-a-django-contrib-sites-directory-in-cookiecutter-django
|
||||||
|
"""
|
||||||
|
from django.conf import settings
|
||||||
|
from django.db import migrations
|
||||||
|
|
||||||
|
|
||||||
|
def _update_or_create_site_with_sequence(site_model, connection, domain, name):
|
||||||
|
"""Update or create the site with default ID and keep the DB sequence in sync."""
|
||||||
|
site, created = site_model.objects.update_or_create(
|
||||||
|
id=settings.SITE_ID,
|
||||||
|
defaults={
|
||||||
|
"domain": domain,
|
||||||
|
"name": name,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
if created:
|
||||||
|
# We provided the ID explicitly when creating the Site entry, therefore the DB
|
||||||
|
# sequence to auto-generate them wasn't used and is now out of sync. If we
|
||||||
|
# don't do anything, we'll get a unique constraint violation the next time a
|
||||||
|
# site is created.
|
||||||
|
# To avoid this, we need to manually update DB sequence and make sure it's
|
||||||
|
# greater than the maximum value.
|
||||||
|
max_id = site_model.objects.order_by('-id').first().id
|
||||||
|
with connection.cursor() as cursor:
|
||||||
|
cursor.execute("SELECT last_value from django_site_id_seq")
|
||||||
|
(current_id,) = cursor.fetchone()
|
||||||
|
if current_id <= max_id:
|
||||||
|
cursor.execute(
|
||||||
|
"alter sequence django_site_id_seq restart with %s",
|
||||||
|
[max_id + 1],
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def update_site_forward(apps, schema_editor):
|
||||||
|
"""Set site domain and name."""
|
||||||
|
Site = apps.get_model("sites", "Site")
|
||||||
|
_update_or_create_site_with_sequence(
|
||||||
|
Site,
|
||||||
|
schema_editor.connection,
|
||||||
|
"benchcoach.ascorrea.com",
|
||||||
|
"BenchCoach",
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def update_site_backward(apps, schema_editor):
|
||||||
|
"""Revert site domain and name to default."""
|
||||||
|
Site = apps.get_model("sites", "Site")
|
||||||
|
_update_or_create_site_with_sequence(
|
||||||
|
Site,
|
||||||
|
schema_editor.connection,
|
||||||
|
"example.com",
|
||||||
|
"example.com",
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [("sites", "0002_alter_domain_unique")]
|
||||||
|
|
||||||
|
operations = [migrations.RunPython(update_site_forward, update_site_backward)]
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
# Generated by Django 3.1.7 on 2021-02-04 14:49
|
||||||
|
|
||||||
|
from django.db import migrations
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
("sites", "0003_set_site_domain_and_name"),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterModelOptions(
|
||||||
|
name="site",
|
||||||
|
options={
|
||||||
|
"ordering": ["domain"],
|
||||||
|
"verbose_name": "site",
|
||||||
|
"verbose_name_plural": "sites",
|
||||||
|
},
|
||||||
|
),
|
||||||
|
]
|
||||||
5
benchcoach/contrib/sites/migrations/__init__.py
Normal file
5
benchcoach/contrib/sites/migrations/__init__.py
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
"""
|
||||||
|
To understand why this file is here, please read:
|
||||||
|
|
||||||
|
http://cookiecutter-django.readthedocs.io/en/latest/faq.html#why-is-there-a-django-contrib-sites-directory-in-cookiecutter-django
|
||||||
|
"""
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -1,60 +0,0 @@
|
|||||||
from django import forms
|
|
||||||
from .models import Event, Positioning, Team, Venue, Player
|
|
||||||
from teamsnap.models import Event as TeamsnapEvent
|
|
||||||
from django.forms import modelformset_factory
|
|
||||||
|
|
||||||
class EventForm(forms.ModelForm):
|
|
||||||
class Meta:
|
|
||||||
model = Event
|
|
||||||
fields = ['start', 'home_team', 'away_team', 'venue']
|
|
||||||
class PositioningForm(forms.ModelForm):
|
|
||||||
availability = None
|
|
||||||
class Meta:
|
|
||||||
model = Positioning
|
|
||||||
widgets = {
|
|
||||||
'position': forms.Select(attrs={'class': 'form-control form-control-sm', 'onchange':'positionSelectChanged(this)'})
|
|
||||||
}
|
|
||||||
exclude = ()
|
|
||||||
|
|
||||||
PositioningFormSet = modelformset_factory(
|
|
||||||
model=Positioning,
|
|
||||||
form=PositioningForm,
|
|
||||||
# fields=['order', 'position','player'],
|
|
||||||
# min_num=9,
|
|
||||||
extra=0
|
|
||||||
)
|
|
||||||
|
|
||||||
class TeamsnapEventForm(forms.ModelForm):
|
|
||||||
def __init__(self, *args, **kwargs):
|
|
||||||
super(TeamsnapEventForm, self).__init__(*args, **kwargs)
|
|
||||||
if self.instance and self.instance.teamsnap_event.first():
|
|
||||||
initial = (self.instance.teamsnap_event.first().id, self.instance.teamsnap_event.first())
|
|
||||||
else:
|
|
||||||
initial = None
|
|
||||||
self.fields = {}
|
|
||||||
choices = [("","-----")]
|
|
||||||
choices += [(choice.id, choice) for choice in TeamsnapEvent.objects.all()]
|
|
||||||
self.fields['teamsnap event'] = forms.MultipleChoiceField(
|
|
||||||
widget=forms.Select(attrs={'class': 'form-control'}),
|
|
||||||
choices=choices,
|
|
||||||
initial=initial
|
|
||||||
)
|
|
||||||
|
|
||||||
class Meta:
|
|
||||||
model = Event
|
|
||||||
fields = ['start', 'home_team', 'away_team', 'venue']
|
|
||||||
|
|
||||||
class PlayerForm(forms.ModelForm):
|
|
||||||
class Meta:
|
|
||||||
model = Player
|
|
||||||
fields = ['first_name', 'last_name', 'jersey_number', 'team']
|
|
||||||
|
|
||||||
class TeamForm(forms.ModelForm):
|
|
||||||
class Meta:
|
|
||||||
model = Team
|
|
||||||
fields = ['name']
|
|
||||||
|
|
||||||
class VenueForm(forms.ModelForm):
|
|
||||||
class Meta:
|
|
||||||
model = Venue
|
|
||||||
fields = ['name']
|
|
||||||
@@ -1,102 +0,0 @@
|
|||||||
# Generated by Django 3.2.6 on 2021-12-17 21:33
|
|
||||||
|
|
||||||
import django.core.validators
|
|
||||||
from django.db import migrations, models
|
|
||||||
import django.db.models.deletion
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
|
||||||
|
|
||||||
initial = True
|
|
||||||
|
|
||||||
dependencies = [
|
|
||||||
]
|
|
||||||
|
|
||||||
operations = [
|
|
||||||
migrations.CreateModel(
|
|
||||||
name='Player',
|
|
||||||
fields=[
|
|
||||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
|
||||||
('first_name', models.CharField(max_length=200)),
|
|
||||||
('last_name', models.CharField(max_length=200)),
|
|
||||||
('jersey_number', models.IntegerField()),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
migrations.CreateModel(
|
|
||||||
name='Season',
|
|
||||||
fields=[
|
|
||||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
|
||||||
('name', models.CharField(max_length=50)),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
migrations.CreateModel(
|
|
||||||
name='Team',
|
|
||||||
fields=[
|
|
||||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
|
||||||
('name', models.CharField(max_length=50)),
|
|
||||||
('image', models.FileField(null=True, upload_to='images/', validators=[django.core.validators.FileExtensionValidator(['jpg', 'png', 'svg'])])),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
migrations.CreateModel(
|
|
||||||
name='Venue',
|
|
||||||
fields=[
|
|
||||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
|
||||||
('name', models.CharField(max_length=50)),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
migrations.CreateModel(
|
|
||||||
name='StatLine',
|
|
||||||
fields=[
|
|
||||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
|
||||||
('batting_avg', models.DecimalField(decimal_places=3, default=0, max_digits=4)),
|
|
||||||
('onbase_pct', models.DecimalField(decimal_places=3, default=0, max_digits=4)),
|
|
||||||
('slugging_pct', models.DecimalField(decimal_places=3, default=0, max_digits=4)),
|
|
||||||
('player', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='benchcoach.player')),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
migrations.AddField(
|
|
||||||
model_name='player',
|
|
||||||
name='team',
|
|
||||||
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='benchcoach.team'),
|
|
||||||
),
|
|
||||||
migrations.CreateModel(
|
|
||||||
name='Event',
|
|
||||||
fields=[
|
|
||||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
|
||||||
('start', models.DateTimeField(null=True)),
|
|
||||||
('away_team', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='away_team', to='benchcoach.team')),
|
|
||||||
('home_team', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='home_team', to='benchcoach.team')),
|
|
||||||
('venue', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='benchcoach.venue')),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
migrations.CreateModel(
|
|
||||||
name='Positioning',
|
|
||||||
fields=[
|
|
||||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
|
||||||
('position', models.CharField(blank=True, choices=[('EH', 'EH'), ('P', 'P'), ('C', 'C'), ('1B', '1B'), ('2B', '2B'), ('3B', '3B'), ('SS', 'SS'), ('LF', 'LF'), ('CF', 'CF'), ('RF', 'RF'), ('DH', 'DH')], default=None, max_length=2, null=True)),
|
|
||||||
('order', models.PositiveSmallIntegerField(blank=True, default=None, null=True)),
|
|
||||||
('event', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='benchcoach.event')),
|
|
||||||
('player', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='benchcoach.player')),
|
|
||||||
],
|
|
||||||
options={
|
|
||||||
'unique_together': {('player', 'event')},
|
|
||||||
},
|
|
||||||
),
|
|
||||||
migrations.AlterUniqueTogether(
|
|
||||||
name='player',
|
|
||||||
unique_together={('first_name', 'last_name')},
|
|
||||||
),
|
|
||||||
migrations.CreateModel(
|
|
||||||
name='Availability',
|
|
||||||
fields=[
|
|
||||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
|
||||||
('available', models.IntegerField(choices=[(2, 'Yes'), (0, 'No'), (1, 'Maybe'), (-1, 'Unknown')], default=-1)),
|
|
||||||
('event', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='benchcoach.event')),
|
|
||||||
('player', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='benchcoach.player')),
|
|
||||||
],
|
|
||||||
options={
|
|
||||||
'verbose_name_plural': 'availabilities',
|
|
||||||
'unique_together': {('event', 'player')},
|
|
||||||
},
|
|
||||||
),
|
|
||||||
]
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
# Generated by Django 3.2.6 on 2021-12-19 01:22
|
|
||||||
|
|
||||||
from django.db import migrations, models
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
|
||||||
|
|
||||||
dependencies = [
|
|
||||||
('benchcoach', '0001_initial'),
|
|
||||||
]
|
|
||||||
|
|
||||||
operations = [
|
|
||||||
migrations.AlterField(
|
|
||||||
model_name='player',
|
|
||||||
name='jersey_number',
|
|
||||||
field=models.IntegerField(null=True),
|
|
||||||
),
|
|
||||||
]
|
|
||||||
@@ -1,133 +0,0 @@
|
|||||||
from django.db import models
|
|
||||||
from django.core.validators import FileExtensionValidator
|
|
||||||
|
|
||||||
class BenchcoachModel(models.Model):
|
|
||||||
pass
|
|
||||||
|
|
||||||
class Meta:
|
|
||||||
abstract = True
|
|
||||||
|
|
||||||
class Team(BenchcoachModel):
|
|
||||||
name = models.CharField(max_length=50)
|
|
||||||
image = models.FileField(
|
|
||||||
upload_to="images/",
|
|
||||||
validators=[FileExtensionValidator(["jpg", "png", "svg"])],
|
|
||||||
null=True,
|
|
||||||
)
|
|
||||||
|
|
||||||
def __str__(self):
|
|
||||||
return f"{self.name}"
|
|
||||||
|
|
||||||
|
|
||||||
class Venue(BenchcoachModel):
|
|
||||||
name = models.CharField(max_length=50)
|
|
||||||
|
|
||||||
def __str__(self):
|
|
||||||
return f"{self.name}"
|
|
||||||
|
|
||||||
|
|
||||||
class Event(BenchcoachModel):
|
|
||||||
start = models.DateTimeField(null=True)
|
|
||||||
venue = models.ForeignKey(Venue, null=True, on_delete=models.CASCADE)
|
|
||||||
home_team = models.ForeignKey(
|
|
||||||
Team, null=True, on_delete=models.CASCADE, related_name="home_team"
|
|
||||||
)
|
|
||||||
away_team = models.ForeignKey(
|
|
||||||
Team, null=True, on_delete=models.CASCADE, related_name="away_team"
|
|
||||||
)
|
|
||||||
|
|
||||||
def __str__(self):
|
|
||||||
return f"{self.start:%Y-%m-%d %H:%M}"
|
|
||||||
|
|
||||||
|
|
||||||
class Season(BenchcoachModel):
|
|
||||||
name = models.CharField(max_length=50)
|
|
||||||
|
|
||||||
|
|
||||||
class Player(BenchcoachModel):
|
|
||||||
first_name = models.CharField(max_length=200)
|
|
||||||
last_name = models.CharField(max_length=200)
|
|
||||||
jersey_number = models.IntegerField(null=True)
|
|
||||||
team = models.ForeignKey(Team, null=True, on_delete=models.CASCADE)
|
|
||||||
|
|
||||||
def __str__(self):
|
|
||||||
return f"{self.last_name}, {self.first_name}"
|
|
||||||
|
|
||||||
class Meta:
|
|
||||||
unique_together = (
|
|
||||||
"first_name",
|
|
||||||
"last_name",
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class StatLine(BenchcoachModel):
|
|
||||||
player = models.ForeignKey(Player, on_delete=models.CASCADE)
|
|
||||||
batting_avg = models.DecimalField(max_digits=4, decimal_places=3, default=0)
|
|
||||||
onbase_pct = models.DecimalField(max_digits=4, decimal_places=3, default=0)
|
|
||||||
slugging_pct = models.DecimalField(max_digits=4, decimal_places=3, default=0)
|
|
||||||
|
|
||||||
def __str__(self):
|
|
||||||
return f"{self.slash_line}"
|
|
||||||
|
|
||||||
@property
|
|
||||||
def slash_line(self):
|
|
||||||
return "/".join(
|
|
||||||
[
|
|
||||||
f"{self.batting_avg:.3f}".lstrip("0"),
|
|
||||||
f"{self.onbase_pct:.3f}".lstrip("0"),
|
|
||||||
f"{self.slugging_pct:.3f}".replace("0.", "."),
|
|
||||||
]
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class Positioning(BenchcoachModel):
|
|
||||||
player = models.ForeignKey(Player, on_delete=models.CASCADE)
|
|
||||||
event = models.ForeignKey(Event, on_delete=models.CASCADE)
|
|
||||||
positions = [
|
|
||||||
("EH", "EH"),
|
|
||||||
("P", "P"),
|
|
||||||
("C", "C"),
|
|
||||||
("1B", "1B"),
|
|
||||||
("2B", "2B"),
|
|
||||||
("3B", "3B"),
|
|
||||||
("SS", "SS"),
|
|
||||||
("LF", "LF"),
|
|
||||||
("CF", "CF"),
|
|
||||||
("RF", "RF"),
|
|
||||||
("DH", "DH"),
|
|
||||||
]
|
|
||||||
position = models.CharField(
|
|
||||||
choices=positions, default=None, max_length=2, null=True, blank=True
|
|
||||||
)
|
|
||||||
order = models.PositiveSmallIntegerField(default=None, null=True, blank=True)
|
|
||||||
|
|
||||||
class Meta:
|
|
||||||
unique_together = (
|
|
||||||
"player",
|
|
||||||
"event",
|
|
||||||
)
|
|
||||||
|
|
||||||
def __str__(self):
|
|
||||||
return f"{self.player}; {self.event};"
|
|
||||||
|
|
||||||
|
|
||||||
class Availability(BenchcoachModel):
|
|
||||||
YES = 2
|
|
||||||
MAYBE = 1
|
|
||||||
NO = 0
|
|
||||||
UNKNOWN = -1
|
|
||||||
|
|
||||||
event = models.ForeignKey(Event, on_delete=models.CASCADE)
|
|
||||||
player = models.ForeignKey(Player, on_delete=models.CASCADE)
|
|
||||||
choices = [(YES, "Yes"), (NO, "No"), (MAYBE, "Maybe"), (UNKNOWN, "Unknown")]
|
|
||||||
available = models.IntegerField(choices=choices, default=UNKNOWN)
|
|
||||||
|
|
||||||
def __str__(self):
|
|
||||||
return f"{self.event}; {self.player}; {self.available}"
|
|
||||||
|
|
||||||
class Meta:
|
|
||||||
unique_together = (
|
|
||||||
"event",
|
|
||||||
"player",
|
|
||||||
)
|
|
||||||
verbose_name_plural = "availabilities"
|
|
||||||
22
benchcoach/static/css/project.css
Normal file
22
benchcoach/static/css/project.css
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
/* These styles are generated from project.scss. */
|
||||||
|
|
||||||
|
.alert-debug {
|
||||||
|
color: black;
|
||||||
|
background-color: white;
|
||||||
|
border-color: #d6e9c6;
|
||||||
|
}
|
||||||
|
|
||||||
|
.alert-error {
|
||||||
|
color: #b94a48;
|
||||||
|
background-color: #f2dede;
|
||||||
|
border-color: #eed3d7;
|
||||||
|
}
|
||||||
|
|
||||||
|
.navbar-brand {
|
||||||
|
text-transform: uppercase;
|
||||||
|
font-weight: bolder;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bg-navbar {
|
||||||
|
background: #212529;
|
||||||
|
}
|
||||||
|
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 17 KiB |
|
Before Width: | Height: | Size: 59 KiB After Width: | Height: | Size: 59 KiB |
1
benchcoach/static/images/teamsnap.svg
Normal file
1
benchcoach/static/images/teamsnap.svg
Normal file
File diff suppressed because one or more lines are too long
|
After Width: | Height: | Size: 5.8 KiB |
@@ -1,3 +1,4 @@
|
|||||||
|
/* Project specific Javascript goes here. */
|
||||||
function positionSelectChanged(elem) {
|
function positionSelectChanged(elem) {
|
||||||
let row = elem.parentElement.parentElement
|
let row = elem.parentElement.parentElement
|
||||||
let original_table = elem.parentElement.parentElement.parentElement
|
let original_table = elem.parentElement.parentElement.parentElement
|
||||||
9
benchcoach/templates/403.html
Normal file
9
benchcoach/templates/403.html
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
{% extends "base.html" %}
|
||||||
|
|
||||||
|
{% block title %}Forbidden (403){% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<h1>Forbidden (403)</h1>
|
||||||
|
|
||||||
|
<p>{% if exception %}{{ exception }}{% else %}You're not allowed to access this page.{% endif %}</p>
|
||||||
|
{% endblock content %}
|
||||||
9
benchcoach/templates/404.html
Normal file
9
benchcoach/templates/404.html
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
{% extends "base.html" %}
|
||||||
|
|
||||||
|
{% block title %}Page not found{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<h1>Page not found</h1>
|
||||||
|
|
||||||
|
<p>{% if exception %}{{ exception }}{% else %}This is not the page you were looking for.{% endif %}</p>
|
||||||
|
{% endblock content %}
|
||||||
11
benchcoach/templates/500.html
Normal file
11
benchcoach/templates/500.html
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
{% extends "base.html" %}
|
||||||
|
|
||||||
|
{% block title %}Server Error{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<h1>Ooops!!! 500</h1>
|
||||||
|
|
||||||
|
<h3>Looks like something went wrong!</h3>
|
||||||
|
|
||||||
|
<p>We track these errors automatically, but if the problem persists feel free to contact us. In the meantime, try refreshing.</p>
|
||||||
|
{% endblock content %}
|
||||||
11
benchcoach/templates/account/account_inactive.html
Normal file
11
benchcoach/templates/account/account_inactive.html
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
{% extends "account/base.html" %}
|
||||||
|
|
||||||
|
{% load i18n %}
|
||||||
|
|
||||||
|
{% block head_title %}{% translate "Account Inactive" %}{% endblock %}
|
||||||
|
|
||||||
|
{% block inner %}
|
||||||
|
<h1>{% translate "Account Inactive" %}</h1>
|
||||||
|
|
||||||
|
<p>{% translate "This account is inactive." %}</p>
|
||||||
|
{% endblock %}
|
||||||
10
benchcoach/templates/account/base.html
Normal file
10
benchcoach/templates/account/base.html
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
{% extends "base.html" %}
|
||||||
|
{% block title %}{% block head_title %}{% endblock head_title %}{% endblock title %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-6 offset-md-3">
|
||||||
|
{% block inner %}{% endblock %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
||||||
78
benchcoach/templates/account/email.html
Normal file
78
benchcoach/templates/account/email.html
Normal file
@@ -0,0 +1,78 @@
|
|||||||
|
|
||||||
|
{% extends "account/base.html" %}
|
||||||
|
|
||||||
|
{% load i18n %}
|
||||||
|
{% load crispy_forms_tags %}
|
||||||
|
|
||||||
|
{% block head_title %}{% translate "Account" %}{% endblock %}
|
||||||
|
|
||||||
|
{% block inner %}
|
||||||
|
<h1>{% translate "E-mail Addresses" %}</h1>
|
||||||
|
|
||||||
|
{% if user.emailaddress_set.all %}
|
||||||
|
<p>{% translate 'The following e-mail addresses are associated with your account:' %}</p>
|
||||||
|
|
||||||
|
<form action="{% url 'account_email' %}" class="email_list" method="post">
|
||||||
|
{% csrf_token %}
|
||||||
|
<fieldset class="blockLabels">
|
||||||
|
|
||||||
|
{% for emailaddress in user.emailaddress_set.all %}
|
||||||
|
<div class="radio">
|
||||||
|
<label for="email_radio_{{forloop.counter}}" class="{% if emailaddress.primary %}primary_email{%endif%}">
|
||||||
|
|
||||||
|
<input id="email_radio_{{forloop.counter}}" type="radio" name="email" {% if emailaddress.primary or user.emailaddress_set.count == 1 %}checked="checked"{%endif %} value="{{emailaddress.email}}"/>
|
||||||
|
|
||||||
|
{{ emailaddress.email }}
|
||||||
|
{% if emailaddress.verified %}
|
||||||
|
<span class="verified">{% translate "Verified" %}</span>
|
||||||
|
{% else %}
|
||||||
|
<span class="unverified">{% translate "Unverified" %}</span>
|
||||||
|
{% endif %}
|
||||||
|
{% if emailaddress.primary %}<span class="primary">{% translate "Primary" %}</span>{% endif %}
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<button class="secondaryAction btn btn-primary" type="submit" name="action_primary" >{% translate 'Make Primary' %}</button>
|
||||||
|
<button class="secondaryAction btn btn-primary" type="submit" name="action_send" >{% translate 'Re-send Verification' %}</button>
|
||||||
|
<button class="primaryAction btn btn-primary" type="submit" name="action_remove" >{% translate 'Remove' %}</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</fieldset>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
{% else %}
|
||||||
|
<p><strong>{% translate 'Warning:'%}</strong> {% translate "You currently do not have any e-mail address set up. You should really add an e-mail address so you can receive notifications, reset your password, etc." %}</p>
|
||||||
|
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
|
||||||
|
<h2>{% translate "Add E-mail Address" %}</h2>
|
||||||
|
|
||||||
|
<form method="post" action="{% url 'account_email' %}" class="add_email">
|
||||||
|
{% csrf_token %}
|
||||||
|
{{ form|crispy }}
|
||||||
|
<button class="btn btn-primary" name="action_add" type="submit">{% translate "Add E-mail" %}</button>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
|
||||||
|
{% block inline_javascript %}
|
||||||
|
{{ block.super }}
|
||||||
|
<script type="text/javascript">
|
||||||
|
window.addEventListener('DOMContentLoaded',function() {
|
||||||
|
const message = "{% translate 'Do you really want to remove the selected e-mail address?' %}";
|
||||||
|
const actions = document.getElementsByName('action_remove');
|
||||||
|
if (actions.length) {
|
||||||
|
actions[0].addEventListener("click",function(e) {
|
||||||
|
if (!confirm(message)) {
|
||||||
|
e.preventDefault();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
Array.from(document.getElementsByClassName('form-group')).forEach(x => x.classList.remove('row'));
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
{% endblock %}
|
||||||
31
benchcoach/templates/account/email_confirm.html
Normal file
31
benchcoach/templates/account/email_confirm.html
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
{% extends "account/base.html" %}
|
||||||
|
|
||||||
|
{% load i18n %}
|
||||||
|
{% load account %}
|
||||||
|
|
||||||
|
{% block head_title %}{% translate "Confirm E-mail Address" %}{% endblock %}
|
||||||
|
|
||||||
|
|
||||||
|
{% block inner %}
|
||||||
|
<h1>{% translate "Confirm E-mail Address" %}</h1>
|
||||||
|
|
||||||
|
{% if confirmation %}
|
||||||
|
|
||||||
|
{% user_display confirmation.email_address.user as user_display %}
|
||||||
|
|
||||||
|
<p>{% blocktranslate with confirmation.email_address.email as email %}Please confirm that <a href="mailto:{{ email }}">{{ email }}</a> is an e-mail address for user {{ user_display }}.{% endblocktranslate %}</p>
|
||||||
|
|
||||||
|
<form method="post" action="{% url 'account_confirm_email' confirmation.key %}">
|
||||||
|
{% csrf_token %}
|
||||||
|
<button class="btn btn-primary" type="submit">{% translate 'Confirm' %}</button>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
{% else %}
|
||||||
|
|
||||||
|
{% url 'account_email' as email_url %}
|
||||||
|
|
||||||
|
<p>{% blocktranslate %}This e-mail confirmation link expired or is invalid. Please <a href="{{ email_url }}">issue a new e-mail confirmation request</a>.{% endblocktranslate %}</p>
|
||||||
|
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% endblock %}
|
||||||
61
benchcoach/templates/account/login.html
Normal file
61
benchcoach/templates/account/login.html
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
{% extends "account/base.html" %}
|
||||||
|
|
||||||
|
{% load i18n %}
|
||||||
|
{% load account socialaccount %}
|
||||||
|
{% load crispy_forms_tags %}
|
||||||
|
|
||||||
|
{% block head_title %}{% translate "Sign In" %}{% endblock %}
|
||||||
|
|
||||||
|
{% block inner %}
|
||||||
|
|
||||||
|
<h1>{% translate "Sign In" %}</h1>
|
||||||
|
|
||||||
|
{% get_providers as socialaccount_providers %}
|
||||||
|
|
||||||
|
{% if socialaccount_providers %}
|
||||||
|
<p>
|
||||||
|
{% translate "Please sign in with one of your existing third party accounts:" %}
|
||||||
|
{% if ACCOUNT_ALLOW_REGISTRATION %}
|
||||||
|
{% blocktranslate trimmed %}
|
||||||
|
Or, <a href="{{ signup_url }}">sign up</a>
|
||||||
|
for a {{ site_name }} account and sign in below:
|
||||||
|
{% endblocktranslate %}
|
||||||
|
{% endif %}
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<div class="socialaccount_ballot">
|
||||||
|
|
||||||
|
<ul class="socialaccount_providers">
|
||||||
|
{% include "socialaccount/snippets/provider_list.html" with process="login" %}
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
{% if 0 %}<div class="login-or">{% translate "or" %}</div>{% endif %}
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{% include "socialaccount/snippets/login_extra.html" %}
|
||||||
|
|
||||||
|
{% else %}
|
||||||
|
{% if ACCOUNT_ALLOW_REGISTRATION %}
|
||||||
|
<p>
|
||||||
|
{% blocktranslate trimmed %}
|
||||||
|
If you have not created an account yet, then please
|
||||||
|
<a href="{{ signup_url }}">sign up</a> first.
|
||||||
|
{% endblocktranslate %}
|
||||||
|
</p>
|
||||||
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if 0 %}
|
||||||
|
<form class="login" method="POST" action="{% url 'account_login' %}">
|
||||||
|
{% csrf_token %}
|
||||||
|
{{ form|crispy }}
|
||||||
|
{% if redirect_field_value %}
|
||||||
|
<input type="hidden" name="{{ redirect_field_name }}" value="{{ redirect_field_value }}" />
|
||||||
|
{% endif %}
|
||||||
|
<a class="button secondaryAction" href="{% url 'account_reset_password' %}">{% translate "Forgot Password?" %}</a>
|
||||||
|
<button class="primaryAction btn btn-primary" type="submit">{% translate "Sign In" %}</button>
|
||||||
|
</form>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% endblock %}
|
||||||
19
benchcoach/templates/account/logout.html
Normal file
19
benchcoach/templates/account/logout.html
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
{% extends "account/base.html" %}
|
||||||
|
|
||||||
|
{% load i18n %}
|
||||||
|
|
||||||
|
{% block head_title %}{% translate "Sign Out" %}{% endblock %}
|
||||||
|
|
||||||
|
{% block inner %}
|
||||||
|
<h1>{% translate "Sign Out" %}</h1>
|
||||||
|
|
||||||
|
<p>{% translate 'Are you sure you want to sign out?' %}</p>
|
||||||
|
|
||||||
|
<form method="post" action="{% url 'account_logout' %}">
|
||||||
|
{% csrf_token %}
|
||||||
|
{% if redirect_field_value %}
|
||||||
|
<input type="hidden" name="{{ redirect_field_name }}" value="{{ redirect_field_value }}"/>
|
||||||
|
{% endif %}
|
||||||
|
<button class="btn btn-danger" type="submit">{% translate 'Sign Out' %}</button>
|
||||||
|
</form>
|
||||||
|
{% endblock %}
|
||||||
16
benchcoach/templates/account/password_change.html
Normal file
16
benchcoach/templates/account/password_change.html
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
{% extends "account/base.html" %}
|
||||||
|
|
||||||
|
{% load i18n %}
|
||||||
|
{% load crispy_forms_tags %}
|
||||||
|
|
||||||
|
{% block head_title %}{% translate "Change Password" %}{% endblock %}
|
||||||
|
|
||||||
|
{% block inner %}
|
||||||
|
<h1>{% translate "Change Password" %}</h1>
|
||||||
|
|
||||||
|
<form method="POST" action="{% url 'account_change_password' %}" class="password_change">
|
||||||
|
{% csrf_token %}
|
||||||
|
{{ form|crispy }}
|
||||||
|
<button class="btn btn-primary" type="submit" name="action">{% translate "Change Password" %}</button>
|
||||||
|
</form>
|
||||||
|
{% endblock %}
|
||||||
25
benchcoach/templates/account/password_reset.html
Normal file
25
benchcoach/templates/account/password_reset.html
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
{% extends "account/base.html" %}
|
||||||
|
|
||||||
|
{% load i18n %}
|
||||||
|
{% load account %}
|
||||||
|
{% load crispy_forms_tags %}
|
||||||
|
|
||||||
|
{% block head_title %}{% translate "Password Reset" %}{% endblock %}
|
||||||
|
|
||||||
|
{% block inner %}
|
||||||
|
|
||||||
|
<h1>{% translate "Password Reset" %}</h1>
|
||||||
|
{% if user.is_authenticated %}
|
||||||
|
{% include "account/snippets/already_logged_in.html" %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
<p>{% translate "Forgotten your password? Enter your e-mail address below, and we'll send you an e-mail allowing you to reset it." %}</p>
|
||||||
|
|
||||||
|
<form method="POST" action="{% url 'account_reset_password' %}" class="password_reset">
|
||||||
|
{% csrf_token %}
|
||||||
|
{{ form|crispy }}
|
||||||
|
<input class="btn btn-primary" type="submit" value="{% translate 'Reset My Password' %}" />
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<p>{% blocktranslate %}Please contact us if you have any trouble resetting your password.{% endblocktranslate %}</p>
|
||||||
|
{% endblock %}
|
||||||
16
benchcoach/templates/account/password_reset_done.html
Normal file
16
benchcoach/templates/account/password_reset_done.html
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
{% extends "account/base.html" %}
|
||||||
|
|
||||||
|
{% load i18n %}
|
||||||
|
{% load account %}
|
||||||
|
|
||||||
|
{% block head_title %}{% translate "Password Reset" %}{% endblock %}
|
||||||
|
|
||||||
|
{% block inner %}
|
||||||
|
<h1>{% translate "Password Reset" %}</h1>
|
||||||
|
|
||||||
|
{% if user.is_authenticated %}
|
||||||
|
{% include "account/snippets/already_logged_in.html" %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
<p>{% blocktranslate %}We have sent you an e-mail. Please contact us if you do not receive it within a few minutes.{% endblocktranslate %}</p>
|
||||||
|
{% endblock %}
|
||||||
24
benchcoach/templates/account/password_reset_from_key.html
Normal file
24
benchcoach/templates/account/password_reset_from_key.html
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
{% extends "account/base.html" %}
|
||||||
|
|
||||||
|
{% load i18n %}
|
||||||
|
{% load crispy_forms_tags %}
|
||||||
|
{% block head_title %}{% translate "Change Password" %}{% endblock %}
|
||||||
|
|
||||||
|
{% block inner %}
|
||||||
|
<h1>{% if token_fail %}{% translate "Bad Token" %}{% else %}{% translate "Change Password" %}{% endif %}</h1>
|
||||||
|
|
||||||
|
{% if token_fail %}
|
||||||
|
{% url 'account_reset_password' as passwd_reset_url %}
|
||||||
|
<p>{% blocktranslate %}The password reset link was invalid, possibly because it has already been used. Please request a <a href="{{ passwd_reset_url }}">new password reset</a>.{% endblocktranslate %}</p>
|
||||||
|
{% else %}
|
||||||
|
{% if form %}
|
||||||
|
<form method="POST" action=".">
|
||||||
|
{% csrf_token %}
|
||||||
|
{{ form|crispy }}
|
||||||
|
<input class="btn btn-primary" type="submit" name="action" value="{% translate 'change password' %}"/>
|
||||||
|
</form>
|
||||||
|
{% else %}
|
||||||
|
<p>{% translate 'Your password is now changed.' %}</p>
|
||||||
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
|
{% endblock %}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
{% extends "account/base.html" %}
|
||||||
|
|
||||||
|
{% load i18n %}
|
||||||
|
{% block head_title %}{% translate "Change Password" %}{% endblock %}
|
||||||
|
|
||||||
|
{% block inner %}
|
||||||
|
<h1>{% translate "Change Password" %}</h1>
|
||||||
|
<p>{% translate 'Your password is now changed.' %}</p>
|
||||||
|
{% endblock %}
|
||||||
16
benchcoach/templates/account/password_set.html
Normal file
16
benchcoach/templates/account/password_set.html
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
{% extends "account/base.html" %}
|
||||||
|
|
||||||
|
{% load i18n %}
|
||||||
|
{% load crispy_forms_tags %}
|
||||||
|
|
||||||
|
{% block head_title %}{% translate "Set Password" %}{% endblock %}
|
||||||
|
|
||||||
|
{% block inner %}
|
||||||
|
<h1>{% translate "Set Password" %}</h1>
|
||||||
|
|
||||||
|
<form method="POST" action="{% url 'account_set_password' %}" class="password_set">
|
||||||
|
{% csrf_token %}
|
||||||
|
{{ form|crispy }}
|
||||||
|
<input class="btn btn-primary" type="submit" name="action" value="{% translate 'Set Password' %}"/>
|
||||||
|
</form>
|
||||||
|
{% endblock %}
|
||||||
22
benchcoach/templates/account/signup.html
Normal file
22
benchcoach/templates/account/signup.html
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
{% extends "account/base.html" %}
|
||||||
|
|
||||||
|
{% load i18n %}
|
||||||
|
{% load crispy_forms_tags %}
|
||||||
|
|
||||||
|
{% block head_title %}{% translate "Signup" %}{% endblock %}
|
||||||
|
|
||||||
|
{% block inner %}
|
||||||
|
<h1>{% translate "Sign Up" %}</h1>
|
||||||
|
|
||||||
|
<p>{% blocktranslate %}Already have an account? Then please <a href="{{ login_url }}">sign in</a>.{% endblocktranslate %}</p>
|
||||||
|
|
||||||
|
<form class="signup" id="signup_form" method="post" action="{% url 'account_signup' %}">
|
||||||
|
{% csrf_token %}
|
||||||
|
{{ form|crispy }}
|
||||||
|
{% if redirect_field_value %}
|
||||||
|
<input type="hidden" name="{{ redirect_field_name }}" value="{{ redirect_field_value }}" />
|
||||||
|
{% endif %}
|
||||||
|
<button class="btn btn-primary" type="submit">{% translate "Sign Up" %} »</button>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
{% endblock %}
|
||||||
11
benchcoach/templates/account/signup_closed.html
Normal file
11
benchcoach/templates/account/signup_closed.html
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
{% extends "account/base.html" %}
|
||||||
|
|
||||||
|
{% load i18n %}
|
||||||
|
|
||||||
|
{% block head_title %}{% translate "Sign Up Closed" %}{% endblock %}
|
||||||
|
|
||||||
|
{% block inner %}
|
||||||
|
<h1>{% translate "Sign Up Closed" %}</h1>
|
||||||
|
|
||||||
|
<p>{% translate "We are sorry, but the sign up is currently closed." %}</p>
|
||||||
|
{% endblock %}
|
||||||
12
benchcoach/templates/account/verification_sent.html
Normal file
12
benchcoach/templates/account/verification_sent.html
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
{% extends "account/base.html" %}
|
||||||
|
|
||||||
|
{% load i18n %}
|
||||||
|
|
||||||
|
{% block head_title %}{% translate "Verify Your E-mail Address" %}{% endblock %}
|
||||||
|
|
||||||
|
{% block inner %}
|
||||||
|
<h1>{% translate "Verify Your E-mail Address" %}</h1>
|
||||||
|
|
||||||
|
<p>{% blocktranslate %}We have sent an e-mail to you for verification. Follow the link provided to finalize the signup process. Please contact us if you do not receive it within a few minutes.{% endblocktranslate %}</p>
|
||||||
|
|
||||||
|
{% endblock %}
|
||||||
21
benchcoach/templates/account/verified_email_required.html
Normal file
21
benchcoach/templates/account/verified_email_required.html
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
{% extends "account/base.html" %}
|
||||||
|
|
||||||
|
{% load i18n %}
|
||||||
|
|
||||||
|
{% block head_title %}{% translate "Verify Your E-mail Address" %}{% endblock %}
|
||||||
|
|
||||||
|
{% block inner %}
|
||||||
|
<h1>{% translate "Verify Your E-mail Address" %}</h1>
|
||||||
|
|
||||||
|
{% url 'account_email' as email_url %}
|
||||||
|
|
||||||
|
<p>{% blocktranslate %}This part of the site requires us to verify that
|
||||||
|
you are who you claim to be. For this purpose, we require that you
|
||||||
|
verify ownership of your e-mail address. {% endblocktranslate %}</p>
|
||||||
|
|
||||||
|
<p>{% blocktranslate %}We have sent an e-mail to you for
|
||||||
|
verification. Please click on the link inside this e-mail. Please
|
||||||
|
contact us if you do not receive it within a few minutes.{% endblocktranslate %}</p>
|
||||||
|
|
||||||
|
<p>{% blocktranslate %}<strong>Note:</strong> you can still <a href="{{ email_url }}">change your e-mail address</a>.{% endblocktranslate %}</p>
|
||||||
|
{% endblock %}
|
||||||
131
benchcoach/templates/base.html
Normal file
131
benchcoach/templates/base.html
Normal file
@@ -0,0 +1,131 @@
|
|||||||
|
{% load static i18n %}<!DOCTYPE html>
|
||||||
|
{% get_current_language as LANGUAGE_CODE %}
|
||||||
|
<html lang="{{ LANGUAGE_CODE }}">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta http-equiv="x-ua-compatible" content="ie=edge">
|
||||||
|
<title>{% block title %}BenchCoach{% endblock title %}</title>
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<meta name="description" content="An assistant coach for TeamSnap">
|
||||||
|
<meta name="author" content="Anthony Correa">
|
||||||
|
|
||||||
|
<link rel="icon" href="{% static 'images/favicons/favicon.ico' %}">
|
||||||
|
|
||||||
|
{% block css %}
|
||||||
|
<!-- Latest compiled and minified Bootstrap CSS -->
|
||||||
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.1.3/css/bootstrap.min.css" integrity="sha512-GQGU0fMMi238uA+a/bdWJfpUGKUkBdgfFdgBm72SUQ6BeyWjoY/ton0tEjH+OSH9iP4Dfh+7HM0I9f5eR0L/4w==" crossorigin="anonymous" referrerpolicy="no-referrer" />
|
||||||
|
<!-- Your stuff: Third-party CSS libraries go here -->
|
||||||
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.8.2/font/bootstrap-icons.css">
|
||||||
|
<!-- This file stores project-specific CSS -->
|
||||||
|
<link href="{% static 'css/project.css' %}" rel="stylesheet">
|
||||||
|
{% endblock %}
|
||||||
|
<!-- Le javascript
|
||||||
|
================================================== -->
|
||||||
|
{# Placed at the top of the document so pages load faster with defer #}
|
||||||
|
{% block javascript %}
|
||||||
|
<!-- Bootstrap JS -->
|
||||||
|
<script defer src="{% static 'js/bootstrap.js' %}"></script>
|
||||||
|
<!-- Your stuff: Third-party javascript libraries go here -->
|
||||||
|
|
||||||
|
<!-- place project specific Javascript in this file -->
|
||||||
|
<script defer src="{% static 'js/project.js' %}"></script>
|
||||||
|
<script defer src="{% static 'js/Sortable.js' %}"></script>
|
||||||
|
<script src="{% static 'js/chart.js' %}"></script>
|
||||||
|
|
||||||
|
{% endblock javascript %}
|
||||||
|
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<div class="mb-1">
|
||||||
|
<nav class="navbar navbar-expand-md navbar-dark bg-navbar">
|
||||||
|
<div class="container-fluid">
|
||||||
|
<button class="navbar-toggler navbar-toggler-right" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
|
||||||
|
<span class="navbar-toggler-icon"></span>
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<a class="navbar-brand" href="{% url 'home' %}">
|
||||||
|
<img class="d-inline-block" width="32" height="32" src="{% static 'images/benchcoach.svg' %}" />
|
||||||
|
BenchCoach
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<div class="collapse navbar-collapse" id="navbarSupportedContent">
|
||||||
|
<ul class="navbar-nav mr-auto">
|
||||||
|
<li class="nav-item active">
|
||||||
|
<a class="nav-link" href="{% url 'home' %}">Home <span class="visually-hidden">(current)</span></a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" href="{% url 'about' %}">About</a>
|
||||||
|
</li>
|
||||||
|
{% if request.user.is_authenticated %}
|
||||||
|
<li class="nav-item">
|
||||||
|
{# URL provided by django-allauth/account/urls.py #}
|
||||||
|
<a class="nav-link" href="{% url 'users:detail' request.user.username %}">{% translate "My Profile" %}</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" href="{% url 'teamsnap_dashboard' %}">{% translate "Dashboard" %}</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" href="{% url 'teamsnap_schedule' %}">{% translate "Schedule" %}</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" href="{% url 'teamsnap_preferences' %}">{% translate "Preferences" %}</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
{# URL provided by django-allauth/account/urls.py #}
|
||||||
|
<a class="nav-link" href="{% url 'account_logout' %}">{% translate "Sign Out" %}</a>
|
||||||
|
</li>
|
||||||
|
{% else %}
|
||||||
|
{% if ACCOUNT_ALLOW_REGISTRATION %}
|
||||||
|
<li class="nav-item">
|
||||||
|
{# URL provided by django-allauth/account/urls.py #}
|
||||||
|
<a id="sign-up-link" class="nav-link" href="{% url 'account_signup' %}">{% translate "Sign Up" %}</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
{% endif %}
|
||||||
|
<li class="nav-item">
|
||||||
|
{# URL provided by django-allauth/account/urls.py #}
|
||||||
|
<a id="log-in-link" class="nav-link" href="{% url 'account_login' %}">{% translate "Sign In" %}</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="container">
|
||||||
|
|
||||||
|
{% if messages %}
|
||||||
|
{% for message in messages %}
|
||||||
|
<div class="alert alert-dismissible {% if message.tags %}alert-{{ message.tags }}{% endif %}">
|
||||||
|
{{ message }}
|
||||||
|
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
|
||||||
|
</div>
|
||||||
|
{% endfor %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<p>Use this document as a way to quick start any new project.</p>
|
||||||
|
{% endblock content %}
|
||||||
|
|
||||||
|
</div> <!-- /container -->
|
||||||
|
|
||||||
|
{% block modal %}{% endblock modal %}
|
||||||
|
|
||||||
|
{% block inline_javascript %}
|
||||||
|
{% comment %}
|
||||||
|
Script tags with only code, no src (defer by default). To run
|
||||||
|
with a "defer" so that you run inline code:
|
||||||
|
<script>
|
||||||
|
window.addEventListener('DOMContentLoaded', () => {/* Run whatever you want */});
|
||||||
|
</script>
|
||||||
|
{% endcomment %}
|
||||||
|
{% endblock inline_javascript %}
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -1,280 +0,0 @@
|
|||||||
{% load static %}
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8">
|
|
||||||
<title>Gamecard</title>
|
|
||||||
<link rel="stylesheet" href="{% static "css/base.css"%}">
|
|
||||||
<link rel="stylesheet" href="{% static "css/paper.css"%}">
|
|
||||||
<style> @page { size: letter }
|
|
||||||
</style>
|
|
||||||
<link rel="stylesheet"
|
|
||||||
href="https://fonts.googleapis.com/css2?family=Inconsolata">
|
|
||||||
<link rel="stylesheet"
|
|
||||||
href="https://fonts.googleapis.com/css2?family=Open+Sans">
|
|
||||||
<style>
|
|
||||||
* {
|
|
||||||
-moz-box-sizing: border-box;
|
|
||||||
-webkit-box-sizing: border-box;
|
|
||||||
box-sizing: border-box;
|
|
||||||
}
|
|
||||||
@font-face {
|
|
||||||
font-family: 'Open Sans';
|
|
||||||
src: url("{% static 'fonts/OpenSans.ttf' %}") format("truetype-variations");
|
|
||||||
font-weight: 1 999;
|
|
||||||
font-stretch: 0% 100%
|
|
||||||
}
|
|
||||||
|
|
||||||
@font-face {
|
|
||||||
font-family: 'Inconsolata';
|
|
||||||
src: url("{% static 'fonts/Inconsolata.ttf' %}") format("truetype-variations");
|
|
||||||
font-weight: 1 999;
|
|
||||||
font-stretch: 0% 100%
|
|
||||||
}
|
|
||||||
.whole-card {
|
|
||||||
margin:0;
|
|
||||||
padding:0;
|
|
||||||
height: 12.5cm;
|
|
||||||
width: 17.5cm;
|
|
||||||
outline: .8px dashed lightgray;
|
|
||||||
margin: auto;
|
|
||||||
display: flex;
|
|
||||||
}
|
|
||||||
|
|
||||||
.half-card {
|
|
||||||
margin: auto;
|
|
||||||
padding: .1in;
|
|
||||||
height: 100%;
|
|
||||||
width: 50%;
|
|
||||||
}
|
|
||||||
|
|
||||||
card-left {
|
|
||||||
float: left;
|
|
||||||
margin: auto;
|
|
||||||
}
|
|
||||||
card-right {
|
|
||||||
float: right;
|
|
||||||
}
|
|
||||||
|
|
||||||
.content {
|
|
||||||
height: 100%;
|
|
||||||
width: 100%;
|
|
||||||
{#outline: solid grey;#}
|
|
||||||
}
|
|
||||||
|
|
||||||
table {
|
|
||||||
font-family: "Open Sans";
|
|
||||||
border-collapse: collapse;
|
|
||||||
empty-cells: show;
|
|
||||||
font-size:11px;
|
|
||||||
table-layout: fixed;
|
|
||||||
white-space: nowrap;
|
|
||||||
text-overflow: ellipsis;
|
|
||||||
overflow-x: hidden;
|
|
||||||
width: 100%;
|
|
||||||
border: 1px solid #000;
|
|
||||||
}
|
|
||||||
|
|
||||||
th, td {
|
|
||||||
/* box-sizing: content-box; */
|
|
||||||
border: 0.5px solid black;
|
|
||||||
height: 17px;
|
|
||||||
text-overflow: ellipsis;
|
|
||||||
overflow-x: hidden;
|
|
||||||
padding: 0px;
|
|
||||||
padding-left: 2px;
|
|
||||||
padding-right: 2px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.gametitle {
|
|
||||||
text-transform: uppercase;
|
|
||||||
font-stretch: condensed;
|
|
||||||
text-align: center;
|
|
||||||
font-weight: bold;
|
|
||||||
}
|
|
||||||
|
|
||||||
.homeaway {
|
|
||||||
text-transform: uppercase;
|
|
||||||
font-stretch: extra-expanded;
|
|
||||||
text-align: center;
|
|
||||||
font-weight: 900;
|
|
||||||
font-size: 12px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.numbercell {
|
|
||||||
font-family: "Inconsolata";
|
|
||||||
text-align: center;
|
|
||||||
font-size: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.statscell {
|
|
||||||
font-family: "Inconsolata";
|
|
||||||
text-align: center;
|
|
||||||
font-stretch: extra-condensed;
|
|
||||||
font-size: 9px;
|
|
||||||
width: 60px;
|
|
||||||
}
|
|
||||||
|
|
||||||
tr:nth-child(even) {background-color: #f2f2f2;}
|
|
||||||
|
|
||||||
th{
|
|
||||||
background: black;
|
|
||||||
color: white;
|
|
||||||
border: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.customcol{
|
|
||||||
width: 120px;
|
|
||||||
text-transform: uppercase;
|
|
||||||
font-stretch: condensed;
|
|
||||||
}
|
|
||||||
|
|
||||||
.condensedNameCell{
|
|
||||||
width: 70px;
|
|
||||||
text-transform: uppercase;
|
|
||||||
font-stretch: condensed;
|
|
||||||
}
|
|
||||||
|
|
||||||
.square {
|
|
||||||
height: 14px;
|
|
||||||
width: 14px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.available{
|
|
||||||
background-color: #B7E1CD;
|
|
||||||
}
|
|
||||||
|
|
||||||
.notavailable{
|
|
||||||
background-color: #F4C7C3;
|
|
||||||
}
|
|
||||||
|
|
||||||
.maybeavailable{
|
|
||||||
background-color: #B7E1CD;
|
|
||||||
}
|
|
||||||
|
|
||||||
.starting{
|
|
||||||
font-weight: bold;
|
|
||||||
}
|
|
||||||
|
|
||||||
</style>
|
|
||||||
</head>
|
|
||||||
<body class="letter">
|
|
||||||
<section class="sheet padding-10mm">
|
|
||||||
<div class="whole-card">
|
|
||||||
<div id="NW" class="half-card red">
|
|
||||||
<div class="content card-left">
|
|
||||||
<table>
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th colspan="9" class="gametitle">{{ event.teamsnap_event.csv_event_title }}</th>
|
|
||||||
<th colspan="3" class="homeaway">
|
|
||||||
{% if event.home_team.name == user.profile.teamsnapsettings.managed_team.name %}
|
|
||||||
HOME
|
|
||||||
{% elif event.away_team.name == user.profile.teamsnapsettings.managed_team.name %}
|
|
||||||
AWAY
|
|
||||||
{% else %}
|
|
||||||
{% endif %}
|
|
||||||
</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
</table>
|
|
||||||
<table>
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th class="numbercell"></td>
|
|
||||||
<th class="customcol"></td>
|
|
||||||
<th class="numbercell"></td>
|
|
||||||
<th class="numbercell"></td>
|
|
||||||
<th class="numbercell">1</td>
|
|
||||||
<th class="numbercell">2</td>
|
|
||||||
<th class="numbercell">3</td>
|
|
||||||
<th class="numbercell">4</td>
|
|
||||||
<th class="numbercell">5</td>
|
|
||||||
<th class="numbercell">6</td>
|
|
||||||
<th class="numbercell">7</td>
|
|
||||||
<th class="numbercell">X</td>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
{% for positioning in positionings_starting %}
|
|
||||||
{% if positioning.order == 0 %}<tr style="border: 1px solid;">
|
|
||||||
{% else %}<tr>{% endif %}
|
|
||||||
<td class="numbercell">{{ positioning.order }}</td>
|
|
||||||
<td class="customcol">{{ positioning.player.last_name }}</td>
|
|
||||||
<td class="numbercell">{{ positioning.player.jersey_number }}</td>
|
|
||||||
<td class="numbercell">{{ positioning.position|default_if_none:'' }}</td>
|
|
||||||
<td class="numbercell"></td>
|
|
||||||
<td class="numbercell"></td>
|
|
||||||
<td class="numbercell"></td>
|
|
||||||
<td class="numbercell"></td>
|
|
||||||
<td class="numbercell"></td>
|
|
||||||
<td class="numbercell"></td>
|
|
||||||
<td class="numbercell"></td>
|
|
||||||
<td class="numbercell"></td>
|
|
||||||
</tr>
|
|
||||||
{% endfor %}
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
<table>
|
|
||||||
<tbody>
|
|
||||||
{% for line in empty_lines %}
|
|
||||||
<tr>
|
|
||||||
<td class="numbercell"></td>
|
|
||||||
<td class="customcol"></td>
|
|
||||||
<td class="numbercell"></td>
|
|
||||||
<td class="numbercell"></td>
|
|
||||||
<td class="numbercell"></td>
|
|
||||||
<td class="numbercell"></td>
|
|
||||||
<td class="numbercell"></td>
|
|
||||||
<td class="numbercell"></td>
|
|
||||||
<td class="numbercell"></td>
|
|
||||||
<td class="numbercell"></td>
|
|
||||||
<td class="numbercell"></td>
|
|
||||||
<td class="numbercell"></td>
|
|
||||||
</tr>
|
|
||||||
{% endfor %}
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="half-card">
|
|
||||||
<div class="content card-right">
|
|
||||||
<table>
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th class="numbercell"></td>
|
|
||||||
<th class="numbercell"></td>
|
|
||||||
<th class="customcol"></td>
|
|
||||||
<th class="numbercell"></td>
|
|
||||||
<th class="numbercell">1</td>
|
|
||||||
<th class="numbercell">2</td>
|
|
||||||
<th class="numbercell">3</td>
|
|
||||||
<th class="numbercell">4</td>
|
|
||||||
<th class="numbercell">5</td>
|
|
||||||
<th class="numbercell">6</td>
|
|
||||||
<th class="numbercell">7</td>
|
|
||||||
<th class="numbercell">X</td>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
{% for positioning in positionings %}
|
|
||||||
<tr>
|
|
||||||
<td class="numbercell"></td>
|
|
||||||
<td class="numbercell">{{ positioning.player.jersey_number }}</td>
|
|
||||||
<td class="customcol{% if positioning.event_availability == 2 %} available{% endif %}{% if positioning.event_availability == 0 %} notavailable{% endif %}{% if positioning.order or positioning.position %} starting{% endif %}">{{ positioning.player.last_name }}</td>
|
|
||||||
<td class="numbercell"><i class="bi bi-check-lg"></i></td>
|
|
||||||
<td class="numbercell"></td>
|
|
||||||
<td class="numbercell"></td>
|
|
||||||
<td class="numbercell"></td>
|
|
||||||
<td class="numbercell"></td>
|
|
||||||
<td class="numbercell"></td>
|
|
||||||
<td class="numbercell"></td>
|
|
||||||
<td class="numbercell"></td>
|
|
||||||
<td class="numbercell"></td>
|
|
||||||
</tr>
|
|
||||||
{% endfor %}
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
</body>
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
{% extends 'base.html' %}
|
|
||||||
|
|
||||||
{% block navbar %}
|
|
||||||
{% with events_tab="active" %}
|
|
||||||
{{ block.super }}
|
|
||||||
{% endwith %}
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block page_heading %}
|
|
||||||
Object
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block content %}
|
|
||||||
<div class="card p-0">
|
|
||||||
<div class="card-body p-0">
|
|
||||||
<table class="table m-0">
|
|
||||||
{% block rows %}
|
|
||||||
{% endblock %}
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{% endblock %}
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
{% extends 'base.html' %}
|
|
||||||
|
|
||||||
{% block navbar %}
|
|
||||||
{% with events_tab="active" %}
|
|
||||||
{{ block.super }}
|
|
||||||
{% endwith %}
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block page_heading %}
|
|
||||||
Events
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block content %}
|
|
||||||
<ul class="list-group">
|
|
||||||
{% for event in events%}
|
|
||||||
{% if event.teamsnap_event.is_game %}
|
|
||||||
<li class="list-group-item">
|
|
||||||
<h6>{{ event.away_team|default_if_none:"" }} vs. {{ event.home_team|default_if_none:"" }}</h6>
|
|
||||||
{{ event.start|date:"l, F j, Y g:i A" }} <br>
|
|
||||||
{{ event.venue.name }} <br>
|
|
||||||
<a href="{% url 'event' event_id=event.id %}">Edit Lineup...</a>
|
|
||||||
</li>
|
|
||||||
{% endif %}
|
|
||||||
{% endfor %}
|
|
||||||
</ul>
|
|
||||||
{% endblock %}
|
|
||||||
</html>
|
|
||||||
@@ -1,246 +0,0 @@
|
|||||||
{% extends 'base.html' %}{% block title %} {{ title }} {% endblock %}{% load static %}
|
|
||||||
{% with events_active="active" %}
|
|
||||||
{% block page_heading %}
|
|
||||||
<span class="d-none d-md-block">
|
|
||||||
{% if false %} <img src="{{ event.away_team.image.url }}" height=64>{% endif %}
|
|
||||||
{{ event.away_team.name }} vs. {{ event.home_team.name }}
|
|
||||||
{% if false %}<img src="{{ event.home_team.image.url }}" height=64>{% endif %}
|
|
||||||
</span>
|
|
||||||
<span class="d-md-none">
|
|
||||||
{% if event.home_team.name == user.profile.teamsnapsettings.managed_team.name %}
|
|
||||||
{% if false %} <img src="{{ event.away_team.image.url }}" height=32>{% endif %}
|
|
||||||
vs. {{ event.away_team }}
|
|
||||||
{% elif event.away_team.name == user.profile.teamsnapsettings.managed_team.name %}
|
|
||||||
{% if false %}<img src="{{ event.home_team.image.url }}" height=32>{% endif %}
|
|
||||||
at {{ event.home_team }}
|
|
||||||
{% else %}
|
|
||||||
Event
|
|
||||||
{% endif %}
|
|
||||||
</span>
|
|
||||||
{% endblock %}
|
|
||||||
{% block page_subheading %}
|
|
||||||
<p class="d-none d-md-block">{{ event.start|date:"l, F j, Y g:i A" }}, {{ event.venue.name }}</p>
|
|
||||||
<p class="d-md-none">{{ event.start|date:"D" }} {{ event.start|date:"n/j" }} {{ event.start|date:"g:i" }}, <span class="text-truncate">{{ event.venue.name }}</span></p>
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block header %}
|
|
||||||
|
|
||||||
<ul class="nav nav-tabs nav-fill bg-white" role="tablist">
|
|
||||||
{% if previous_event %}
|
|
||||||
<li class="nav-item m-1">
|
|
||||||
<a href="{% url 'event' event_id=previous_event.id active_tab=active_tab %}">
|
|
||||||
<i class="bi bi-chevron-left"></i>{{ previous_event.start|date:"D" }} {{ previous_event.start|date:"n/j" }}
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
<li class="nav-item m-1" role="presentation">
|
|
||||||
<a id="event-details-tab" class="nav-link {% if active_tab == "details" %}active{% endif %} px-2 py-0" href="{% url 'event' event_id=event.id active_tab='details'%}">Details</a></li>
|
|
||||||
<li class="nav-item m-1" role="presentation"><a id="event-lineup-tab" class="nav-link {% if active_tab == "lineup" %}active{% endif %} px-2 py-0" href="{% url 'event' event_id=event.id active_tab='lineup'%}">Lineup</a></li>
|
|
||||||
{% if next_event %}
|
|
||||||
<li class="nav-item m-1">
|
|
||||||
<a href="{% url 'event' event_id=next_event.id active_tab=active_tab%}" role="button">
|
|
||||||
{{ next_event.start|date:"D" }} {{ next_event.start|date:"n/j" }}<i class="bi bi-chevron-right"></i>
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
{% endblock %}{% endwith %}
|
|
||||||
{% block content %}
|
|
||||||
{% include 'messages.html' %}
|
|
||||||
<div id="pills-tabContent" class="container-fluid tab-content w-100 p-0 m-0" data-toggle="tab">
|
|
||||||
<div id="event-details" class="tab-pane {% if active_tab == "details" %}show active{% endif %} " role="tabpanel" aria-labelledby="event-details-tab">
|
|
||||||
<div>
|
|
||||||
<div class="card my-1">
|
|
||||||
<div class="card-header d-inline-flex">
|
|
||||||
<div class="d-inline-flex flex-grow-1"><h5>Event</h5></div>
|
|
||||||
<div class="d-inline-flex">
|
|
||||||
{% include 'teamsnap/update-button.html' with object_name='event' object_id=event.id next=request.path %}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="card-body p-0">
|
|
||||||
{% include 'benchcoach/info-table.html' with d=details %}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
<div id="event-lineup" class="tab-pane {% if active_tab == "lineup" %}show active{% endif %}" role="tabpanel" aria-labelledby="event-lineup-tab">
|
|
||||||
<form action="{% url 'event' event_id=event.id active_tab=active_tab%}" method="post">
|
|
||||||
{% csrf_token %}
|
|
||||||
{{ formset.management_form }}
|
|
||||||
<div class="row w-100">
|
|
||||||
<div class="col-md-6">
|
|
||||||
<div class="card my-1">
|
|
||||||
<div class="card-header d-inline-flex">
|
|
||||||
<div class="d-inline-flex flex-grow-1"><h5>Lineup</h5></div>
|
|
||||||
<div>
|
|
||||||
<input type="submit" value="Submit" class="btn btn-sm btn-success d-xl-flex align-items-xl-center">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="card-body p-0">
|
|
||||||
{% include 'benchcoach/player-table.html' with table_id="dhd" formset=formset_dhd available_class="d-none" %}
|
|
||||||
|
|
||||||
<hr class="m-0">
|
|
||||||
{% include 'benchcoach/player-table.html' with table_id="lineup" formset=formset_lineup available_class="d-none"%}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="col-md-6">
|
|
||||||
<div class="card my-1">
|
|
||||||
<div class="card-header d-inline-flex">
|
|
||||||
<div class="d-inline-flex flex-grow-1">
|
|
||||||
<h5>Bench</h5>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="card-body p-0">
|
|
||||||
{% include 'benchcoach/player-table.html' with table_id="bench" formset=formset_bench order_class="d-none" %}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<script src="{% static 'js/Sortable.js' %}"></script>
|
|
||||||
<script id="form changes">
|
|
||||||
function positionSelectChanged(elem) {
|
|
||||||
let row = elem.parentElement.parentElement
|
|
||||||
let original_table = elem.parentElement.parentElement.parentElement
|
|
||||||
let lineup_table = document.getElementById('lineup')
|
|
||||||
let bench_table = document.getElementById('bench')
|
|
||||||
let dhd_table = document.getElementById('dhd')
|
|
||||||
let player_order = row.querySelector('[id^="player-order"]')
|
|
||||||
let player_available = row.querySelector('[id^="player-availability"]')
|
|
||||||
console.dir(original_table)
|
|
||||||
console.dir(bench_table)
|
|
||||||
console.dir(original_table == bench_table)
|
|
||||||
if (elem.value == "P" && original_table == bench_table ) {
|
|
||||||
dhd_table.appendChild(row)
|
|
||||||
player_order.classList.remove('d-none')
|
|
||||||
player_available.classList.add('d-none')
|
|
||||||
refresh_lineup_order()
|
|
||||||
}
|
|
||||||
else if (elem.value && original_table == dhd_table ) {
|
|
||||||
dhd_table.appendChild(row)
|
|
||||||
player_order.classList.remove('d-none')
|
|
||||||
player_available.classList.add('d-none')
|
|
||||||
refresh_lineup_order()
|
|
||||||
}
|
|
||||||
else if (elem.value) {
|
|
||||||
lineup_table.appendChild(row)
|
|
||||||
player_order.classList.remove('d-none')
|
|
||||||
player_available.classList.add('d-none')
|
|
||||||
refresh_lineup_order()
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
bench_table.prepend(row)
|
|
||||||
player_order.classList.add('d-none')
|
|
||||||
player_available.classList.remove('d-none')
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
<script id="sortable">
|
|
||||||
function refresh_lineup_order (){
|
|
||||||
var player_rows = document.getElementById('lineup').querySelectorAll('tr')
|
|
||||||
for (let i = 0; i < player_rows.length; i++) {
|
|
||||||
var player_order = player_rows[i].querySelector('[id^="player-order"]')
|
|
||||||
var form_element_order = player_rows[i].querySelector('[id$="order"]')
|
|
||||||
{#player_order.innerText = parseInt(player_rows[i].dataset.order)#}
|
|
||||||
player_rows[i].dataset.order = i+1
|
|
||||||
form_element_order.value = i+1
|
|
||||||
player_order.innerHTML = i+1
|
|
||||||
}
|
|
||||||
var player_rows = document.getElementById('bench').querySelectorAll('tr')
|
|
||||||
for (let i = 0; i < player_rows.length; i++) {
|
|
||||||
var player_order = player_rows[i].querySelector('[id^="player-order"]')
|
|
||||||
var form_element_order = player_rows[i].querySelector('[id$="order"]')
|
|
||||||
{#player_order.innerText = parseInt(player_rows[i].dataset.order)#}
|
|
||||||
player_rows[i].dataset.order = null
|
|
||||||
form_element_order.value = null
|
|
||||||
player_order.innerHTML = null
|
|
||||||
}
|
|
||||||
var player_rows = document.getElementById('dhd').querySelectorAll('tr')
|
|
||||||
for (let i = 0; i < player_rows.length; i++) {
|
|
||||||
var player_order = player_rows[i].querySelector('[id^="player-order"]')
|
|
||||||
var form_element_order = player_rows[i].querySelector('[id$="order"]')
|
|
||||||
{#player_order.innerText = parseInt(player_rows[i].dataset.order)#}
|
|
||||||
player_rows[i].dataset.order = 0
|
|
||||||
form_element_order.value = 0
|
|
||||||
player_order.innerHTML = null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
var dhd = new Sortable.create(
|
|
||||||
document.getElementById('dhd'), {
|
|
||||||
animation: 150,
|
|
||||||
ghostClass: "ghost",
|
|
||||||
handle: ".drag-handle",
|
|
||||||
{#handle: ".bars-move",#}
|
|
||||||
group: {
|
|
||||||
put: true,
|
|
||||||
pull: true
|
|
||||||
},
|
|
||||||
onAdd: function (/**Event*/evt){
|
|
||||||
// Add to DH'd
|
|
||||||
var itemEl = evt.item; // dragged HTMLElement
|
|
||||||
var player_order = itemEl.querySelector('[id^="player-order"]')
|
|
||||||
var player_available =itemEl.querySelector('[id^="player-availability"]')
|
|
||||||
refresh_lineup_order()
|
|
||||||
player_order.classList.remove('d-none')
|
|
||||||
player_available.classList.add('d-none')
|
|
||||||
}
|
|
||||||
})
|
|
||||||
var lineup = new Sortable.create(
|
|
||||||
document.getElementById('lineup'), {
|
|
||||||
animation: 150,
|
|
||||||
handle: ".drag-handle",
|
|
||||||
ghostClass:"ghost",
|
|
||||||
{#handle: ".bars-move",#}
|
|
||||||
group:{
|
|
||||||
put:true,
|
|
||||||
pull:true
|
|
||||||
},
|
|
||||||
onAdd: function (/**Event*/evt) {
|
|
||||||
// Add to Lineup
|
|
||||||
var itemEl = evt.item; // dragged HTMLElement
|
|
||||||
var player_order = itemEl.querySelector('[id^="player-order"]')
|
|
||||||
var player_available =itemEl.querySelector('[id^="player-availability"]')
|
|
||||||
refresh_lineup_order()
|
|
||||||
player_order.classList.remove('d-none')
|
|
||||||
player_available.classList.add('d-none')
|
|
||||||
},
|
|
||||||
onUpdate: function (/**Event*/evt) {
|
|
||||||
console.log('update to lineup')
|
|
||||||
var itemEl = evt.item; // dragged HTMLElement
|
|
||||||
refresh_lineup_order()
|
|
||||||
},
|
|
||||||
});
|
|
||||||
var bench = new Sortable.create(
|
|
||||||
document.getElementById('bench'), {
|
|
||||||
animation: 150,
|
|
||||||
ghostClass:"ghost",
|
|
||||||
sort: false,
|
|
||||||
handle: ".drag-handle",
|
|
||||||
{#handle: ".bars-move",#}
|
|
||||||
group:{
|
|
||||||
put:true,
|
|
||||||
pull:true
|
|
||||||
},
|
|
||||||
onAdd: function (/**Event*/evt) {
|
|
||||||
var itemEl = evt.item; // dragged HTMLElement
|
|
||||||
var player_order = itemEl.querySelector('[id^="player-order"]')
|
|
||||||
var player_available =itemEl.querySelector('[id^="player-availability"]')
|
|
||||||
refresh_lineup_order()
|
|
||||||
player_order.classList.add('d-none')
|
|
||||||
player_available.classList.remove('d-none')
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
</script>
|
|
||||||
|
|
||||||
{% endblock %}
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
<table class="table">
|
|
||||||
{% for key, value in d.items %}
|
|
||||||
<tr>
|
|
||||||
<th>{{ key }}</th>
|
|
||||||
<td>{{ value }}</td>
|
|
||||||
</tr>
|
|
||||||
{% endfor %}
|
|
||||||
</table>
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
{% extends 'base.html' %}
|
|
||||||
|
|
||||||
{% block navbar %}
|
|
||||||
{% with events_tab=events_tab_active members_tab=members_tab_active opponents_tab=opponents_tab_active venues_tab=venues_tab_active %}
|
|
||||||
{{ block.super }}
|
|
||||||
{% endwith %}
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block page_heading %}
|
|
||||||
{{ page_title }}
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block content %}
|
|
||||||
<ul class="list-group">
|
|
||||||
{% for object in object_list|dictsort:"name.lower" %}
|
|
||||||
<li class="list-group-item">{{ object }}</li>
|
|
||||||
{% endfor %}
|
|
||||||
</ul>
|
|
||||||
{% endblock %}
|
|
||||||
</html>
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
{% extends 'base.html' %}
|
|
||||||
|
|
||||||
{% block navbar %}
|
|
||||||
{% with events_tab=events_tab_active members_tab=members_tab_active opponents_tab=opponents_tab_active venues_tab=venues_tab_active %}
|
|
||||||
{{ block.super }}
|
|
||||||
{% endwith %}
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block page_heading %}
|
|
||||||
{{ page_title }}
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block content %}
|
|
||||||
<ul class="list-group">
|
|
||||||
{% for object in object_list|dictsort:"last_name.lower" %}
|
|
||||||
<li class="list-group-item">{{ object }}</li>
|
|
||||||
{% endfor %}
|
|
||||||
</ul>
|
|
||||||
{% endblock %}
|
|
||||||
</html>
|
|
||||||
@@ -1,49 +0,0 @@
|
|||||||
<table class="table table-sm my-0" style="min-height: 1rem">
|
|
||||||
<tbody id={{ table_id }}>
|
|
||||||
{% for form in formset %}
|
|
||||||
<tr data-player-id="{{ form.instance.player.id }}"
|
|
||||||
data-position="{{ form.instance.position }}"
|
|
||||||
data-order="{{ form.instance.order }}">
|
|
||||||
{{ form.id.as_hidden }}
|
|
||||||
{{ form.event.as_hidden }}
|
|
||||||
{{ form.order.as_hidden }}
|
|
||||||
{{ form.player.as_hidden }}
|
|
||||||
{{ form.teamsnap_id.as_hidden }}
|
|
||||||
|
|
||||||
<td class="col-1">
|
|
||||||
<div class="mx-1">
|
|
||||||
<span id="player-order-{{ form.instance.player.id }}">
|
|
||||||
{% if form.order.value > 0 %} {{ form.order.value }} {% endif %}
|
|
||||||
</span>
|
|
||||||
|
|
||||||
<span id="player-availability-{{ form.instance.player.id }}" class="{{ available_class }}">
|
|
||||||
{% if form.instance.event_availability == 2 %}
|
|
||||||
<i class="bi bi-circle-fill text-success"></i>
|
|
||||||
{% elif form.instance.event_availability == 1 %}
|
|
||||||
<i class="bi bi-circle-fill text-info"></i>
|
|
||||||
{% elif form.instance.event_availability == 0 %}
|
|
||||||
<i class="bi bi-circle-fill text-danger"></i>
|
|
||||||
{% else %}
|
|
||||||
<i class="bi bi-circle-fill text-secondary"></i>
|
|
||||||
{% endif %}
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
|
|
||||||
<th>
|
|
||||||
|
|
||||||
{{ form.instance.player.first_name }} {{ form.instance.player.last_name }}
|
|
||||||
<small class="text-muted fw-light">#{{ form.instance.player.jersey_number }}</small>
|
|
||||||
{# <br><code><small>{{ form.statline }}</small></code>#}
|
|
||||||
</th>
|
|
||||||
<td class="col-2">
|
|
||||||
{{ form.position }}
|
|
||||||
</td>
|
|
||||||
<td class="col-1 drag-handle">
|
|
||||||
<i class="bi bi-grip-vertical text-secondary"></i>
|
|
||||||
</td>
|
|
||||||
{# <td>{{ form.instance.position }}</td>#}
|
|
||||||
</tr>
|
|
||||||
{% endfor %}
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
1
benchcoach/templates/pages/about.html
Normal file
1
benchcoach/templates/pages/about.html
Normal file
@@ -0,0 +1 @@
|
|||||||
|
{% extends "base.html" %}
|
||||||
@@ -1,3 +1,7 @@
|
|||||||
|
{% extends "base.html" %}
|
||||||
|
{% load static %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="text-center my-2">
|
<div class="text-center my-2">
|
||||||
@@ -26,3 +30,4 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
{% endblock %}
|
||||||
19
benchcoach/templates/socialaccount/login.html
Normal file
19
benchcoach/templates/socialaccount/login.html
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
{% extends "socialaccount/base.html" %}
|
||||||
|
{% load i18n %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
{% if process == "connect" %}
|
||||||
|
<h1>{% blocktrans with provider.name as provider %}Connect {{ provider }}{% endblocktrans %}</h1>
|
||||||
|
|
||||||
|
<p>{% blocktrans with provider.name as provider %}You are about to connect a new third party account from {{ provider }}.{% endblocktrans %}</p>
|
||||||
|
{% else %}
|
||||||
|
<h1>{% blocktrans with provider.name as provider %}Sign In Via {{ provider }}{% endblocktrans %}</h1>
|
||||||
|
|
||||||
|
<p>{% blocktrans with provider.name as provider %}You are about to sign in using a third party account from {{ provider }}.{% endblocktrans %}</p>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
<form method="post">
|
||||||
|
{% csrf_token %}
|
||||||
|
<button class="btn btn-primary" type="submit">{% trans "Continue" %}</button>
|
||||||
|
</form>
|
||||||
|
{% endblock %}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
{% load socialaccount %}
|
||||||
|
|
||||||
|
{% providers_media_js %}
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
{% load socialaccount %}
|
||||||
|
{% load static %}
|
||||||
|
|
||||||
|
{% get_providers as socialaccount_providers %}
|
||||||
|
|
||||||
|
<ul class="list-group">
|
||||||
|
{% for provider in socialaccount_providers %}
|
||||||
|
{% if provider.id == "openid" %}
|
||||||
|
{% for brand in provider.get_brands %}
|
||||||
|
<li class="list-group-item">
|
||||||
|
<a title="{{brand.name}}"
|
||||||
|
class="socialaccount_provider {{provider.id}} {{brand.id}}"
|
||||||
|
href="{% provider_login_url provider.id openid=brand.openid_url process=process %}"
|
||||||
|
>{{brand.name}}</a>
|
||||||
|
</li>
|
||||||
|
{% endfor %}
|
||||||
|
{% endif %}
|
||||||
|
{% if provider.id == "teamsnap"%}
|
||||||
|
<li class="list-group-item">
|
||||||
|
<a title="{{provider.name}}" class="socialaccount_provider {{provider.id}}"
|
||||||
|
href="{% provider_login_url provider.id process=process scope=scope auth_params=auth_params %}">
|
||||||
|
<img src="{% static "images/teamsnap.svg" %}" style="height:1.5em;">
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
{% else %}
|
||||||
|
<li class="list-group-item">
|
||||||
|
<a title="{{provider.name}}" class="socialaccount_provider {{provider.id}}"
|
||||||
|
href="{% provider_login_url provider.id process=process scope=scope auth_params=auth_params %}">{{provider.name}}</a>
|
||||||
|
</li>
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
</ul>
|
||||||
34
benchcoach/templates/users/user_detail.html
Normal file
34
benchcoach/templates/users/user_detail.html
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
{% extends "base.html" %}
|
||||||
|
{% load static %}
|
||||||
|
|
||||||
|
{% block title %}User: {{ object.username }}{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<div class="container">
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-sm-12">
|
||||||
|
|
||||||
|
<h2>{{ object.username }}</h2>
|
||||||
|
{% if object.name %}
|
||||||
|
<p>{{ object.name }}</p>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{% if object == request.user %}
|
||||||
|
<!-- Action buttons -->
|
||||||
|
<div class="row">
|
||||||
|
|
||||||
|
<div class="col-sm-12">
|
||||||
|
<a class="btn btn-primary" href="{% url 'users:update' %}" role="button">My Info</a>
|
||||||
|
<a class="btn btn-primary" href="{% url 'account_email' %}" role="button">E-Mail</a>
|
||||||
|
<!-- Your Stuff: Custom user template urls -->
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<!-- End Action buttons -->
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
</div>
|
||||||
|
{% endblock content %}
|
||||||
17
benchcoach/templates/users/user_form.html
Normal file
17
benchcoach/templates/users/user_form.html
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
{% extends "base.html" %}
|
||||||
|
{% load crispy_forms_tags %}
|
||||||
|
|
||||||
|
{% block title %}{{ user.username }}{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<h1>{{ user.username }}</h1>
|
||||||
|
<form class="form-horizontal" method="post" action="{% url 'users:update' %}">
|
||||||
|
{% csrf_token %}
|
||||||
|
{{ form|crispy }}
|
||||||
|
<div class="control-group">
|
||||||
|
<div class="controls">
|
||||||
|
<button type="submit" class="btn btn-primary">Update</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
{% endblock %}
|
||||||
@@ -1,281 +0,0 @@
|
|||||||
from django.test import TestCase
|
|
||||||
from .models import Event, Player, Team, Venue, Positioning
|
|
||||||
from .forms import PositioningFormSet
|
|
||||||
from datetime import datetime
|
|
||||||
from django.urls import reverse
|
|
||||||
|
|
||||||
FIXTURES = ["blaseball"]
|
|
||||||
|
|
||||||
|
|
||||||
class TestEventModel(TestCase):
|
|
||||||
fixtures = FIXTURES
|
|
||||||
|
|
||||||
def test_query_event(self):
|
|
||||||
"""
|
|
||||||
Return the desired event
|
|
||||||
"""
|
|
||||||
event = Event.objects.get(id=1)
|
|
||||||
self.assertEqual("Chicago Firefighters", event.away_team.name)
|
|
||||||
self.assertEqual("Dallas Steaks", event.home_team.name)
|
|
||||||
self.assertEqual("George Fourman Stadium", event.venue.name)
|
|
||||||
self.assertEqual(
|
|
||||||
datetime(year=2020, month=8, day=24, hour=16, minute=0, second=1),
|
|
||||||
event.start,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class TestEventViews(TestCase):
|
|
||||||
fixtures = FIXTURES
|
|
||||||
|
|
||||||
def test_event_list(self):
|
|
||||||
response = self.client.get(reverse("schedule"))
|
|
||||||
self.assertEqual(200, response.status_code)
|
|
||||||
|
|
||||||
def test_event_edit(self):
|
|
||||||
response = self.client.get(reverse("edit event", args=[2]))
|
|
||||||
self.assertEqual(200, response.status_code)
|
|
||||||
|
|
||||||
# create new event
|
|
||||||
new_event_data = {
|
|
||||||
"home_team": 23,
|
|
||||||
"away_team": 24,
|
|
||||||
"start": datetime(year=2021, month=1, day=1, hour=9, minute=0, second=0),
|
|
||||||
"venue": 19,
|
|
||||||
}
|
|
||||||
|
|
||||||
response = self.client.post(
|
|
||||||
reverse("edit event", args=[0]), data=new_event_data
|
|
||||||
)
|
|
||||||
self.assertEqual(201, response.status_code)
|
|
||||||
new_event = Event.objects.get(id=response.context["id"])
|
|
||||||
self.assertEqual(new_event_data["home_team"], new_event.home_team.id)
|
|
||||||
self.assertEqual(new_event_data["away_team"], new_event.away_team_id)
|
|
||||||
self.assertEqual(new_event_data["start"], new_event.start)
|
|
||||||
|
|
||||||
# modify event
|
|
||||||
modified_event_data = {
|
|
||||||
"home_team": 23,
|
|
||||||
"away_team": 24,
|
|
||||||
"start": datetime(year=2021, month=1, day=1, hour=9, minute=0, second=0),
|
|
||||||
"venue": 19,
|
|
||||||
}
|
|
||||||
response = self.client.post(
|
|
||||||
reverse("edit event", args=[1]), data=modified_event_data
|
|
||||||
)
|
|
||||||
self.assertEqual(200, response.status_code)
|
|
||||||
self.assertEqual(1, response.context["id"])
|
|
||||||
modified_event = Event.objects.get(id=response.context["id"])
|
|
||||||
|
|
||||||
self.assertEqual(modified_event_data["home_team"], modified_event.home_team.id)
|
|
||||||
self.assertEqual(modified_event_data["away_team"], modified_event.away_team.id)
|
|
||||||
self.assertEqual(modified_event_data["start"], modified_event.start)
|
|
||||||
self.assertEqual(modified_event_data["venue"], modified_event.venue.id)
|
|
||||||
|
|
||||||
|
|
||||||
class TestVenueViews(TestCase):
|
|
||||||
fixtures = ["blaseball"]
|
|
||||||
|
|
||||||
def test_positioning_list(self):
|
|
||||||
response = self.client.get(reverse("edit lineup", args=[1]))
|
|
||||||
self.assertEqual(response.status_code, 200)
|
|
||||||
|
|
||||||
def test_positioning_formset(self):
|
|
||||||
event = 1
|
|
||||||
|
|
||||||
sample_data = [
|
|
||||||
# first player positioning
|
|
||||||
(1, Player.objects.get(id=1).id, "P"),
|
|
||||||
(2, Player.objects.get(id=2).id, "C"),
|
|
||||||
(3, Player.objects.get(id=3).id, "1B"),
|
|
||||||
]
|
|
||||||
data = {}
|
|
||||||
|
|
||||||
for i, (order, player, position) in enumerate(sample_data):
|
|
||||||
data[f"form-{i}-order"] = order
|
|
||||||
data[f"form-{i}-player"] = player
|
|
||||||
data[f"form-{i}-position"] = position
|
|
||||||
|
|
||||||
management = {
|
|
||||||
"form-INITIAL_FORMS": "0",
|
|
||||||
"form-TOTAL_FORMS": len(sample_data),
|
|
||||||
"form-MAX_NUM_FORMS": "",
|
|
||||||
}
|
|
||||||
|
|
||||||
formset = PositioningFormSet({**management, **data})
|
|
||||||
|
|
||||||
self.assertTrue(formset.is_valid())
|
|
||||||
for form in formset:
|
|
||||||
self.assertTrue(form.is_valid())
|
|
||||||
|
|
||||||
response = self.client.post(
|
|
||||||
reverse("edit lineup", args=[event]), {**management, **data}
|
|
||||||
)
|
|
||||||
|
|
||||||
self.assertEqual(response.status_code, 200)
|
|
||||||
|
|
||||||
for d in sample_data:
|
|
||||||
with self.subTest(d):
|
|
||||||
p = Positioning.objects.get(player_id=d[1], event_id=event)
|
|
||||||
self.assertEqual(d[0], p.order)
|
|
||||||
self.assertEqual(d[2], p.position)
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
class TestPlayerModel(TestCase):
|
|
||||||
fixtures = FIXTURES
|
|
||||||
|
|
||||||
def test_query_player(self):
|
|
||||||
"""
|
|
||||||
Return the desired player
|
|
||||||
"""
|
|
||||||
player = Player.objects.get(id=1)
|
|
||||||
self.assertEqual(player.first_name, "Edric")
|
|
||||||
self.assertEqual(player.last_name, "Tosser")
|
|
||||||
self.assertEqual(player.jersey_number, 1)
|
|
||||||
self.assertEqual(player.team.name, "Chicago Firefighters")
|
|
||||||
|
|
||||||
|
|
||||||
class TestPlayerViews(TestCase):
|
|
||||||
fixtures = FIXTURES
|
|
||||||
|
|
||||||
def test_player_list(self):
|
|
||||||
response = self.client.get(reverse("players list"))
|
|
||||||
self.assertEqual(response.status_code, 200)
|
|
||||||
|
|
||||||
def test_player_edit(self):
|
|
||||||
response = self.client.get(reverse("edit player", args=[1]))
|
|
||||||
self.assertEqual(response.status_code, 200)
|
|
||||||
|
|
||||||
# create new player
|
|
||||||
new_player_data = {
|
|
||||||
"first_name": "A new player first name",
|
|
||||||
"last_name": "A new player last name",
|
|
||||||
"jersey_number": 99,
|
|
||||||
"team": 1,
|
|
||||||
}
|
|
||||||
|
|
||||||
response = self.client.post(
|
|
||||||
reverse("edit player", args=[0]), data=new_player_data
|
|
||||||
)
|
|
||||||
self.assertEqual(201, response.status_code)
|
|
||||||
new_player = Player.objects.get(id=response.context["id"])
|
|
||||||
self.assertEqual(new_player_data["first_name"], new_player.first_name)
|
|
||||||
self.assertEqual(new_player_data["last_name"], new_player.last_name)
|
|
||||||
|
|
||||||
# modify player
|
|
||||||
modified_player_data = {
|
|
||||||
"first_name": "A changed player first name",
|
|
||||||
"last_name": "A changed player last name",
|
|
||||||
"jersey_number": 99,
|
|
||||||
"team": 1,
|
|
||||||
}
|
|
||||||
response = self.client.post(
|
|
||||||
reverse("edit player", args=[1]), data=modified_player_data
|
|
||||||
)
|
|
||||||
self.assertEqual(200, response.status_code)
|
|
||||||
self.assertEqual(1, response.context["id"])
|
|
||||||
modified_player = Player.objects.get(id=response.context["id"])
|
|
||||||
self.assertEqual(modified_player_data["first_name"], modified_player.first_name)
|
|
||||||
self.assertEqual(modified_player_data["last_name"], modified_player.last_name)
|
|
||||||
|
|
||||||
|
|
||||||
class TestTeamModel(TestCase):
|
|
||||||
fixtures = ["blaseball"]
|
|
||||||
|
|
||||||
def test_query_team(self):
|
|
||||||
"""
|
|
||||||
Return the desired team
|
|
||||||
"""
|
|
||||||
team = Team.objects.get(id=1)
|
|
||||||
self.assertEqual(team.name, "Chicago Firefighters")
|
|
||||||
|
|
||||||
|
|
||||||
class TestTeamViews(TestCase):
|
|
||||||
fixtures = ["blaseball"]
|
|
||||||
|
|
||||||
def test_team_list(self):
|
|
||||||
response = self.client.get(reverse("teams list"))
|
|
||||||
self.assertEqual(response.status_code, 200)
|
|
||||||
self.assertIn(
|
|
||||||
{"id": 1, "title": "Chicago Firefighters"}, response.context["items"]
|
|
||||||
)
|
|
||||||
self.assertIn({"id": 2, "title": "Boston Flowers"}, response.context["items"])
|
|
||||||
self.assertIn({"id": 24, "title": "Baltimore Crabs"}, response.context["items"])
|
|
||||||
|
|
||||||
def test_team_edit(self):
|
|
||||||
response = self.client.get(reverse("edit team", args=[1]))
|
|
||||||
self.assertEqual(response.status_code, 200)
|
|
||||||
|
|
||||||
# create new team
|
|
||||||
response = self.client.post(
|
|
||||||
reverse("edit team", args=[0]), data={"name": "A new team"}
|
|
||||||
)
|
|
||||||
self.assertEqual(201, response.status_code)
|
|
||||||
new_team = Team.objects.get(id=response.context["id"])
|
|
||||||
self.assertEqual(
|
|
||||||
"A new team",
|
|
||||||
new_team.name,
|
|
||||||
)
|
|
||||||
|
|
||||||
# modify team
|
|
||||||
response = self.client.post(
|
|
||||||
reverse("edit team", args=[1]), data={"name": "A different team name"}
|
|
||||||
)
|
|
||||||
self.assertEqual(200, response.status_code)
|
|
||||||
self.assertEqual(1, response.context["id"])
|
|
||||||
modified_team = Team.objects.get(id=response.context["id"])
|
|
||||||
self.assertEqual("A different team name", modified_team.name)
|
|
||||||
|
|
||||||
|
|
||||||
class TestVenueModel(TestCase):
|
|
||||||
fixtures = ["blaseball"]
|
|
||||||
|
|
||||||
def test_query_venue(self):
|
|
||||||
"""
|
|
||||||
Return the desired venue
|
|
||||||
"""
|
|
||||||
venue = Venue.objects.get(id=1)
|
|
||||||
self.assertEqual(venue.name, "Chesapeake Racetrack and Ballpark")
|
|
||||||
|
|
||||||
|
|
||||||
class TestVenueViews(TestCase):
|
|
||||||
fixtures = ["blaseball"]
|
|
||||||
|
|
||||||
def test_venue_list(self):
|
|
||||||
response = self.client.get(reverse("locations list"))
|
|
||||||
self.assertEqual(response.status_code, 200)
|
|
||||||
self.assertIn(
|
|
||||||
{"id": 1, "title": "Chesapeake Racetrack and Ballpark"},
|
|
||||||
response.context["items"],
|
|
||||||
)
|
|
||||||
self.assertIn(
|
|
||||||
{"id": 2, "title": "Tokyo Fitness Center"}, response.context["items"]
|
|
||||||
)
|
|
||||||
self.assertIn(
|
|
||||||
{"id": 25, "title": "ILB Historical Preservation Site"},
|
|
||||||
response.context["items"],
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_venue_edit(self):
|
|
||||||
response = self.client.get(reverse("edit venue", args=[1]))
|
|
||||||
self.assertEqual(response.status_code, 200)
|
|
||||||
|
|
||||||
# create new venue
|
|
||||||
response = self.client.post(
|
|
||||||
reverse("edit venue", args=[0]), data={"name": "A new venue"}
|
|
||||||
)
|
|
||||||
self.assertEqual(201, response.status_code)
|
|
||||||
new_venue = Venue.objects.get(id=response.context["id"])
|
|
||||||
self.assertEqual(
|
|
||||||
"A new venue",
|
|
||||||
new_venue.name,
|
|
||||||
)
|
|
||||||
|
|
||||||
# modify venue
|
|
||||||
response = self.client.post(
|
|
||||||
reverse("edit venue", args=[1]), data={"name": "A different venue name"}
|
|
||||||
)
|
|
||||||
self.assertEqual(200, response.status_code)
|
|
||||||
self.assertEqual(1, response.context["id"])
|
|
||||||
modified_venue = Venue.objects.get(id=response.context["id"])
|
|
||||||
self.assertEqual("A different venue name", modified_venue.name)
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user