Compare commits
	
		
			49 Commits
		
	
	
		
			206b5f6d46
			...
			add-fronte
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| fb1f6d2a33 | |||
| b219e3f6bc | |||
| eff598f475 | |||
| a3be509893 | |||
| 6af754afa6 | |||
| c99743701e | |||
| da0a04e0c6 | |||
| e4c6e9e414 | |||
| 2eaccc57b0 | |||
| 865ecd1ee0 | |||
| fed1bfa053 | |||
| dd92148db5 | |||
| 8bf2c32eb5 | |||
| d303039b1c | |||
| 67b9cbb048 | |||
| 5d36ad386e | |||
| 42bc391e57 | |||
| 850ca382ad | |||
| d2e0bcfb12 | |||
| b773d9df58 | |||
| dc6c295ee7 | |||
| d272915ef6 | |||
| cbc8062d92 | |||
| 02c04badac | |||
| 5756b736d8 | |||
| d4c0d47712 | |||
| 6f62b2026b | |||
| e6640a4083 | |||
| 81fbcc9281 | |||
| 2e891fc166 | |||
| b95d5dfb98 | |||
| 0c564ef146 | |||
| 048401b20a | |||
| aecf0d6a6e | |||
| a4ec5d0dbc | |||
| bec4e3716a | |||
| 03142bc3c3 | |||
| b0ef975c2b | |||
| 555608d8c6 | |||
| a7293c659d | |||
| f36e692361 | |||
| fe97f540a0 | |||
| c35b539c42 | |||
| bbe5e072b2 | |||
| 6fc2f623dc | |||
| 9481bd5fef | |||
| 4083165123 | |||
| 45bb2681c7 | |||
| dbb8ec3f9a | 
| @ -30,9 +30,7 @@ steps: | |||||||
|   image: plugins/docker |   image: plugins/docker | ||||||
|   settings: |   settings: | ||||||
|     repo: registry.kucharczyk.xyz/timetracker |     repo: registry.kucharczyk.xyz/timetracker | ||||||
|     tags: |     auto_tag: true | ||||||
|       - ${DRONE_COMMIT_REF} |  | ||||||
|       - ${DRONE_COMMIT_BRANCH} |  | ||||||
|   when: |   when: | ||||||
|     branch: |     branch: | ||||||
|       exclude: |       exclude: | ||||||
|  | |||||||
| @ -3,12 +3,10 @@ name: Django CI/CD | |||||||
| on: | on: | ||||||
|   push: |   push: | ||||||
|     branches: [ main ] |     branches: [ main ] | ||||||
|   pull_request: |     paths-ignore: [ 'README.md' ] | ||||||
|     branches: [ main ] |  | ||||||
|  |  | ||||||
| jobs: | jobs: | ||||||
|   build-and-push: |   build-and-push: | ||||||
|     needs: test |  | ||||||
|     runs-on: ubuntu-latest |     runs-on: ubuntu-latest | ||||||
|     steps: |     steps: | ||||||
|     - name: Checkout |     - name: Checkout | ||||||
|  | |||||||
							
								
								
									
										10
									
								
								.pre-commit-config.yaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								.pre-commit-config.yaml
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,10 @@ | |||||||
|  | repos: | ||||||
|  | -   repo: https://github.com/psf/black | ||||||
|  |     rev: 22.12.0 | ||||||
|  |     hooks: | ||||||
|  |     -   id: black | ||||||
|  | - repo: https://github.com/pycqa/isort | ||||||
|  |   rev: 5.12.0 | ||||||
|  |   hooks: | ||||||
|  |     - id: isort | ||||||
|  |       name: isort (python) | ||||||
							
								
								
									
										35
									
								
								CHANGELOG.md
									
									
									
									
									
								
							
							
						
						
									
										35
									
								
								CHANGELOG.md
									
									
									
									
									
								
							| @ -1,17 +1,5 @@ | |||||||
| ## Unreleased | ## Unreleased | ||||||
|  |  | ||||||
| ## Improved |  | ||||||
| * game overview: improve how editions and purchases are displayed |  | ||||||
| * add purchase: only allow choosing purchases of selected edition |  | ||||||
|  |  | ||||||
| ## 1.5.1 / 2023-11-14 21:10+01:00 |  | ||||||
|  |  | ||||||
| ## Improved |  | ||||||
| * Disallow choosing non-game purchase as related purchase |  | ||||||
| * Improve display of purchases |  | ||||||
|  |  | ||||||
| ## 1.5.0 / 2023-11-14 19:27+01:00 |  | ||||||
|  |  | ||||||
| ## New | ## New | ||||||
| * Add stat for finished this year's games | * Add stat for finished this year's games | ||||||
| * Add purchase types: | * Add purchase types: | ||||||
| @ -20,9 +8,6 @@ | |||||||
|   * Season Pass |   * Season Pass | ||||||
|   * Battle Pass |   * Battle Pass | ||||||
|  |  | ||||||
| ## Fixed |  | ||||||
| * Order purchases by date on game view |  | ||||||
|  |  | ||||||
| ## 1.4.0 / 2023-11-09 21:01+01:00 | ## 1.4.0 / 2023-11-09 21:01+01:00 | ||||||
|  |  | ||||||
| ### New | ### New | ||||||
| @ -110,24 +95,22 @@ | |||||||
|  |  | ||||||
| ### Enhancements | ### Enhancements | ||||||
| * Improve form appearance | * Improve form appearance | ||||||
| * Focus important fields on forms | * Add helper buttons next to datime fields | ||||||
| * Use the same form when editing a session as when adding a session |  | ||||||
| * Change recent session view to current year instead of last 30 days | * Change recent session view to current year instead of last 30 days | ||||||
| * Add a hacky way not to reload a page when starting or ending a session (https://git.kucharczyk.xyz/lukas/timetracker/issues/52) |  | ||||||
| * Improve session list (https://git.kucharczyk.xyz/lukas/timetracker/issues/53) |  | ||||||
|  |  | ||||||
| ### Fixes |  | ||||||
|  |  | ||||||
| * Fix session being wrongly considered in progress if it had a certain amount of manual hours (https://git.kucharczyk.xyz/lukas/timetracker/issues/58) |  | ||||||
| * Fix bug when filtering only manual sessions (https://git.kucharczyk.xyz/lukas/timetracker/issues/51) | * Fix bug when filtering only manual sessions (https://git.kucharczyk.xyz/lukas/timetracker/issues/51) | ||||||
|  | * Add copy button on Add session page to copy times between fields | ||||||
|  | * Use the same form when editing a session as when adding a session | ||||||
|  | * Add a hacky way not to reload a page when starting or ending a session (https://git.kucharczyk.xyz/lukas/timetracker/issues/52) | ||||||
|  | * Focus important fields on forms | ||||||
|  | * Improve session list (https://git.kucharczyk.xyz/lukas/timetracker/issues/53) | ||||||
|  | * Change fonts to IBM Plex | ||||||
|  | * Only use local WOFF2 font files | ||||||
|  |  | ||||||
| ## 1.0.3 / 2023-02-20 17:16+01:00 | ## 1.0.3 / 2023-02-20 17:16+01:00 | ||||||
|  |  | ||||||
| * Add wikidata ID and year for editions | * Add wikidata ID and year for editions | ||||||
| * Add icons for game, edition, purchase filters |  | ||||||
| * Allow filtering by game, edition, purchase from the session list | * Allow filtering by game, edition, purchase from the session list | ||||||
| * Allow editing filtered entities from session list | * Add icons for the above | ||||||
|  |  | ||||||
| ## 1.0.2 / 2023-02-18 21:48+01:00 | ## 1.0.2 / 2023-02-18 21:48+01:00 | ||||||
|  |  | ||||||
|  | |||||||
							
								
								
									
										10
									
								
								Makefile
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								Makefile
									
									
									
									
									
								
							| @ -1,18 +1,12 @@ | |||||||
| all: css migrate | all: migrate | ||||||
|  |  | ||||||
| initialize: npm css migrate sethookdir loadplatforms | initialize: npm migrate sethookdir loadplatforms | ||||||
|  |  | ||||||
| HTMLFILES := $(shell find games/templates -type f) | HTMLFILES := $(shell find games/templates -type f) | ||||||
|  |  | ||||||
| npm: | npm: | ||||||
| 	npm install | 	npm install | ||||||
|  |  | ||||||
| css: common/input.css |  | ||||||
| 	npx tailwindcss -i ./common/input.css -o  ./games/static/base.css |  | ||||||
|  |  | ||||||
| css-dev: css |  | ||||||
| 	npx tailwindcss -i ./common/input.css -o  ./games/static/base.css --watch |  | ||||||
|  |  | ||||||
| makemigrations: | makemigrations: | ||||||
| 	poetry run python manage.py makemigrations | 	poetry run python manage.py makemigrations | ||||||
|  |  | ||||||
|  | |||||||
							
								
								
									
										113
									
								
								common/input.css
									
									
									
									
									
								
							
							
						
						
									
										113
									
								
								common/input.css
									
									
									
									
									
								
							| @ -1,113 +0,0 @@ | |||||||
| @tailwind base; |  | ||||||
| @tailwind components; |  | ||||||
| @tailwind utilities; |  | ||||||
|  |  | ||||||
| @font-face { |  | ||||||
|   font-family: "IBM Plex Mono"; |  | ||||||
|   src: url("fonts/IBMPlexMono-regular.woff2") format("woff2"); |  | ||||||
|   font-weight: 400; |  | ||||||
|   font-style: normal; |  | ||||||
| } |  | ||||||
|  |  | ||||||
| @font-face { |  | ||||||
|   font-family: "IBM Plex Sans"; |  | ||||||
|   src: url("fonts/IBMPlexSans-Regular.woff2") format("woff2"); |  | ||||||
|   font-weight: 400; |  | ||||||
|   font-style: normal; |  | ||||||
| } |  | ||||||
|  |  | ||||||
| @font-face { |  | ||||||
|   font-family: "IBM Plex Serif"; |  | ||||||
|   src: url("fonts/IBMPlexSerif-Regular.woff2") format("woff2"); |  | ||||||
|   font-weight: 400; |  | ||||||
|   font-style: normal; |  | ||||||
| } |  | ||||||
|  |  | ||||||
| form label { |  | ||||||
|   @apply dark:text-slate-400; |  | ||||||
| } |  | ||||||
|  |  | ||||||
| .responsive-table { |  | ||||||
|   @apply dark:text-white mx-auto; |  | ||||||
| } |  | ||||||
|  |  | ||||||
| .responsive-table tr:nth-child(even) { |  | ||||||
|   @apply bg-slate-800 |  | ||||||
| } |  | ||||||
|  |  | ||||||
| .responsive-table tbody tr:nth-child(odd) { |  | ||||||
|   @apply bg-slate-900 |  | ||||||
| } |  | ||||||
|  |  | ||||||
| .responsive-table thead th { |  | ||||||
|   @apply text-left border-b-2 border-b-slate-500 text-xl; |  | ||||||
| } |  | ||||||
|  |  | ||||||
| .responsive-table thead th:not(:first-child), |  | ||||||
| .responsive-table td:not(:first-child) { |  | ||||||
|   @apply border-l border-l-slate-500; |  | ||||||
| } |  | ||||||
|  |  | ||||||
| @layer utilities { |  | ||||||
|   .max-w-20char { |  | ||||||
|     max-width: 20ch; |  | ||||||
|   } |  | ||||||
|   .max-w-35char { |  | ||||||
|     max-width: 40ch; |  | ||||||
|   } |  | ||||||
|   .max-w-40char { |  | ||||||
|     max-width: 40ch; |  | ||||||
|   } |  | ||||||
| } |  | ||||||
|  |  | ||||||
| form input, |  | ||||||
| select, |  | ||||||
| textarea { |  | ||||||
|   @apply dark:border dark:border-slate-900 dark:bg-slate-500 dark:text-slate-100; |  | ||||||
| } |  | ||||||
|  |  | ||||||
| form input:disabled, |  | ||||||
| select:disabled, |  | ||||||
| textarea:disabled { |  | ||||||
|   @apply dark:bg-slate-700 dark:text-slate-400; |  | ||||||
| } |  | ||||||
|  |  | ||||||
| .errorlist { |  | ||||||
|   @apply mt-4 mb-1 pl-3 py-2 bg-red-600 text-slate-200 w-[300px]; |  | ||||||
| } |  | ||||||
|  |  | ||||||
| @media screen and (min-width: 768px) { |  | ||||||
|   form input, |  | ||||||
|   select, |  | ||||||
|   textarea { |  | ||||||
|     width: 300px; |  | ||||||
|   } |  | ||||||
| } |  | ||||||
|  |  | ||||||
| @media screen and (max-width: 768px) { |  | ||||||
|   form input, |  | ||||||
|   select, |  | ||||||
|   textarea { |  | ||||||
|     width: 150px; |  | ||||||
|   } |  | ||||||
| } |  | ||||||
|  |  | ||||||
| #button-container button { |  | ||||||
|   @apply mx-1; |  | ||||||
| } |  | ||||||
|  |  | ||||||
| th { |  | ||||||
|   @apply text-right; |  | ||||||
| } |  | ||||||
|  |  | ||||||
| th label { |  | ||||||
|   @apply mr-4; |  | ||||||
| } |  | ||||||
|  |  | ||||||
| .basic-button-container { |  | ||||||
|   @apply flex space-x-2 justify-center; |  | ||||||
| } |  | ||||||
|  |  | ||||||
| .basic-button { |  | ||||||
|   @apply inline-block px-6 py-2.5 bg-blue-600 text-white font-medium text-xs leading-tight uppercase rounded shadow-md hover:bg-blue-700 hover:shadow-lg focus:bg-blue-700 focus:shadow-lg focus:outline-none focus:ring-0 active:bg-blue-800 active:shadow-lg transition duration-150 ease-in-out; |  | ||||||
| } |  | ||||||
							
								
								
									
										17
									
								
								frontend/.eslintrc.cjs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								frontend/.eslintrc.cjs
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,17 @@ | |||||||
|  | module.exports = { | ||||||
|  |   env: { | ||||||
|  |     browser: true, | ||||||
|  |     es2021: true | ||||||
|  |   }, | ||||||
|  |   extends: ["eslint/recommended", "plugin:react/recommended", "plugin:prettier/recommended"], | ||||||
|  |   overrides: [], | ||||||
|  |   parserOptions: { | ||||||
|  |     ecmaVersion: "latest", | ||||||
|  |     sourceType: "module" | ||||||
|  |   }, | ||||||
|  |   plugins: ["react"], | ||||||
|  |   rules: {}, | ||||||
|  |   parserOptions: { | ||||||
|  |     ecmaFeatures: { jsx: true } | ||||||
|  |   } | ||||||
|  | }; | ||||||
							
								
								
									
										24
									
								
								frontend/.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										24
									
								
								frontend/.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @ -0,0 +1,24 @@ | |||||||
|  | # Logs | ||||||
|  | logs | ||||||
|  | *.log | ||||||
|  | npm-debug.log* | ||||||
|  | yarn-debug.log* | ||||||
|  | yarn-error.log* | ||||||
|  | pnpm-debug.log* | ||||||
|  | lerna-debug.log* | ||||||
|  |  | ||||||
|  | node_modules | ||||||
|  | dist | ||||||
|  | dist-ssr | ||||||
|  | *.local | ||||||
|  |  | ||||||
|  | # Editor directories and files | ||||||
|  | .vscode/* | ||||||
|  | !.vscode/extensions.json | ||||||
|  | .idea | ||||||
|  | .DS_Store | ||||||
|  | *.suo | ||||||
|  | *.ntvs* | ||||||
|  | *.njsproj | ||||||
|  | *.sln | ||||||
|  | *.sw? | ||||||
							
								
								
									
										9
									
								
								frontend/.prettierrc
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								frontend/.prettierrc
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,9 @@ | |||||||
|  | { | ||||||
|  |     "semi": true, | ||||||
|  |     "tabWidth": 2, | ||||||
|  |     "printWidth": 100, | ||||||
|  |     "singleQuote": true, | ||||||
|  |     "trailingComma": "none", | ||||||
|  |     "bracketSameLine": false, | ||||||
|  |     "singleAttributePerLine": true | ||||||
|  | } | ||||||
							
								
								
									
										17
									
								
								frontend/index.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								frontend/index.html
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,17 @@ | |||||||
|  | <!DOCTYPE html> | ||||||
|  | <html lang="en"> | ||||||
|  |   <head> | ||||||
|  |     <meta charset="UTF-8" /> | ||||||
|  |     <meta name="description" content="Self-hosted time-tracker."/> | ||||||
|  |     <meta name="keywords" content="time, tracking, video games, self-hosted"/> | ||||||
|  |     <meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||||||
|  |     <!-- TODO: replace with own icon --> | ||||||
|  |     <!-- <link rel="icon" type="image/svg+xml" href="/vite.svg" /> --> | ||||||
|  |     <link rel="stylesheet" href="https://rsms.me/inter/inter.css"/> | ||||||
|  |     <title>Timetracker</title> | ||||||
|  |   </head> | ||||||
|  |   <body class="dark"> | ||||||
|  |     <div id="root"></div> | ||||||
|  |     <script type="module" src="/src/main.jsx"></script> | ||||||
|  |   </body> | ||||||
|  | </html> | ||||||
							
								
								
									
										29
									
								
								frontend/package.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										29
									
								
								frontend/package.json
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,29 @@ | |||||||
|  | { | ||||||
|  |   "name": "frontend", | ||||||
|  |   "private": true, | ||||||
|  |   "version": "0.0.0", | ||||||
|  |   "type": "module", | ||||||
|  |   "scripts": { | ||||||
|  |     "dev": "vite", | ||||||
|  |     "build": "vite build", | ||||||
|  |     "preview": "vite preview" | ||||||
|  |   }, | ||||||
|  |   "dependencies": { | ||||||
|  |     "autoprefixer": "^10.4.13", | ||||||
|  |     "postcss": "^8.4.21", | ||||||
|  |     "react": "^18.2.0", | ||||||
|  |     "react-dom": "^18.2.0", | ||||||
|  |     "tailwindcss": "^3.2.4" | ||||||
|  |   }, | ||||||
|  |   "devDependencies": { | ||||||
|  |     "@types/react": "^18.0.26", | ||||||
|  |     "@types/react-dom": "^18.0.9", | ||||||
|  |     "@vitejs/plugin-react": "^3.0.0", | ||||||
|  |     "eslint": "^8.32.0", | ||||||
|  |     "eslint-plugin-import": "^2.27.5", | ||||||
|  |     "eslint-plugin-jsx-a11y": "^6.7.1", | ||||||
|  |     "eslint-plugin-react": "^7.32.1", | ||||||
|  |     "eslint-plugin-react-hooks": "^4.6.0", | ||||||
|  |     "vite": "^4.0.0" | ||||||
|  |   } | ||||||
|  | } | ||||||
							
								
								
									
										6
									
								
								frontend/postcss.config.cjs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								frontend/postcss.config.cjs
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,6 @@ | |||||||
|  | module.exports = { | ||||||
|  |   plugins: { | ||||||
|  |     tailwindcss: {}, | ||||||
|  |     autoprefixer: {}, | ||||||
|  |   }, | ||||||
|  | } | ||||||
							
								
								
									
										0
									
								
								frontend/src/App.css
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								frontend/src/App.css
									
									
									
									
									
										Normal file
									
								
							
							
								
								
									
										42
									
								
								frontend/src/App.jsx
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										42
									
								
								frontend/src/App.jsx
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,42 @@ | |||||||
|  | import { useState } from 'react' | ||||||
|  | import './App.css' | ||||||
|  |  | ||||||
|  | function App() { | ||||||
|  |    | ||||||
|  |  | ||||||
|  |   return ( | ||||||
|  |     <> | ||||||
|  |     <div className="dark:bg-gray-800 min-h-screen"> | ||||||
|  |             <nav className="mb-4 bg-white dark:bg-gray-900 border-gray-200 rounded"> | ||||||
|  |                 <div className="container flex flex-wrap items-center justify-between mx-auto"> | ||||||
|  |                     <a href="{% url 'index' %}" className="flex items-center"> | ||||||
|  |                         <span className="text-4xl">⌚</span> | ||||||
|  |                         <span className="self-center text-xl font-semibold whitespace-nowrap text-white">Timetracker</span> | ||||||
|  |                     </a> | ||||||
|  |                     <div className="w-full md:block md:w-auto"> | ||||||
|  |                         <ul | ||||||
|  |                             className="flex flex-col md:flex-row p-4 mt-4 dark:text-white"> | ||||||
|  |                             <li><a className="block py-2 pl-3 pr-4 hover:underline" href="{% url 'add_game' %}">New Game</a></li> | ||||||
|  |                             <li><a className="block py-2 pl-3 pr-4 hover:underline" href="{% url 'add_platform' %}">New Platform</a></li> | ||||||
|  |                             {/* {% if game_available and platform_available %} */} | ||||||
|  |                                 <li><a className="block py-2 pl-3 pr-4 hover:underline" href="{% url 'add_purchase' %}">New Purchase</a></li> | ||||||
|  |                             {/* {% endif %} */} | ||||||
|  |                             {/* {% if purchase_available %} */} | ||||||
|  |                                 <li><a className="block py-2 pl-3 pr-4 hover:underline" href="{% url 'add_session' %}">New Session</a></li> | ||||||
|  |                             {/* {% endif %} */} | ||||||
|  |                             {/* {% if session_count > 0 %} */} | ||||||
|  |                                 <li><a className="block py-2 pl-3 pr-4 hover:underline" href="{% url 'list_sessions' %}">All Sessions</a></li> | ||||||
|  |                             {/* {% endif %} */} | ||||||
|  |                         </ul> | ||||||
|  |                     </div> | ||||||
|  |                 </div> | ||||||
|  |             </nav> | ||||||
|  |             {/* {% block content %}No content here.{% endblock content %} */} | ||||||
|  |         </div> | ||||||
|  |         {/* {% load version %} */} | ||||||
|  |         {/* <span className="fixed left-2 bottom-2 text-xs text-slate-300 dark:text-slate-600">{% version %} ({% version_date %})</span> */} | ||||||
|  |         </> | ||||||
|  |   ) | ||||||
|  | } | ||||||
|  |  | ||||||
|  | export default App; | ||||||
							
								
								
									
										71
									
								
								frontend/src/components/Nav.jsx
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										71
									
								
								frontend/src/components/Nav.jsx
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,71 @@ | |||||||
|  | import { Link } from 'react-router-dom'; | ||||||
|  |  | ||||||
|  | function Nav() { | ||||||
|  |   return ( | ||||||
|  |     <nav className="mb-4 bg-white dark:bg-gray-900 border-gray-200 rounded"> | ||||||
|  |       <div className="container flex flex-wrap items-center justify-between mx-auto"> | ||||||
|  |         <Link | ||||||
|  |           to="/" | ||||||
|  |           className="flex items-center" | ||||||
|  |         > | ||||||
|  |           <span className="text-4xl">⌚</span> | ||||||
|  |           <span className="self-center text-xl font-semibold whitespace-nowrap text-white"> | ||||||
|  |             Timetracker | ||||||
|  |           </span> | ||||||
|  |         </Link> | ||||||
|  |         <div className="w-full md:block md:w-auto"> | ||||||
|  |           <ul className="flex flex-col md:flex-row p-4 mt-4 dark:text-white"> | ||||||
|  |             <li> | ||||||
|  |               <a | ||||||
|  |                 className="block py-2 pl-3 pr-4 hover:underline" | ||||||
|  |                 href="{% url 'add_game' %}" | ||||||
|  |               > | ||||||
|  |                 New Game | ||||||
|  |               </a> | ||||||
|  |             </li> | ||||||
|  |             <li> | ||||||
|  |               <a | ||||||
|  |                 className="block py-2 pl-3 pr-4 hover:underline" | ||||||
|  |                 href="{% url 'add_platform' %}" | ||||||
|  |               > | ||||||
|  |                 New Platform | ||||||
|  |               </a> | ||||||
|  |             </li> | ||||||
|  |             {/* {% if game_available and platform_available %} */} | ||||||
|  |             <li> | ||||||
|  |               <a | ||||||
|  |                 className="block py-2 pl-3 pr-4 hover:underline" | ||||||
|  |                 href="{% url 'add_purchase' %}" | ||||||
|  |               > | ||||||
|  |                 New Purchase | ||||||
|  |               </a> | ||||||
|  |             </li> | ||||||
|  |             {/* {% endif %} */} | ||||||
|  |             {/* {% if purchase_available %} */} | ||||||
|  |             <li> | ||||||
|  |               <a | ||||||
|  |                 className="block py-2 pl-3 pr-4 hover:underline" | ||||||
|  |                 href="{% url 'add_session' %}" | ||||||
|  |               > | ||||||
|  |                 New Session | ||||||
|  |               </a> | ||||||
|  |             </li> | ||||||
|  |             {/* {% endif %} */} | ||||||
|  |             {/* {% if session_count > 0 %} */} | ||||||
|  |             <li> | ||||||
|  |               <Link | ||||||
|  |                 className="block py-2 pl-3 pr-4 hover:underline" | ||||||
|  |                 to="/sessions" | ||||||
|  |               > | ||||||
|  |                 All Sessions | ||||||
|  |               </Link> | ||||||
|  |             </li> | ||||||
|  |             {/* {% endif %} */} | ||||||
|  |           </ul> | ||||||
|  |         </div> | ||||||
|  |       </div> | ||||||
|  |     </nav> | ||||||
|  |   ); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | export default Nav; | ||||||
							
								
								
									
										162
									
								
								frontend/src/components/SessionList.jsx
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										162
									
								
								frontend/src/components/SessionList.jsx
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,162 @@ | |||||||
|  | export default function SessionList() { | ||||||
|  |   const data = [ | ||||||
|  |     { | ||||||
|  |         "url": "http://localhost:8000/api/sessions/25/", | ||||||
|  |         "timestamp_start": "2020-01-01T00:00:00+01:00", | ||||||
|  |         "timestamp_end": null, | ||||||
|  |         "duration_manual": "12:00:00", | ||||||
|  |         "duration_calculated": "00:00:00", | ||||||
|  |         "note": "", | ||||||
|  |         "purchase": "http://localhost:8000/api/purchases/3/" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "url": "http://localhost:8000/api/sessions/26/", | ||||||
|  |         "timestamp_start": "2022-12-31T15:25:00+01:00", | ||||||
|  |         "timestamp_end": "2022-12-31T17:25:00+01:00", | ||||||
|  |         "duration_manual": "00:00:00", | ||||||
|  |         "duration_calculated": "02:00:00", | ||||||
|  |         "note": "", | ||||||
|  |         "purchase": "http://localhost:8000/api/purchases/2/" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "url": "http://localhost:8000/api/sessions/27/", | ||||||
|  |         "timestamp_start": "2023-01-01T23:00:00+01:00", | ||||||
|  |         "timestamp_end": "2023-01-02T00:28:00+01:00", | ||||||
|  |         "duration_manual": "00:00:00", | ||||||
|  |         "duration_calculated": "01:28:00", | ||||||
|  |         "note": "", | ||||||
|  |         "purchase": "http://localhost:8000/api/purchases/3/" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "url": "http://localhost:8000/api/sessions/28/", | ||||||
|  |         "timestamp_start": "2023-01-02T22:08:00+01:00", | ||||||
|  |         "timestamp_end": "2023-01-03T01:08:00+01:00", | ||||||
|  |         "duration_manual": "00:00:00", | ||||||
|  |         "duration_calculated": "03:00:00", | ||||||
|  |         "note": "", | ||||||
|  |         "purchase": "http://localhost:8000/api/purchases/3/" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "url": "http://localhost:8000/api/sessions/29/", | ||||||
|  |         "timestamp_start": "2023-01-03T22:36:00+01:00", | ||||||
|  |         "timestamp_end": "2023-01-04T00:12:00+01:00", | ||||||
|  |         "duration_manual": "00:00:00", | ||||||
|  |         "duration_calculated": "01:36:00", | ||||||
|  |         "note": "", | ||||||
|  |         "purchase": "http://localhost:8000/api/purchases/3/" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "url": "http://localhost:8000/api/sessions/30/", | ||||||
|  |         "timestamp_start": "2023-01-04T20:35:00+01:00", | ||||||
|  |         "timestamp_end": "2023-01-04T22:36:00+01:00", | ||||||
|  |         "duration_manual": "00:00:00", | ||||||
|  |         "duration_calculated": "02:01:00", | ||||||
|  |         "note": "", | ||||||
|  |         "purchase": "http://localhost:8000/api/purchases/3/" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "url": "http://localhost:8000/api/sessions/31/", | ||||||
|  |         "timestamp_start": "2023-01-06T18:48:00+01:00", | ||||||
|  |         "timestamp_end": "2023-01-06T23:39:00+01:00", | ||||||
|  |         "duration_manual": "00:00:00", | ||||||
|  |         "duration_calculated": "04:51:00", | ||||||
|  |         "note": "", | ||||||
|  |         "purchase": "http://localhost:8000/api/purchases/3/" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "url": "http://localhost:8000/api/sessions/32/", | ||||||
|  |         "timestamp_start": "2023-01-07T23:49:00+01:00", | ||||||
|  |         "timestamp_end": "2023-01-08T01:43:00+01:00", | ||||||
|  |         "duration_manual": "00:00:00", | ||||||
|  |         "duration_calculated": "01:54:00", | ||||||
|  |         "note": "", | ||||||
|  |         "purchase": "http://localhost:8000/api/purchases/3/" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "url": "http://localhost:8000/api/sessions/33/", | ||||||
|  |         "timestamp_start": "2023-01-08T16:21:00+01:00", | ||||||
|  |         "timestamp_end": "2023-01-08T18:27:00+01:00", | ||||||
|  |         "duration_manual": "00:00:00", | ||||||
|  |         "duration_calculated": "02:06:00", | ||||||
|  |         "note": "", | ||||||
|  |         "purchase": "http://localhost:8000/api/purchases/3/" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "url": "http://localhost:8000/api/sessions/34/", | ||||||
|  |         "timestamp_start": "2023-01-08T19:04:00+01:00", | ||||||
|  |         "timestamp_end": "2023-01-08T22:03:00+01:00", | ||||||
|  |         "duration_manual": "00:00:00", | ||||||
|  |         "duration_calculated": "02:59:00", | ||||||
|  |         "note": "", | ||||||
|  |         "purchase": "http://localhost:8000/api/purchases/3/" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "url": "http://localhost:8000/api/sessions/35/", | ||||||
|  |         "timestamp_start": "2023-01-09T19:35:48+01:00", | ||||||
|  |         "timestamp_end": "2023-01-09T22:13:20.519058+01:00", | ||||||
|  |         "duration_manual": "00:00:00", | ||||||
|  |         "duration_calculated": "02:37:32.519058", | ||||||
|  |         "note": "", | ||||||
|  |         "purchase": "http://localhost:8000/api/purchases/3/" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "url": "http://localhost:8000/api/sessions/36/", | ||||||
|  |         "timestamp_start": "2023-01-10T15:50:12+01:00", | ||||||
|  |         "timestamp_end": "2023-01-10T17:03:45.424429+01:00", | ||||||
|  |         "duration_manual": "00:00:00", | ||||||
|  |         "duration_calculated": "01:13:33.424429", | ||||||
|  |         "note": "", | ||||||
|  |         "purchase": "http://localhost:8000/api/purchases/4/" | ||||||
|  |     } | ||||||
|  |   ] | ||||||
|  |   const header = ["url", "timestamp_start", "timestamp_end", "duration_manual", "duration_calculated", "note", "purchase"] | ||||||
|  |   // const header = ["Name", "Platform", "Start", "End", "Duration", "Manage"] | ||||||
|  |   return ( | ||||||
|  |         <> | ||||||
|  |           <div id="session-table" className="gap-4 shadow rounded-xl max-w-screen-lg mx-auto dark:bg-slate-700 p-2 justify-center"> | ||||||
|  |               {header.map(column => { | ||||||
|  |                 <div className="dark:border-white dark:text-slate-300 text-lg">{column}</div> | ||||||
|  |               })} | ||||||
|  |           {data.map(session => { | ||||||
|  |               <> | ||||||
|  |                 <div className="dark:text-white overflow-hidden text-ellipsis whitespace-nowrap"> | ||||||
|  |                 <a className="hover:underline" href=""> | ||||||
|  |                   { session.url } | ||||||
|  |                 </a> | ||||||
|  |                 <div className="dark:text-white overflow-hidden text-ellipsis whitespace-nowrap"> | ||||||
|  |                 <a className="hover:underline" href=""> | ||||||
|  |                   { session.timestamp_start } | ||||||
|  |                 </a> | ||||||
|  |               </div> | ||||||
|  |               <div className="dark:text-white overflow-hidden text-ellipsis whitespace-nowrap"> | ||||||
|  |                 <a className="hover:underline" href=""> | ||||||
|  |                   { session.timestamp_end } | ||||||
|  |                 </a> | ||||||
|  |               </div> | ||||||
|  |               <div className="dark:text-white overflow-hidden text-ellipsis whitespace-nowrap"> | ||||||
|  |                 <a className="hover:underline" href=""> | ||||||
|  |                   { session.duration_manual } | ||||||
|  |                 </a> | ||||||
|  |               </div> | ||||||
|  |               <div className="dark:text-white overflow-hidden text-ellipsis whitespace-nowrap"> | ||||||
|  |                 <a className="hover:underline" href=""> | ||||||
|  |                   { session.duration_calculated } | ||||||
|  |                 </a> | ||||||
|  |               </div> | ||||||
|  |               <div className="dark:text-white overflow-hidden text-ellipsis whitespace-nowrap"> | ||||||
|  |                 <a className="hover:underline" href=""> | ||||||
|  |                   { session.note } | ||||||
|  |                 </a> | ||||||
|  |               </div> | ||||||
|  |               <div className="dark:text-white overflow-hidden text-ellipsis whitespace-nowrap"> | ||||||
|  |                 <a className="hover:underline" href=""> | ||||||
|  |                   { session.purchase } | ||||||
|  |                 </a> | ||||||
|  |               </div> | ||||||
|  |               </div> | ||||||
|  |               </> | ||||||
|  |           })} | ||||||
|  |           </div> | ||||||
|  |         </> | ||||||
|  |   ) | ||||||
|  | } | ||||||
							
								
								
									
										16
									
								
								frontend/src/error-page.jsx
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								frontend/src/error-page.jsx
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,16 @@ | |||||||
|  | import { useRouteError } from "react-router-dom"; | ||||||
|  |  | ||||||
|  | export default function ErrorPage() { | ||||||
|  |     const error = useRouteError() | ||||||
|  |     console.error(error) | ||||||
|  |  | ||||||
|  |     return ( | ||||||
|  |         <div className="container text-center"> | ||||||
|  |             <h1 className="text-3xl">Oops!</h1> | ||||||
|  |             <p>Sorry, an unexpected error has occurred.</p> | ||||||
|  |             <p> | ||||||
|  |                 <i>{error.statusText || error.message}</i> | ||||||
|  |             </p> | ||||||
|  |         </div> | ||||||
|  |     ) | ||||||
|  | } | ||||||
							
								
								
									
										22
									
								
								frontend/src/index.css
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								frontend/src/index.css
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,22 @@ | |||||||
|  | @tailwind base; | ||||||
|  | @tailwind components; | ||||||
|  | @tailwind utilities; | ||||||
|  |  | ||||||
|  | form label { | ||||||
|  |   @apply dark:text-slate-400; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | form input, | ||||||
|  | select, | ||||||
|  | textarea { | ||||||
|  |   @apply dark:border dark:border-slate-900 dark:bg-slate-500 dark:text-slate-100; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | #session-table { | ||||||
|  |   display: grid; | ||||||
|  |   grid-template-columns: 3fr 1fr repeat(2, 2fr) 0.5fr 1fr; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | #button-container button { | ||||||
|  |   @apply mx-1; | ||||||
|  | } | ||||||
							
								
								
									
										34
									
								
								frontend/src/main.jsx
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										34
									
								
								frontend/src/main.jsx
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,34 @@ | |||||||
|  | import React from 'react' | ||||||
|  | import ReactDOM from 'react-dom/client' | ||||||
|  | import App from './App' | ||||||
|  | import './index.css' | ||||||
|  | import { createBrowserRouter, RouterProvider } from 'react-router-dom' | ||||||
|  | // import { loader as sessionLoader } from './routes/sessions' | ||||||
|  | import ErrorPage from "./error-page" | ||||||
|  | import SessionList from './components/SessionList' | ||||||
|  | // import Session from './routes/sessions' | ||||||
|  |  | ||||||
|  | const router = createBrowserRouter([ | ||||||
|  |   { | ||||||
|  |     path: "/", | ||||||
|  |     element: <App />, | ||||||
|  |     errorElement: <ErrorPage />, | ||||||
|  |     // loader: sessionLoader, | ||||||
|  |     children:  [ | ||||||
|  |       { | ||||||
|  |         path: "sessions/", | ||||||
|  |         element: <SessionList /> | ||||||
|  |       } | ||||||
|  |     ] | ||||||
|  |   }, | ||||||
|  |   // { | ||||||
|  |   //   path: "sessions", | ||||||
|  |   //   element: <SessionList /> | ||||||
|  |   // } | ||||||
|  | ]) | ||||||
|  |  | ||||||
|  | ReactDOM.createRoot(document.getElementById('root')).render( | ||||||
|  |   <React.StrictMode> | ||||||
|  |     <RouterProvider router={router} /> | ||||||
|  |   </React.StrictMode>, | ||||||
|  | ) | ||||||
							
								
								
									
										17
									
								
								frontend/src/services/ApiService.jsx
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								frontend/src/services/ApiService.jsx
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,17 @@ | |||||||
|  | export async function api(url) { | ||||||
|  |     const response = await fetch(url); | ||||||
|  |     if (response.ok) { | ||||||
|  |       const jsonValue = await response.json(); | ||||||
|  |       return Promise.resolve(jsonValue); | ||||||
|  |     } else { | ||||||
|  |       return Promise.reject('Response was not OK.'); | ||||||
|  |     } | ||||||
|  |   } | ||||||
|  |  | ||||||
|  | export async function getSession(sessionId) { | ||||||
|  |     return await api(`/api/sessions/${sessionId}/`);  | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   export async function getSessionList() { | ||||||
|  |     return await api(`/api/sessions/`);  | ||||||
|  |   } | ||||||
							
								
								
									
										12
									
								
								frontend/tailwind.config.cjs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								frontend/tailwind.config.cjs
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,12 @@ | |||||||
|  | /** @type {import('tailwindcss').Config} */ | ||||||
|  | module.exports = { | ||||||
|  |   darkMode: "class", | ||||||
|  |   content: ["./index.html", "./src/**/*.{js,ts,jsx,tsx}"], | ||||||
|  |   theme: { | ||||||
|  |     fontFamily: { | ||||||
|  |       sans: ["Inter", "sans-serif"], | ||||||
|  |     }, | ||||||
|  |     extend: {}, | ||||||
|  |   }, | ||||||
|  |   plugins: [require("@tailwindcss/typography"), require("@tailwindcss/forms")], | ||||||
|  | }; | ||||||
							
								
								
									
										12
									
								
								frontend/vite.config.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								frontend/vite.config.js
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,12 @@ | |||||||
|  | import { defineConfig } from 'vite'; | ||||||
|  | import react from '@vitejs/plugin-react'; | ||||||
|  |  | ||||||
|  | // https://vitejs.dev/config/ | ||||||
|  | export default defineConfig({ | ||||||
|  |   plugins: [react()], | ||||||
|  |   server: { | ||||||
|  |     proxy: { | ||||||
|  |       "/api": "http://127.0.0.1:8001", | ||||||
|  |     }, | ||||||
|  |   }, | ||||||
|  | }); | ||||||
| @ -9,6 +9,11 @@ custom_datetime_widget = forms.DateTimeInput( | |||||||
| ) | ) | ||||||
| autofocus_input_widget = forms.TextInput(attrs={"autofocus": "autofocus"}) | autofocus_input_widget = forms.TextInput(attrs={"autofocus": "autofocus"}) | ||||||
|  |  | ||||||
|  | custom_date_widget = forms.DateInput(attrs={"type": "date"}) | ||||||
|  | custom_datetime_widget = forms.DateTimeInput( | ||||||
|  |     attrs={"type": "datetime-local"}, format="%Y-%m-%d %H:%M" | ||||||
|  | ) | ||||||
|  |  | ||||||
|  |  | ||||||
| class SessionForm(forms.ModelForm): | class SessionForm(forms.ModelForm): | ||||||
|     # purchase = forms.ModelChoiceField( |     # purchase = forms.ModelChoiceField( | ||||||
| @ -82,7 +87,6 @@ class PurchaseForm(forms.ModelForm): | |||||||
|         widgets = { |         widgets = { | ||||||
|             "date_purchased": custom_date_widget, |             "date_purchased": custom_date_widget, | ||||||
|             "date_refunded": custom_date_widget, |             "date_refunded": custom_date_widget, | ||||||
|             "date_finished": custom_date_widget, |  | ||||||
|         } |         } | ||||||
|         model = Purchase |         model = Purchase | ||||||
|         fields = [ |         fields = [ | ||||||
| @ -147,7 +151,7 @@ class EditionForm(forms.ModelForm): | |||||||
|  |  | ||||||
|     class Meta: |     class Meta: | ||||||
|         model = Edition |         model = Edition | ||||||
|         fields = ["game", "name", "sort_name", "platform", "year_released", "wikidata"] |         fields = ["game", "name", "platform", "year_released", "wikidata"] | ||||||
|  |  | ||||||
|  |  | ||||||
| class GameForm(forms.ModelForm): | class GameForm(forms.ModelForm): | ||||||
|  | |||||||
| @ -1,7 +1,7 @@ | |||||||
| # Generated by Django 4.1.5 on 2023-01-19 18:30 | # Generated by Django 4.1.5 on 2023-01-19 18:30 | ||||||
|  |  | ||||||
| from django.db import migrations, models |  | ||||||
| import django.db.models.deletion | import django.db.models.deletion | ||||||
|  | from django.db import migrations, models | ||||||
|  |  | ||||||
|  |  | ||||||
| class Migration(migrations.Migration): | class Migration(migrations.Migration): | ||||||
|  | |||||||
| @ -1,7 +1,7 @@ | |||||||
| # Generated by Django 4.1.5 on 2023-02-18 16:29 | # Generated by Django 4.1.5 on 2023-02-18 16:29 | ||||||
|  |  | ||||||
| from django.db import migrations, models |  | ||||||
| import django.db.models.deletion | import django.db.models.deletion | ||||||
|  | from django.db import migrations, models | ||||||
|  |  | ||||||
|  |  | ||||||
| class Migration(migrations.Migration): | class Migration(migrations.Migration): | ||||||
|  | |||||||
| @ -1,7 +1,7 @@ | |||||||
| # Generated by Django 4.1.5 on 2023-02-18 19:06 | # Generated by Django 4.1.5 on 2023-02-18 19:06 | ||||||
|  |  | ||||||
| from django.db import migrations, models |  | ||||||
| import django.db.models.deletion | import django.db.models.deletion | ||||||
|  | from django.db import migrations, models | ||||||
|  |  | ||||||
|  |  | ||||||
| class Migration(migrations.Migration): | class Migration(migrations.Migration): | ||||||
|  | |||||||
| @ -1,7 +1,7 @@ | |||||||
| # Generated by Django 4.1.5 on 2023-02-18 19:59 | # Generated by Django 4.1.5 on 2023-02-18 19:59 | ||||||
|  |  | ||||||
| from django.db import migrations, models |  | ||||||
| import django.db.models.deletion | import django.db.models.deletion | ||||||
|  | from django.db import migrations, models | ||||||
|  |  | ||||||
|  |  | ||||||
| class Migration(migrations.Migration): | class Migration(migrations.Migration): | ||||||
|  | |||||||
| @ -1,7 +1,7 @@ | |||||||
| # Generated by Django 4.1.5 on 2023-11-06 11:10 | # Generated by Django 4.1.5 on 2023-11-06 11:10 | ||||||
|  |  | ||||||
| from django.db import migrations, models |  | ||||||
| import django.db.models.deletion | import django.db.models.deletion | ||||||
|  | from django.db import migrations, models | ||||||
|  |  | ||||||
|  |  | ||||||
| class Migration(migrations.Migration): | class Migration(migrations.Migration): | ||||||
|  | |||||||
| @ -1,7 +1,7 @@ | |||||||
| # Generated by Django 4.1.5 on 2023-11-06 18:14 | # Generated by Django 4.1.5 on 2023-11-06 18:14 | ||||||
|  |  | ||||||
| from django.db import migrations, models |  | ||||||
| import django.db.models.deletion | import django.db.models.deletion | ||||||
|  | from django.db import migrations, models | ||||||
|  |  | ||||||
|  |  | ||||||
| def rename_duplicates(apps, schema_editor): | def rename_duplicates(apps, schema_editor): | ||||||
|  | |||||||
| @ -1,7 +1,7 @@ | |||||||
| # Generated by Django 4.1.5 on 2023-11-06 16:53 | # Generated by Django 4.1.5 on 2023-11-06 16:53 | ||||||
|  |  | ||||||
| from django.db import migrations, models |  | ||||||
| import django.db.models.deletion | import django.db.models.deletion | ||||||
|  | from django.db import migrations, models | ||||||
|  |  | ||||||
|  |  | ||||||
| class Migration(migrations.Migration): | class Migration(migrations.Migration): | ||||||
|  | |||||||
| @ -5,7 +5,6 @@ import django.db.models.deletion | |||||||
|  |  | ||||||
|  |  | ||||||
| class Migration(migrations.Migration): | class Migration(migrations.Migration): | ||||||
|  |  | ||||||
|     dependencies = [ |     dependencies = [ | ||||||
|         ("games", "0026_purchase_type"), |         ("games", "0026_purchase_type"), | ||||||
|     ] |     ] | ||||||
|  | |||||||
| @ -1,7 +1,7 @@ | |||||||
| # Generated by Django 4.1.5 on 2023-11-14 21:19 | # Generated by Django 4.1.5 on 2023-11-14 21:19 | ||||||
|  |  | ||||||
| from django.db import migrations, models |  | ||||||
| import django.db.models.deletion | import django.db.models.deletion | ||||||
|  | from django.db import migrations, models | ||||||
|  |  | ||||||
|  |  | ||||||
| class Migration(migrations.Migration): | class Migration(migrations.Migration): | ||||||
|  | |||||||
| @ -1,7 +1,7 @@ | |||||||
| # Generated by Django 4.1.5 on 2023-11-15 13:51 | # Generated by Django 4.1.5 on 2023-11-15 13:51 | ||||||
|  |  | ||||||
| from django.db import migrations, models |  | ||||||
| import django.utils.timezone | import django.utils.timezone | ||||||
|  | from django.db import migrations, models | ||||||
|  |  | ||||||
|  |  | ||||||
| class Migration(migrations.Migration): | class Migration(migrations.Migration): | ||||||
|  | |||||||
| @ -2,6 +2,7 @@ from datetime import timedelta | |||||||
|  |  | ||||||
| from django.core.exceptions import ValidationError | from django.core.exceptions import ValidationError | ||||||
| from django.db import models | from django.db import models | ||||||
|  | from django.core.exceptions import ValidationError | ||||||
| from django.db.models import F, Manager, Sum | from django.db.models import F, Manager, Sum | ||||||
| from django.utils import timezone | from django.utils import timezone | ||||||
|  |  | ||||||
| @ -38,13 +39,9 @@ class Edition(models.Model): | |||||||
|  |  | ||||||
|     game = models.ForeignKey("Game", on_delete=models.CASCADE) |     game = models.ForeignKey("Game", on_delete=models.CASCADE) | ||||||
|     name = models.CharField(max_length=255) |     name = models.CharField(max_length=255) | ||||||
|     sort_name = models.CharField(max_length=255, null=True, blank=True, default=None) |     platform = models.ForeignKey("Platform", on_delete=models.CASCADE) | ||||||
|     platform = models.ForeignKey( |     year_released = models.IntegerField(default=datetime.today().year) | ||||||
|         "Platform", on_delete=models.CASCADE, null=True, blank=True, default=None |  | ||||||
|     ) |  | ||||||
|     year_released = models.IntegerField(null=True, blank=True, default=None) |  | ||||||
|     wikidata = models.CharField(max_length=50, null=True, blank=True, default=None) |     wikidata = models.CharField(max_length=50, null=True, blank=True, default=None) | ||||||
|     created_at = models.DateTimeField(auto_now_add=True) |  | ||||||
|  |  | ||||||
|     def __str__(self): |     def __str__(self): | ||||||
|         return self.sort_name |         return self.sort_name | ||||||
| @ -124,25 +121,14 @@ class Purchase(models.Model): | |||||||
|     type = models.CharField(max_length=255, choices=TYPES, default=GAME) |     type = models.CharField(max_length=255, choices=TYPES, default=GAME) | ||||||
|     name = models.CharField(max_length=255, default="", null=True, blank=True) |     name = models.CharField(max_length=255, default="", null=True, blank=True) | ||||||
|     related_purchase = models.ForeignKey( |     related_purchase = models.ForeignKey( | ||||||
|         "Purchase", |         "Purchase", on_delete=models.SET_NULL, default=None, null=True, blank=True | ||||||
|         on_delete=models.SET_NULL, |  | ||||||
|         default=None, |  | ||||||
|         null=True, |  | ||||||
|         blank=True, |  | ||||||
|         related_name="related_purchases", |  | ||||||
|     ) |     ) | ||||||
|     created_at = models.DateTimeField(auto_now_add=True) |  | ||||||
|  |  | ||||||
|     def __str__(self): |     def __str__(self): | ||||||
|         additional_info = [ |         platform_info = self.platform | ||||||
|             self.get_type_display() if self.type != Purchase.GAME else "", |         if self.platform != self.edition.platform: | ||||||
|             f"{self.edition.platform} version on {self.platform}" |             platform_info = f"{self.edition.platform} version on {self.platform}" | ||||||
|             if self.platform != self.edition.platform |         return f"{self.edition} ({platform_info}, {self.edition.year_released}, {self.get_ownership_type_display()})" | ||||||
|             else self.platform, |  | ||||||
|             self.edition.year_released, |  | ||||||
|             self.get_ownership_type_display(), |  | ||||||
|         ] |  | ||||||
|         return f"{self.edition} ({', '.join(filter(None, map(str, additional_info)))})" |  | ||||||
|  |  | ||||||
|     def is_game(self): |     def is_game(self): | ||||||
|         return self.type == self.GAME |         return self.type == self.GAME | ||||||
|  | |||||||
							
								
								
									
										0
									
								
								games/serializers.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								games/serializers.py
									
									
									
									
									
										Normal file
									
								
							| @ -755,10 +755,6 @@ select { | |||||||
|   position: absolute; |   position: absolute; | ||||||
| } | } | ||||||
|  |  | ||||||
| .relative { |  | ||||||
|   position: relative; |  | ||||||
| } |  | ||||||
|  |  | ||||||
| .bottom-2 { | .bottom-2 { | ||||||
|   bottom: 0.5rem; |   bottom: 0.5rem; | ||||||
| } | } | ||||||
| @ -775,51 +771,20 @@ select { | |||||||
|   top: 0.75rem; |   top: 0.75rem; | ||||||
| } | } | ||||||
|  |  | ||||||
| .mx-2 { |  | ||||||
|   margin-left: 0.5rem; |  | ||||||
|   margin-right: 0.5rem; |  | ||||||
| } |  | ||||||
|  |  | ||||||
| .mx-auto { | .mx-auto { | ||||||
|   margin-left: auto; |   margin-left: auto; | ||||||
|   margin-right: auto; |   margin-right: auto; | ||||||
| } | } | ||||||
|  |  | ||||||
| .my-2 { |  | ||||||
|   margin-top: 0.5rem; |  | ||||||
|   margin-bottom: 0.5rem; |  | ||||||
| } |  | ||||||
|  |  | ||||||
| .my-4 { | .my-4 { | ||||||
|   margin-top: 1rem; |   margin-top: 1rem; | ||||||
|   margin-bottom: 1rem; |   margin-bottom: 1rem; | ||||||
| } | } | ||||||
|  |  | ||||||
| .my-6 { |  | ||||||
|   margin-top: 1.5rem; |  | ||||||
|   margin-bottom: 1.5rem; |  | ||||||
| } |  | ||||||
|  |  | ||||||
| .mb-1 { |  | ||||||
|   margin-bottom: 0.25rem; |  | ||||||
| } |  | ||||||
|  |  | ||||||
| .mb-10 { |  | ||||||
|   margin-bottom: 2.5rem; |  | ||||||
| } |  | ||||||
|  |  | ||||||
| .mb-4 { | .mb-4 { | ||||||
|   margin-bottom: 1rem; |   margin-bottom: 1rem; | ||||||
| } | } | ||||||
|  |  | ||||||
| .ml-1 { |  | ||||||
|   margin-left: 0.25rem; |  | ||||||
| } |  | ||||||
|  |  | ||||||
| .ml-2 { |  | ||||||
|   margin-left: 0.5rem; |  | ||||||
| } |  | ||||||
|  |  | ||||||
| .mr-4 { | .mr-4 { | ||||||
|   margin-right: 1rem; |   margin-right: 1rem; | ||||||
| } | } | ||||||
| @ -832,10 +797,6 @@ select { | |||||||
|   display: block; |   display: block; | ||||||
| } | } | ||||||
|  |  | ||||||
| .inline-block { |  | ||||||
|   display: inline-block; |  | ||||||
| } |  | ||||||
|  |  | ||||||
| .inline { | .inline { | ||||||
|   display: inline; |   display: inline; | ||||||
| } | } | ||||||
| @ -852,14 +813,6 @@ select { | |||||||
|   display: none; |   display: none; | ||||||
| } | } | ||||||
|  |  | ||||||
| .h-4 { |  | ||||||
|   height: 1rem; |  | ||||||
| } |  | ||||||
|  |  | ||||||
| .h-5 { |  | ||||||
|   height: 1.25rem; |  | ||||||
| } |  | ||||||
|  |  | ||||||
| .h-6 { | .h-6 { | ||||||
|   height: 1.5rem; |   height: 1.5rem; | ||||||
| } | } | ||||||
| @ -868,22 +821,10 @@ select { | |||||||
|   min-height: 100vh; |   min-height: 100vh; | ||||||
| } | } | ||||||
|  |  | ||||||
| .w-5 { |  | ||||||
|   width: 1.25rem; |  | ||||||
| } |  | ||||||
|  |  | ||||||
| .w-6 { | .w-6 { | ||||||
|   width: 1.5rem; |   width: 1.5rem; | ||||||
| } | } | ||||||
|  |  | ||||||
| .w-7 { |  | ||||||
|   width: 1.75rem; |  | ||||||
| } |  | ||||||
|  |  | ||||||
| .w-auto { |  | ||||||
|   width: auto; |  | ||||||
| } |  | ||||||
|  |  | ||||||
| .w-full { | .w-full { | ||||||
|   width: 100%; |   width: 100%; | ||||||
| } | } | ||||||
| @ -892,10 +833,6 @@ select { | |||||||
|   max-width: 1024px; |   max-width: 1024px; | ||||||
| } | } | ||||||
|  |  | ||||||
| .max-w-sm { |  | ||||||
|   max-width: 24rem; |  | ||||||
| } |  | ||||||
|  |  | ||||||
| .max-w-xs { | .max-w-xs { | ||||||
|   max-width: 20rem; |   max-width: 20rem; | ||||||
| } | } | ||||||
| @ -922,18 +859,10 @@ select { | |||||||
|   align-items: center; |   align-items: center; | ||||||
| } | } | ||||||
|  |  | ||||||
| .justify-center { |  | ||||||
|   justify-content: center; |  | ||||||
| } |  | ||||||
|  |  | ||||||
| .justify-between { | .justify-between { | ||||||
|   justify-content: space-between; |   justify-content: space-between; | ||||||
| } | } | ||||||
|  |  | ||||||
| .gap-2 { |  | ||||||
|   gap: 0.5rem; |  | ||||||
| } |  | ||||||
|  |  | ||||||
| .self-center { | .self-center { | ||||||
|   align-self: center; |   align-self: center; | ||||||
| } | } | ||||||
| @ -956,35 +885,16 @@ select { | |||||||
|   border-radius: 0.5rem; |   border-radius: 0.5rem; | ||||||
| } | } | ||||||
|  |  | ||||||
| .rounded-sm { |  | ||||||
|   border-radius: 0.125rem; |  | ||||||
| } |  | ||||||
|  |  | ||||||
| .border-gray-200 { | .border-gray-200 { | ||||||
|   --tw-border-opacity: 1; |   --tw-border-opacity: 1; | ||||||
|   border-color: rgb(229 231 235 / var(--tw-border-opacity)); |   border-color: rgb(229 231 235 / var(--tw-border-opacity)); | ||||||
| } | } | ||||||
|  |  | ||||||
| .border-slate-500 { |  | ||||||
|   --tw-border-opacity: 1; |  | ||||||
|   border-color: rgb(100 116 139 / var(--tw-border-opacity)); |  | ||||||
| } |  | ||||||
|  |  | ||||||
| .bg-gray-200 { |  | ||||||
|   --tw-bg-opacity: 1; |  | ||||||
|   background-color: rgb(229 231 235 / var(--tw-bg-opacity)); |  | ||||||
| } |  | ||||||
|  |  | ||||||
| .bg-green-600 { | .bg-green-600 { | ||||||
|   --tw-bg-opacity: 1; |   --tw-bg-opacity: 1; | ||||||
|   background-color: rgb(22 163 74 / var(--tw-bg-opacity)); |   background-color: rgb(22 163 74 / var(--tw-bg-opacity)); | ||||||
| } | } | ||||||
|  |  | ||||||
| .bg-violet-600 { |  | ||||||
|   --tw-bg-opacity: 1; |  | ||||||
|   background-color: rgb(124 58 237 / var(--tw-bg-opacity)); |  | ||||||
| } |  | ||||||
|  |  | ||||||
| .bg-white { | .bg-white { | ||||||
|   --tw-bg-opacity: 1; |   --tw-bg-opacity: 1; | ||||||
|   background-color: rgb(255 255 255 / var(--tw-bg-opacity)); |   background-color: rgb(255 255 255 / var(--tw-bg-opacity)); | ||||||
| @ -999,11 +909,6 @@ select { | |||||||
|   padding-right: 0.5rem; |   padding-right: 0.5rem; | ||||||
| } | } | ||||||
|  |  | ||||||
| .px-4 { |  | ||||||
|   padding-left: 1rem; |  | ||||||
|   padding-right: 1rem; |  | ||||||
| } |  | ||||||
|  |  | ||||||
| .py-1 { | .py-1 { | ||||||
|   padding-top: 0.25rem; |   padding-top: 0.25rem; | ||||||
|   padding-bottom: 0.25rem; |   padding-bottom: 0.25rem; | ||||||
| @ -1022,10 +927,6 @@ select { | |||||||
|   padding-right: 1rem; |   padding-right: 1rem; | ||||||
| } | } | ||||||
|  |  | ||||||
| .pt-1 { |  | ||||||
|   padding-top: 0.25rem; |  | ||||||
| } |  | ||||||
|  |  | ||||||
| .text-center { | .text-center { | ||||||
|   text-align: center; |   text-align: center; | ||||||
| } | } | ||||||
| @ -1034,9 +935,12 @@ select { | |||||||
|   font-family: IBM Plex Mono, ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; |   font-family: IBM Plex Mono, ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; | ||||||
| } | } | ||||||
|  |  | ||||||
| .text-3xl { | .font-serif { | ||||||
|   font-size: 1.875rem; |   font-family: IBM Plex Serif, ui-serif, Georgia, Cambria, "Times New Roman", Times, serif; | ||||||
|   line-height: 2.25rem; | } | ||||||
|  |  | ||||||
|  | .font-sans { | ||||||
|  |   font-family: IBM Plex Sans, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"; | ||||||
| } | } | ||||||
|  |  | ||||||
| .text-4xl { | .text-4xl { | ||||||
| @ -1044,21 +948,11 @@ select { | |||||||
|   line-height: 2.5rem; |   line-height: 2.5rem; | ||||||
| } | } | ||||||
|  |  | ||||||
| .text-5xl { |  | ||||||
|   font-size: 3rem; |  | ||||||
|   line-height: 1; |  | ||||||
| } |  | ||||||
|  |  | ||||||
| .text-base { | .text-base { | ||||||
|   font-size: 1rem; |   font-size: 1rem; | ||||||
|   line-height: 1.5rem; |   line-height: 1.5rem; | ||||||
| } | } | ||||||
|  |  | ||||||
| .text-lg { |  | ||||||
|   font-size: 1.125rem; |  | ||||||
|   line-height: 1.75rem; |  | ||||||
| } |  | ||||||
|  |  | ||||||
| .text-xl { | .text-xl { | ||||||
|   font-size: 1.25rem; |   font-size: 1.25rem; | ||||||
|   line-height: 1.75rem; |   line-height: 1.75rem; | ||||||
| @ -1069,17 +963,55 @@ select { | |||||||
|   line-height: 1rem; |   line-height: 1rem; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | .text-2xl { | ||||||
|  |   font-size: 1.5rem; | ||||||
|  |   line-height: 2rem; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | .text-9xl { | ||||||
|  |   font-size: 8rem; | ||||||
|  |   line-height: 1; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | .text-8xl { | ||||||
|  |   font-size: 6rem; | ||||||
|  |   line-height: 1; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | .text-7xl { | ||||||
|  |   font-size: 4.5rem; | ||||||
|  |   line-height: 1; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | .text-6xl { | ||||||
|  |   font-size: 3.75rem; | ||||||
|  |   line-height: 1; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | .text-5xl { | ||||||
|  |   font-size: 3rem; | ||||||
|  |   line-height: 1; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | .text-lg { | ||||||
|  |   font-size: 1.125rem; | ||||||
|  |   line-height: 1.75rem; | ||||||
|  | } | ||||||
|  |  | ||||||
| .font-semibold { | .font-semibold { | ||||||
|   font-weight: 600; |   font-weight: 600; | ||||||
| } | } | ||||||
|  |  | ||||||
| .italic { | .font-bold { | ||||||
|   font-style: italic; |   font-weight: 700; | ||||||
| } | } | ||||||
|  |  | ||||||
| .text-gray-700 { | .capitalize { | ||||||
|   --tw-text-opacity: 1; |   text-transform: capitalize; | ||||||
|   color: rgb(55 65 81 / var(--tw-text-opacity)); | } | ||||||
|  |  | ||||||
|  | .italic { | ||||||
|  |   font-style: italic; | ||||||
| } | } | ||||||
|  |  | ||||||
| .text-slate-300 { | .text-slate-300 { | ||||||
| @ -1097,14 +1029,6 @@ select { | |||||||
|   color: rgb(253 224 71 / var(--tw-text-opacity)); |   color: rgb(253 224 71 / var(--tw-text-opacity)); | ||||||
| } | } | ||||||
|  |  | ||||||
| .underline { |  | ||||||
|   text-decoration-line: underline; |  | ||||||
| } |  | ||||||
|  |  | ||||||
| .decoration-slate-500 { |  | ||||||
|   text-decoration-color: #64748b; |  | ||||||
| } |  | ||||||
|  |  | ||||||
| .shadow-md { | .shadow-md { | ||||||
|   --tw-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1); |   --tw-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1); | ||||||
|   --tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color); |   --tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color); | ||||||
| @ -1204,10 +1128,12 @@ select { | |||||||
| } | } | ||||||
|  |  | ||||||
| .responsive-table thead th:not(:first-child), | .responsive-table thead th:not(:first-child), | ||||||
| .responsive-table td:not(:first-child) { | td:not(:first-child) { | ||||||
|   border-left-width: 1px; |   border-left-width: 1px; | ||||||
|   --tw-border-opacity: 1; |   --tw-border-opacity: 1; | ||||||
|   border-left-color: rgb(100 116 139 / var(--tw-border-opacity)); |   border-left-color: rgb(100 116 139 / var(--tw-border-opacity)); | ||||||
|  |   padding-left: 1rem; | ||||||
|  |   padding-right: 1rem; | ||||||
| } | } | ||||||
|  |  | ||||||
| :is(.dark form input),:is(.dark  | :is(.dark form input),:is(.dark  | ||||||
| @ -1339,21 +1265,11 @@ th label { | |||||||
|   box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow); |   box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow); | ||||||
| } | } | ||||||
|  |  | ||||||
| .hover\:bg-gray-400:hover { |  | ||||||
|   --tw-bg-opacity: 1; |  | ||||||
|   background-color: rgb(156 163 175 / var(--tw-bg-opacity)); |  | ||||||
| } |  | ||||||
|  |  | ||||||
| .hover\:bg-green-700:hover { | .hover\:bg-green-700:hover { | ||||||
|   --tw-bg-opacity: 1; |   --tw-bg-opacity: 1; | ||||||
|   background-color: rgb(21 128 61 / var(--tw-bg-opacity)); |   background-color: rgb(21 128 61 / var(--tw-bg-opacity)); | ||||||
| } | } | ||||||
|  |  | ||||||
| .hover\:bg-violet-700:hover { |  | ||||||
|   --tw-bg-opacity: 1; |  | ||||||
|   background-color: rgb(109 40 217 / var(--tw-bg-opacity)); |  | ||||||
| } |  | ||||||
|  |  | ||||||
| .hover\:underline:hover { | .hover\:underline:hover { | ||||||
|   text-decoration-line: underline; |   text-decoration-line: underline; | ||||||
| } | } | ||||||
| @ -1374,11 +1290,6 @@ th label { | |||||||
|   --tw-ring-color: rgb(34 197 94 / var(--tw-ring-opacity)); |   --tw-ring-color: rgb(34 197 94 / var(--tw-ring-opacity)); | ||||||
| } | } | ||||||
|  |  | ||||||
| .focus\:ring-violet-500:focus { |  | ||||||
|   --tw-ring-opacity: 1; |  | ||||||
|   --tw-ring-color: rgb(139 92 246 / var(--tw-ring-opacity)); |  | ||||||
| } |  | ||||||
|  |  | ||||||
| .focus\:ring-offset-2:focus { | .focus\:ring-offset-2:focus { | ||||||
|   --tw-ring-offset-width: 2px; |   --tw-ring-offset-width: 2px; | ||||||
| } | } | ||||||
| @ -1387,14 +1298,6 @@ th label { | |||||||
|   --tw-ring-offset-color: #bfdbfe; |   --tw-ring-offset-color: #bfdbfe; | ||||||
| } | } | ||||||
|  |  | ||||||
| .focus\:ring-offset-violet-200:focus { |  | ||||||
|   --tw-ring-offset-color: #ddd6fe; |  | ||||||
| } |  | ||||||
|  |  | ||||||
| .group:hover .group-hover\:block { |  | ||||||
|   display: block; |  | ||||||
| } |  | ||||||
|  |  | ||||||
| :is(.dark .dark\:bg-gray-800) { | :is(.dark .dark\:bg-gray-800) { | ||||||
|   --tw-bg-opacity: 1; |   --tw-bg-opacity: 1; | ||||||
|   background-color: rgb(31 41 55 / var(--tw-bg-opacity)); |   background-color: rgb(31 41 55 / var(--tw-bg-opacity)); | ||||||
| @ -1405,11 +1308,6 @@ th label { | |||||||
|   background-color: rgb(17 24 39 / var(--tw-bg-opacity)); |   background-color: rgb(17 24 39 / var(--tw-bg-opacity)); | ||||||
| } | } | ||||||
|  |  | ||||||
| :is(.dark .dark\:text-slate-500) { |  | ||||||
|   --tw-text-opacity: 1; |  | ||||||
|   color: rgb(100 116 139 / var(--tw-text-opacity)); |  | ||||||
| } |  | ||||||
|  |  | ||||||
| :is(.dark .dark\:text-slate-600) { | :is(.dark .dark\:text-slate-600) { | ||||||
|   --tw-text-opacity: 1; |   --tw-text-opacity: 1; | ||||||
|   color: rgb(71 85 105 / var(--tw-text-opacity)); |   color: rgb(71 85 105 / var(--tw-text-opacity)); | ||||||
| @ -1421,10 +1319,6 @@ th label { | |||||||
| } | } | ||||||
|  |  | ||||||
| @media (min-width: 640px) { | @media (min-width: 640px) { | ||||||
|   .sm\:inline { |  | ||||||
|     display: inline; |  | ||||||
|   } |  | ||||||
|  |  | ||||||
|   .sm\:table-cell { |   .sm\:table-cell { | ||||||
|     display: table-cell; |     display: table-cell; | ||||||
|   } |   } | ||||||
| @ -1433,19 +1327,11 @@ th label { | |||||||
|     max-width: 28rem; |     max-width: 28rem; | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   .sm\:max-w-xl { |  | ||||||
|     max-width: 36rem; |  | ||||||
|   } |  | ||||||
|  |  | ||||||
|   .sm\:px-4 { |   .sm\:px-4 { | ||||||
|     padding-left: 1rem; |     padding-left: 1rem; | ||||||
|     padding-right: 1rem; |     padding-right: 1rem; | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   .sm\:pl-12 { |  | ||||||
|     padding-left: 3rem; |  | ||||||
|   } |  | ||||||
|  |  | ||||||
|   .sm\:pl-2 { |   .sm\:pl-2 { | ||||||
|     padding-left: 0.5rem; |     padding-left: 0.5rem; | ||||||
|   } |   } | ||||||
| @ -1500,10 +1386,6 @@ th label { | |||||||
|     display: table-cell; |     display: table-cell; | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   .lg\:max-w-3xl { |  | ||||||
|     max-width: 48rem; |  | ||||||
|   } |  | ||||||
|  |  | ||||||
|   .lg\:max-w-lg { |   .lg\:max-w-lg { | ||||||
|     max-width: 32rem; |     max-width: 32rem; | ||||||
|   } |   } | ||||||
|  | |||||||
| @ -1,24 +1,29 @@ | |||||||
| import { syncSelectInputUntilChanged } from './utils.js'; | /** | ||||||
|  |  * @description Sync select field with input field until user focuses it. | ||||||
|  |  * @param {HTMLSelectElement} sourceElementSelector | ||||||
|  |  * @param {HTMLInputElement} targetElementSelector | ||||||
|  |  */ | ||||||
|  | function syncSelectInputUntilChanged( | ||||||
|  |   sourceElementSelector, | ||||||
|  |   targetElementSelector | ||||||
|  | ) { | ||||||
|  |   const sourceElement = document.querySelector(sourceElementSelector); | ||||||
|  |   const targetElement = document.querySelector(targetElementSelector); | ||||||
|  |   function sourceElementHandler(event) { | ||||||
|  |     let selected = event.target.value; | ||||||
|  |     let selectedValue = document.querySelector( | ||||||
|  |       `#id_game option[value='${selected}']` | ||||||
|  |     ).textContent; | ||||||
|  |     targetElement.value = selectedValue; | ||||||
|  |   } | ||||||
|  |   function targetElementHandler(event) { | ||||||
|  |     sourceElement.removeEventListener("change", sourceElementHandler); | ||||||
|  |   } | ||||||
|  |  | ||||||
| let syncData = [ |   sourceElement.addEventListener("change", sourceElementHandler); | ||||||
|   { |   targetElement.addEventListener("focus", targetElementHandler); | ||||||
|     "source": "#id_game", | } | ||||||
|     "source_value": "dataset.name", |  | ||||||
|     "target": "#id_name", |  | ||||||
|     "target_value": "value" |  | ||||||
|   }, |  | ||||||
|   { |  | ||||||
|     "source": "#id_game", |  | ||||||
|     "source_value": "textContent", |  | ||||||
|     "target": "#id_sort_name", |  | ||||||
|     "target_value": "value" |  | ||||||
|   }, |  | ||||||
|   { |  | ||||||
|     "source": "#id_game", |  | ||||||
|     "source_value": "dataset.year", |  | ||||||
|     "target": "#id_year_released", |  | ||||||
|     "target_value": "value" |  | ||||||
|   },   |  | ||||||
| ] |  | ||||||
|  |  | ||||||
| syncSelectInputUntilChanged(syncData, "form"); | window.addEventListener("load", () => { | ||||||
|  |   syncSelectInputUntilChanged("#id_game", "#id_name"); | ||||||
|  | }); | ||||||
|  | |||||||
| @ -1,9 +1,4 @@ | |||||||
| import { | import { syncSelectInputUntilChanged, getEl, conditionalElementHandler } from "./utils.js"; | ||||||
|   syncSelectInputUntilChanged, |  | ||||||
|   getEl, |  | ||||||
|   disableElementsWhenTrue, |  | ||||||
|   disableElementsWhenFalse, |  | ||||||
| } from "./utils.js"; |  | ||||||
|  |  | ||||||
| let syncData = [ | let syncData = [ | ||||||
|   { |   { | ||||||
| @ -16,28 +11,21 @@ let syncData = [ | |||||||
|  |  | ||||||
| syncSelectInputUntilChanged(syncData, "form"); | syncSelectInputUntilChanged(syncData, "form"); | ||||||
|  |  | ||||||
| function setupElementHandlers() { |  | ||||||
|   disableElementsWhenTrue("#id_type", "game", [ |  | ||||||
|     "#id_name", |  | ||||||
|     "#id_related_purchase", |  | ||||||
|   ]); |  | ||||||
|   disableElementsWhenFalse("#id_type", "game", ["#id_date_finished"]); |  | ||||||
| } |  | ||||||
|  |  | ||||||
| document.addEventListener("DOMContentLoaded", setupElementHandlers); | let myConfig = [ | ||||||
| document.addEventListener("htmx:afterSwap", setupElementHandlers); |   () => { | ||||||
|  |     return getEl("#id_type").value == "game"; | ||||||
|  |   }, | ||||||
|  |   ["#id_name", "#id_related_purchase"], | ||||||
|  |   (el) => { | ||||||
|  |     el.disabled = "disabled"; | ||||||
|  |   }, | ||||||
|  |   (el) => { | ||||||
|  |     el.disabled = ""; | ||||||
|  |   } | ||||||
|  | ] | ||||||
|  |  | ||||||
|  | document.DOMContentLoaded = conditionalElementHandler(...myConfig) | ||||||
| getEl("#id_type").onchange = () => { | getEl("#id_type").onchange = () => { | ||||||
|   setupElementHandlers(); |   conditionalElementHandler(...myConfig) | ||||||
| }; |  | ||||||
|  |  | ||||||
| document.body.addEventListener('htmx:beforeRequest', function(event) { |  | ||||||
|   // Assuming 'Purchase1' is the element that triggers the HTMX request |  | ||||||
|   if (event.target.id === 'id_edition') { |  | ||||||
|       var idEditionValue = document.getElementById('id_edition').value; |  | ||||||
|  |  | ||||||
|       // Condition to check - replace this with your actual logic |  | ||||||
|       if (idEditionValue != '') { |  | ||||||
|           event.preventDefault(); // This cancels the HTMX request |  | ||||||
| } | } | ||||||
|   } |  | ||||||
| }); |  | ||||||
|  | |||||||
| @ -8,9 +8,6 @@ for (let button of document.querySelectorAll("[data-target]")) { | |||||||
|     event.preventDefault(); |     event.preventDefault(); | ||||||
|     if (type == "now") { |     if (type == "now") { | ||||||
|       targetElement.value = toISOUTCString(new Date); |       targetElement.value = toISOUTCString(new Date); | ||||||
|     } else if (type == "copy") { |  | ||||||
|       const oppositeName = targetElement.name == "timestamp_start" ? "timestamp_end" : "timestamp_start"; |  | ||||||
|       document.querySelector(`[name='${oppositeName}']`).value = targetElement.value; |  | ||||||
|     } else if (type == "toggle") { |     } else if (type == "toggle") { | ||||||
|       if (targetElement.type == "datetime-local") targetElement.type = "text"; |       if (targetElement.type == "datetime-local") targetElement.type = "text"; | ||||||
|       else targetElement.type = "datetime-local"; |       else targetElement.type = "datetime-local"; | ||||||
|  | |||||||
| @ -3,16 +3,9 @@ | |||||||
|  * @param {Date} date |  * @param {Date} date | ||||||
|  * @returns {string} |  * @returns {string} | ||||||
|  */ |  */ | ||||||
| function toISOUTCString(date) { | export function toISOUTCString(date) { | ||||||
|   function stringAndPad(number) { |   let month = (date.getMonth() + 1).toString().padStart(2, 0); | ||||||
|     return number.toString().padStart(2, 0); |   return `${date.getFullYear()}-${month}-${date.getDate()}T${date.getHours()}:${date.getMinutes()}`; | ||||||
|   } |  | ||||||
|   const year = date.getFullYear(); |  | ||||||
|   const month = stringAndPad(date.getMonth() + 1); |  | ||||||
|   const day = stringAndPad(date.getDate()); |  | ||||||
|   const hours = stringAndPad(date.getHours()); |  | ||||||
|   const minutes = stringAndPad(date.getMinutes()); |  | ||||||
|   return `${year}-${month}-${day}T${hours}:${minutes}`; |  | ||||||
| } | } | ||||||
|  |  | ||||||
| /** | /** | ||||||
| @ -99,72 +92,37 @@ function getEl(selector) { | |||||||
|     return document.getElementsByClassName(selector) |     return document.getElementsByClassName(selector) | ||||||
|   } |   } | ||||||
|   else { |   else { | ||||||
|     return document.getElementsByTagName(selector) |     return document.getElementsByName(selector) | ||||||
|   } |   } | ||||||
| } | } | ||||||
|  |  | ||||||
| /** | /** | ||||||
|  * @description Applies different behaviors to elements based on multiple conditional configurations. |  * @description Does something to elements when something happens. | ||||||
|  * Each configuration is an array containing a condition function, an array of target element selectors, |  * @param {() => boolean} condition The condition that is being tested. | ||||||
|  * and two callback functions for handling matched and unmatched conditions. |  * @param {string[]} targetElements | ||||||
|  * @param {...Array} configs Each configuration is an array of the form: |  * @param {(elementName: HTMLElement) => void} callbackfn1 Called when the condition matches. | ||||||
|  *   - 0: {function(): boolean} condition - Function that returns true or false based on a condition. |  * @param {(elementName: HTMLElement) => void} callbackfn2 Called when the condition doesn't match. | ||||||
|  *   - 1: {string[]} targetElements - Array of CSS selectors for target elements. |  | ||||||
|  *   - 2: {function(HTMLElement): void} callbackfn1 - Function to execute when condition is true. |  | ||||||
|  *   - 3: {function(HTMLElement): void} callbackfn2 - Function to execute when condition is false. |  | ||||||
|  */ |  */ | ||||||
| function conditionalElementHandler(...configs) { | function conditionalElementHandler(condition, targetElements, callbackfn1, callbackfn2) { | ||||||
|   configs.forEach(([condition, targetElements, callbackfn1, callbackfn2]) => { |  | ||||||
|   if (condition()) { |   if (condition()) { | ||||||
|       targetElements.forEach(elementName => { |     targetElements.forEach((elementName) => { | ||||||
|       let el = getEl(elementName); |       let el = getEl(elementName); | ||||||
|       if (el === null) { |       if (el === null) { | ||||||
|           console.error(`Element ${elementName} doesn't exist.`); |         console.error("Element ${elementName} doesn't exist."); | ||||||
|       } else { |       } else { | ||||||
|         callbackfn1(el); |         callbackfn1(el); | ||||||
|       } |       } | ||||||
|     }); |     }); | ||||||
|   } else { |   } else { | ||||||
|       targetElements.forEach(elementName => { |     targetElements.forEach((elementName) => { | ||||||
|       let el = getEl(elementName); |       let el = getEl(elementName); | ||||||
|       if (el === null) { |       if (el === null) { | ||||||
|           console.error(`Element ${elementName} doesn't exist.`); |         console.error("Element ${elementName} doesn't exist."); | ||||||
|       } else { |       } else { | ||||||
|         callbackfn2(el); |         callbackfn2(el); | ||||||
|       } |       } | ||||||
|     }); |     }); | ||||||
|   } |   } | ||||||
|   }); |  | ||||||
| } | } | ||||||
|  |  | ||||||
| function disableElementsWhenFalse(targetSelect, targetValue, elementList) { | export { toISOUTCString, syncSelectInputUntilChanged, getEl, conditionalElementHandler }; | ||||||
|   return conditionalElementHandler([ |  | ||||||
|     () => { |  | ||||||
|       return getEl(targetSelect).value != targetValue; |  | ||||||
|     }, |  | ||||||
|     elementList, |  | ||||||
|     (el) => { |  | ||||||
|       el.disabled = "disabled"; |  | ||||||
|     }, |  | ||||||
|     (el) => { |  | ||||||
|       el.disabled = ""; |  | ||||||
|     }, |  | ||||||
|   ]); |  | ||||||
| } |  | ||||||
|  |  | ||||||
| function disableElementsWhenTrue(targetSelect, targetValue, elementList) { |  | ||||||
|   return conditionalElementHandler([ |  | ||||||
|     () => { |  | ||||||
|       return getEl(targetSelect).value == targetValue; |  | ||||||
|     }, |  | ||||||
|     elementList, |  | ||||||
|     (el) => { |  | ||||||
|       el.disabled = "disabled"; |  | ||||||
|     }, |  | ||||||
|     (el) => { |  | ||||||
|       el.disabled = ""; |  | ||||||
|     }, |  | ||||||
|   ]); |  | ||||||
| } |  | ||||||
|  |  | ||||||
| export { toISOUTCString, syncSelectInputUntilChanged, getEl, conditionalElementHandler, disableElementsWhenFalse, disableElementsWhenTrue, getValueFromProperty }; |  | ||||||
|  | |||||||
| @ -1,8 +1,8 @@ | |||||||
| {% extends "base.html" %} | {% extends "base.html" %} | ||||||
| {% load static %} | {% load static %} | ||||||
|  | {% block title %} | ||||||
| {% block title %}{{ title }}{% endblock title %} |     {{ title }} | ||||||
|  | {% endblock title %} | ||||||
| {% block content %} | {% block content %} | ||||||
|     <form method="post" enctype="multipart/form-data"> |     <form method="post" enctype="multipart/form-data"> | ||||||
|         <table class="mx-auto"> |         <table class="mx-auto"> | ||||||
| @ -16,10 +16,3 @@ | |||||||
|         </table> |         </table> | ||||||
|     </form> |     </form> | ||||||
| {% endblock content %} | {% endblock content %} | ||||||
|  |  | ||||||
| {% block scripts %} |  | ||||||
|     {% if script_name %} |  | ||||||
|         <script type="module" src="{% static 'js/'|add:script_name %}"></script> |  | ||||||
|     {% endif %} |  | ||||||
| {% endblock scripts %} |  | ||||||
|          |  | ||||||
| @ -1,8 +1,8 @@ | |||||||
| {% extends "base.html" %} | {% extends "base.html" %} | ||||||
| {% load static %} | {% load static %} | ||||||
|  | {% block title %} | ||||||
| {% block title %}{{ title }}{% endblock title %} |     {{ title }} | ||||||
|  | {% endblock title %} | ||||||
| {% block content %} | {% block content %} | ||||||
|     <form method="post" enctype="multipart/form-data"> |     <form method="post" enctype="multipart/form-data"> | ||||||
|         <table class="mx-auto"> |         <table class="mx-auto"> | ||||||
| @ -11,19 +11,12 @@ | |||||||
|         {{ form.as_table }} |         {{ form.as_table }} | ||||||
|         <tr> |         <tr> | ||||||
|             <td></td> |             <td></td> | ||||||
|             <td><input type="submit" name="submit" value="Submit"/></td> |             <td><input type="submit" value="Submit"/></td> | ||||||
|         </tr> |  | ||||||
|         <tr> |  | ||||||
|             <td></td> |  | ||||||
|             <td><input type="submit" name="submit_and_redirect" value="Submit & Create Purchase"/></td> |  | ||||||
|         </tr> |         </tr> | ||||||
|         </table> |         </table> | ||||||
|     </form> |     </form> | ||||||
| {% endblock content %} | {% endblock content %} | ||||||
|  |  | ||||||
| {% block scripts %} | {% block scripts %} | ||||||
|     {% if script_name %} | {% load static %} | ||||||
|         <script type="module" src="{% static 'js/'|add:script_name %}"></script> | <script type="module" src="{% static 'js/add_edition.js' %}"></script> | ||||||
|     {% endif %} |  | ||||||
| {% endblock scripts %} | {% endblock scripts %} | ||||||
|          |  | ||||||
| @ -1,29 +1,32 @@ | |||||||
| {% extends "base.html" %} | {% extends "base.html" %} | ||||||
| {% load static %} | {% load static %} | ||||||
|  | {% block title %} | ||||||
| {% block title %}{{ title }}{% endblock title %} |     {{ title }} | ||||||
|  | {% endblock title %} | ||||||
| {% block content %} | {% block content %} | ||||||
|     <form method="post" enctype="multipart/form-data"> |     <form method="post" enctype="multipart/form-data"> | ||||||
|         <table class="mx-auto"> |         <table class="mx-auto"> | ||||||
|             {% csrf_token %} |             {% csrf_token %} | ||||||
|  |  | ||||||
|             {{ form.as_table }} |             {{ form.as_table }} | ||||||
|             <tr> |             <tr> | ||||||
|                 <td></td> |                 <td></td> | ||||||
|             <td><input type="submit" name="submit" value="Submit"/></td> |                 <td> | ||||||
|  |                     <input type="submit" name="submit" value="Submit" /> | ||||||
|  |                 </td> | ||||||
|             </tr> |             </tr> | ||||||
|             <tr> |             <tr> | ||||||
|                 <td></td> |                 <td></td> | ||||||
|             <td><input type="submit" name="submit_and_redirect" value="Submit & Create Edition"/></td> |                 <td> | ||||||
|  |                     <input type="submit" | ||||||
|  |                            name="submit_and_redirect" | ||||||
|  |                            value="Submit & Create Edition" /> | ||||||
|  |                 </td> | ||||||
|             </tr> |             </tr> | ||||||
|         </table> |         </table> | ||||||
|     </form> |     </form> | ||||||
| {% endblock content %} | {% endblock content %} | ||||||
|  |  | ||||||
| {% block scripts %} | {% block scripts %} | ||||||
|     {% if script_name %} |     {% if script_name %} | ||||||
|         <script type="module" src="{% static 'js/'|add:script_name %}"></script> |         <script type="module" src="{% static 'js/'|add:script_name %}"></script> | ||||||
|     {% endif %} |     {% endif %} | ||||||
| {% endblock scripts %} | {% endblock scripts %} | ||||||
|          |  | ||||||
| @ -1,29 +1,32 @@ | |||||||
| {% extends "base.html" %} | {% extends "base.html" %} | ||||||
| {% load static %} | {% load static %} | ||||||
|  | {% block title %} | ||||||
| {% block title %}{{ title }}{% endblock title %} |     {{ title }} | ||||||
|  | {% endblock title %} | ||||||
| {% block content %} | {% block content %} | ||||||
|     <form method="post" enctype="multipart/form-data"> |     <form method="post" enctype="multipart/form-data"> | ||||||
|         <table class="mx-auto"> |         <table class="mx-auto"> | ||||||
|             {% csrf_token %} |             {% csrf_token %} | ||||||
|  |  | ||||||
|             {{ form.as_table }} |             {{ form.as_table }} | ||||||
|             <tr> |             <tr> | ||||||
|                 <td></td> |                 <td></td> | ||||||
|             <td><input type="submit" name="submit" value="Submit"/></td> |                 <td> | ||||||
|  |                     <input type="submit" name="submit" value="Submit" /> | ||||||
|  |                 </td> | ||||||
|             </tr> |             </tr> | ||||||
|             <tr> |             <tr> | ||||||
|                 <td></td> |                 <td></td> | ||||||
|             <td><input type="submit" name="submit_and_redirect" value="Submit & Create Session"/></td> |                 <td> | ||||||
|  |                     <input type="submit" | ||||||
|  |                            name="submit_and_redirect" | ||||||
|  |                            value="Submit & Create Session" /> | ||||||
|  |                 </td> | ||||||
|             </tr> |             </tr> | ||||||
|         </table> |         </table> | ||||||
|     </form> |     </form> | ||||||
| {% endblock content %} | {% endblock content %} | ||||||
|  |  | ||||||
| {% block scripts %} | {% block scripts %} | ||||||
|     {% if script_name %} |     {% if script_name %} | ||||||
|         <script type="module" src="{% static 'js/'|add:script_name %}"></script> |         <script type="module" src="{% static 'js/'|add:script_name %}"></script> | ||||||
|     {% endif %} |     {% endif %} | ||||||
| {% endblock scripts %} | {% endblock scripts %} | ||||||
|          |  | ||||||
| @ -20,7 +20,6 @@ | |||||||
|                 <div class="basic-button-container"> |                 <div class="basic-button-container"> | ||||||
|                     <button class="basic-button" data-target="{{field.name}}" data-type="now">Set to now</button> |                     <button class="basic-button" data-target="{{field.name}}" data-type="now">Set to now</button> | ||||||
|                     <button class="basic-button" data-target="{{field.name}}" data-type="toggle">Toggle text</button> |                     <button class="basic-button" data-target="{{field.name}}" data-type="toggle">Toggle text</button> | ||||||
|                     <button class="basic-button" data-target="{{field.name}}" data-type="copy">Copy</button> |  | ||||||
|                 </div> |                 </div> | ||||||
|             </td> |             </td> | ||||||
|             {% endif %} |             {% endif %} | ||||||
|  | |||||||
| @ -1,8 +1,6 @@ | |||||||
| <!doctype html> | <!DOCTYPE html> | ||||||
| <html lang="en"> | <html lang="en"> | ||||||
|  |  | ||||||
|     {% load static %} |     {% load static %} | ||||||
|  |  | ||||||
|     <head> |     <head> | ||||||
|         <meta charset="utf-8"/> |         <meta charset="utf-8"/> | ||||||
|         <meta name="description" content="Self-hosted time-tracker."/> |         <meta name="description" content="Self-hosted time-tracker."/> | ||||||
| @ -13,60 +11,85 @@ | |||||||
|         <link rel="stylesheet" href="{% static 'base.css' %}" /> |         <link rel="stylesheet" href="{% static 'base.css' %}" /> | ||||||
|     </head> |     </head> | ||||||
|      |      | ||||||
|     <body class="dark" hx-indicator="#indicator" hx-boost="true"> |     <body class="dark"> | ||||||
|         <img id="indicator" src="{% static 'icons/loading.png' %}" class="absolute right-3 top-3 animate-spin htmx-indicator" /> |         <img id="indicator" src="{% static 'icons/loading.png' %}" class="absolute right-3 top-3 animate-spin htmx-indicator" /> | ||||||
|         <div class="dark:bg-gray-800 min-h-screen"> |         <div class="dark:bg-gray-800 min-h-screen"> | ||||||
|             <nav class="mb-4 bg-white dark:bg-gray-900 border-gray-200 rounded"> |             <nav class="mb-4 bg-white dark:bg-gray-900 border-gray-200 rounded"> | ||||||
|                 <div class="container flex flex-wrap items-center justify-between mx-auto"> |                 <div class="container flex flex-wrap items-center justify-between mx-auto"> | ||||||
|                     <a href="{% url 'list_sessions_recent' %}" class="flex items-center"> |                     <a href="{% url 'list_sessions_recent' %}" class="flex items-center"> | ||||||
|                         <span class="text-4xl"><img src="{% static 'icons/schedule.png' %}" width="48" class="mr-4" /></span> |                         <span class="text-4xl">⌚</span> | ||||||
|                         <span class="self-center text-xl font-semibold whitespace-nowrap text-white">Timetracker</span> |                         <span class="self-center text-xl font-semibold whitespace-nowrap text-white">Timetracker</span> | ||||||
|                     </a> |                     </a> | ||||||
|                     <div class="w-full md:block md:w-auto"> |                     <div class="w-full md:block md:w-auto"> | ||||||
|                         <ul |                         <ul class="flex flex-col md:flex-row p-4 mt-4 dark:text-white"> | ||||||
|                             class="flex flex-col md:flex-row p-4 mt-4 dark:text-white"> |  | ||||||
|                             <li class="relative group"> |                             <li class="relative group"> | ||||||
|                                 <a class="block py-2 pl-3 pr-4 hover:underline" href="{% url 'add_game' %}">New</a> |                                 <a class="block py-2 pl-3 pr-4 hover:underline" | ||||||
|  |                                    href="{% url 'add_game' %}">New</a> | ||||||
|                                 <ul class="absolute hidden text-gray-700 pt-1 group-hover:block  w-auto whitespace-nowrap"> |                                 <ul class="absolute hidden text-gray-700 pt-1 group-hover:block  w-auto whitespace-nowrap"> | ||||||
|                                     {% if purchase_available %} |                                     {% if purchase_available %} | ||||||
|                                         <li><a class="bg-gray-200 hover:bg-gray-400 py-2 px-4 block whitespace-no-wrap" href="{% url 'add_device' %}">Device</a></li> |                                         <li> | ||||||
|  |                                             <a class="bg-gray-200 hover:bg-gray-400 py-2 px-4 block whitespace-no-wrap" | ||||||
|  |                                                href="{% url 'add_device' %}">Device</a> | ||||||
|  |                                         </li> | ||||||
|                                     {% endif %} |                                     {% endif %} | ||||||
|                                     <li><a class="bg-gray-200 hover:bg-gray-400 py-2 px-4 block whitespace-no-wrap" href="{% url 'add_game' %}">Game</a></li> |                                     <li> | ||||||
|  |                                         <a class="bg-gray-200 hover:bg-gray-400 py-2 px-4 block whitespace-no-wrap" | ||||||
|  |                                            href="{% url 'add_game' %}">Game</a> | ||||||
|  |                                     </li> | ||||||
|                                     {% if game_available and platform_available %} |                                     {% if game_available and platform_available %} | ||||||
|                                         <li><a class="bg-gray-200 hover:bg-gray-400 py-2 px-4 block whitespace-no-wrap" href="{% url 'add_edition' %}">Edition</a></li> |                                         <li> | ||||||
|  |                                             <a class="bg-gray-200 hover:bg-gray-400 py-2 px-4 block whitespace-no-wrap" | ||||||
|  |                                                href="{% url 'add_edition' %}">Edition</a> | ||||||
|  |                                         </li> | ||||||
|                                     {% endif %} |                                     {% endif %} | ||||||
|                                     <li><a class="bg-gray-200 hover:bg-gray-400 py-2 px-4 block whitespace-no-wrap" href="{% url 'add_platform' %}">Platform</a></li> |                                     <li> | ||||||
|  |                                         <a class="bg-gray-200 hover:bg-gray-400 py-2 px-4 block whitespace-no-wrap" | ||||||
|  |                                            href="{% url 'add_platform' %}">Platform</a> | ||||||
|  |                                     </li> | ||||||
|                                     {% if edition_available %} |                                     {% if edition_available %} | ||||||
|                                         <li><a class="bg-gray-200 hover:bg-gray-400 py-2 px-4 block whitespace-no-wrap" href="{% url 'add_purchase' %}">Purchase</a></li> |                                         <li> | ||||||
|  |                                             <a class="bg-gray-200 hover:bg-gray-400 py-2 px-4 block whitespace-no-wrap" | ||||||
|  |                                                href="{% url 'add_purchase' %}">Purchase</a> | ||||||
|  |                                         </li> | ||||||
|                                     {% endif %} |                                     {% endif %} | ||||||
|                                     {% if purchase_available %} |                                     {% if purchase_available %} | ||||||
|                                         <li><a class="bg-gray-200 hover:bg-gray-400 py-2 px-4 block whitespace-no-wrap" href="{% url 'add_session' %}">Session</a></li> |                                         <li> | ||||||
|  |                                             <a class="bg-gray-200 hover:bg-gray-400 py-2 px-4 block whitespace-no-wrap" | ||||||
|  |                                                href="{% url 'add_session' %}">Session</a> | ||||||
|  |                                         </li> | ||||||
|                                     {% endif %} |                                     {% endif %} | ||||||
|                                      |  | ||||||
|                                 </ul> |                                 </ul> | ||||||
|                             </li> |                             </li> | ||||||
|                             {% if session_count > 0 %} |                             {% if session_count > 0 %} | ||||||
|                                 <li class="relative group"> |                                 <li class="relative group"> | ||||||
|                                         <a class="block py-2 pl-3 pr-4 hover:underline" href="{% url 'stats_current_year' %}">Stats</a> |                                     <a class="block py-2 pl-3 pr-4 hover:underline" | ||||||
|  |                                        href="{% url 'stats_current_year' %}">Stats</a> | ||||||
|                                     <ul class="absolute hidden text-gray-700 pt-1 group-hover:block"> |                                     <ul class="absolute hidden text-gray-700 pt-1 group-hover:block"> | ||||||
|                                         {% for year in stats_dropdown_year_range %} |                                         {% for year in stats_dropdown_year_range %} | ||||||
|                                             <li> |                                             <li> | ||||||
|                                                     <a class="bg-gray-200 hover:bg-gray-400 py-2 px-4 block whitespace-no-wrap" href="{% url 'stats_by_year' year %}">{{ year }}</a> |                                                 <a class="bg-gray-200 hover:bg-gray-400 py-2 px-4 block whitespace-no-wrap" | ||||||
|  |                                                    href="{% url 'stats_by_year' year %}">{{ year }}</a> | ||||||
|                                             </li> |                                             </li> | ||||||
|                                         {% endfor %} |                                         {% endfor %} | ||||||
|                                     </ul> |                                     </ul> | ||||||
|                                 </li> |                                 </li> | ||||||
|                                 <li><a class="block py-2 pl-3 pr-4 hover:underline" href="{% url 'list_sessions' %}">All Sessions</a></li> |                                 <li> | ||||||
|  |                                     <a class="block py-2 pl-3 pr-4 hover:underline" | ||||||
|  |                                        href="{% url 'list_sessions' %}">All Sessions</a> | ||||||
|  |                                 </li> | ||||||
|                             {% endif %} |                             {% endif %} | ||||||
|                         </ul> |                         </ul> | ||||||
|                     </div> |                     </div> | ||||||
|                 </div> |                 </div> | ||||||
|             </nav> |             </nav> | ||||||
|             {% block content %}No content here.{% endblock content %} |             {% block content %} | ||||||
|  |                 No content here. | ||||||
|  |             {% endblock content %} | ||||||
|         </div> |         </div> | ||||||
|         {% load version %} |         {% load version %} | ||||||
|         <span class="fixed left-2 bottom-2 text-xs text-slate-300 dark:text-slate-600">{% version %} ({% version_date %})</span> |         <span class="fixed left-2 bottom-2 text-xs text-slate-300 dark:text-slate-600">{% version %} ({% version_date %})</span> | ||||||
|     {% block scripts %}{% endblock scripts %} |         {% block scripts %} | ||||||
|  |         {% endblock scripts %} | ||||||
|     </body> |     </body> | ||||||
|  |  | ||||||
| </html> | </html> | ||||||
|  | |||||||
| @ -1,13 +1,10 @@ | |||||||
| {% comment %}  | <button | ||||||
| title |   type="button" | ||||||
| text |  | ||||||
| {% endcomment %} |  | ||||||
| <a |  | ||||||
|   href="{{ link }}" |  | ||||||
|   title="{{ title }}" |   title="{{ title }}" | ||||||
|   class="truncate max-w-xs py-1 px-2 text-xs bg-green-600 hover:bg-green-700 focus:ring-green-500 focus:ring-offset-blue-200 text-white transition ease-in duration-200 text-center font-semibold shadow-md focus:outline-none focus:ring-2 focus:ring-offset-2 rounded-sm" |   autofocus | ||||||
|  |   class="truncate max-w-xs sm:max-w-md lg:max-w-lg py-1 px-2 bg-green-600 hover:bg-green-700 focus:ring-green-500 focus:ring-offset-blue-200 text-white transition ease-in duration-200 text-center text-base font-semibold shadow-md focus:outline-none focus:ring-2 focus:ring-offset-2 rounded-lg" | ||||||
| > | > | ||||||
|   {% comment %} <svg |   <svg | ||||||
|     xmlns="http://www.w3.org/2000/svg" |     xmlns="http://www.w3.org/2000/svg" | ||||||
|     fill="none" |     fill="none" | ||||||
|     viewBox="0 0 24 24" |     viewBox="0 0 24 24" | ||||||
| @ -21,6 +18,5 @@ text | |||||||
|       d="M5.25 5.653c0-.856.917-1.398 1.667-.986l11.54 6.348a1.125 1.125 0 010 1.971l-11.54 6.347a1.125 1.125 0 01-1.667-.985V5.653z" |       d="M5.25 5.653c0-.856.917-1.398 1.667-.986l11.54 6.348a1.125 1.125 0 010 1.971l-11.54 6.347a1.125 1.125 0 01-1.667-.985V5.653z" | ||||||
|     /> |     /> | ||||||
|   </svg> |   </svg> | ||||||
|     {% endcomment %} |  | ||||||
|   {{ text }} |   {{ text }} | ||||||
| </a> | </button> | ||||||
|  | |||||||
| @ -2,25 +2,17 @@ | |||||||
| title | title | ||||||
| text | text | ||||||
| {% endcomment %} | {% endcomment %} | ||||||
| <button | <button type="button" | ||||||
|   type="button" |  | ||||||
|         title="{{ title }}" |         title="{{ title }}" | ||||||
|         autofocus |         autofocus | ||||||
|   class="truncate max-w-xs sm:max-w-md lg:max-w-lg py-1 px-2 bg-green-600 hover:bg-green-700 focus:ring-green-500 focus:ring-offset-blue-200 text-white transition ease-in duration-200 text-center text-base font-semibold shadow-md focus:outline-none focus:ring-2 focus:ring-offset-2 rounded-lg" |         class="truncate max-w-xs sm:max-w-md lg:max-w-lg py-1 px-2 bg-green-600 hover:bg-green-700 focus:ring-green-500 focus:ring-offset-blue-200 text-white transition ease-in duration-200 text-center text-base font-semibold shadow-md focus:outline-none focus:ring-2 focus:ring-offset-2 rounded-lg"> | ||||||
| > |     <svg xmlns="http://www.w3.org/2000/svg" | ||||||
|   <svg |  | ||||||
|     xmlns="http://www.w3.org/2000/svg" |  | ||||||
|          fill="none" |          fill="none" | ||||||
|          viewBox="0 0 24 24" |          viewBox="0 0 24 24" | ||||||
|          stroke-width="1.5" |          stroke-width="1.5" | ||||||
|          stroke="currentColor" |          stroke="currentColor" | ||||||
|     class="self-center w-6 h-6 inline" |          class="self-center w-6 h-6 inline"> | ||||||
|   > |         <path stroke-linecap="round" stroke-linejoin="round" d="M5.25 5.653c0-.856.917-1.398 1.667-.986l11.54 6.348a1.125 1.125 0 010 1.971l-11.54 6.347a1.125 1.125 0 01-1.667-.985V5.653z" /> | ||||||
|     <path |  | ||||||
|       stroke-linecap="round" |  | ||||||
|       stroke-linejoin="round" |  | ||||||
|       d="M5.25 5.653c0-.856.917-1.398 1.667-.986l11.54 6.348a1.125 1.125 0 010 1.971l-11.54 6.347a1.125 1.125 0 01-1.667-.985V5.653z" |  | ||||||
|     /> |  | ||||||
|     </svg> |     </svg> | ||||||
|     {{ text }} |     {{ text }} | ||||||
| </button> | </button> | ||||||
|  | |||||||
| @ -1,21 +1,13 @@ | |||||||
| <a href="{{ edit_url }}"> | <a href="{{ edit_url }}"> | ||||||
|   <button |     <button type="button" | ||||||
|     type="button" |  | ||||||
|             title="Edit" |             title="Edit" | ||||||
|     class="ml-1 py-1 px-2 flex justify-center items-center bg-violet-600 hover:bg-violet-700 focus:ring-violet-500 focus:ring-offset-violet-200 text-white transition ease-in duration-200 text-center text-base font-semibold shadow-md focus:outline-none focus:ring-2 focus:ring-offset-2 w-7 h-4 rounded-lg" |             class="ml-1 py-1 px-2 flex justify-center items-center bg-violet-600 hover:bg-violet-700 focus:ring-violet-500 focus:ring-offset-violet-200 text-white transition ease-in duration-200 text-center text-base font-semibold shadow-md focus:outline-none focus:ring-2 focus:ring-offset-2 w-7 h-4 rounded-lg"> | ||||||
|   > |         <svg xmlns="http://www.w3.org/2000/svg" | ||||||
|     <svg |  | ||||||
|       xmlns="http://www.w3.org/2000/svg" |  | ||||||
|              viewBox="0 0 20 20" |              viewBox="0 0 20 20" | ||||||
|              fill="currentColor" |              fill="currentColor" | ||||||
|       class="w-5 h-5" |              class="w-5 h-5"> | ||||||
|     > |             <path d="M5.433 13.917l1.262-3.155A4 4 0 017.58 9.42l6.92-6.918a2.121 2.121 0 013 3l-6.92 6.918c-.383.383-.84.685-1.343.886l-3.154 1.262a.5.5 0 01-.65-.65z" /> | ||||||
|       <path |             <path d="M3.5 5.75c0-.69.56-1.25 1.25-1.25H10A.75.75 0 0010 3H4.75A2.75 2.75 0 002 5.75v9.5A2.75 2.75 0 004.75 18h9.5A2.75 2.75 0 0017 15.25V10a.75.75 0 00-1.5 0v5.25c0 .69-.56 1.25-1.25 1.25h-9.5c-.69 0-1.25-.56-1.25-1.25v-9.5z" /> | ||||||
|         d="M5.433 13.917l1.262-3.155A4 4 0 017.58 9.42l6.92-6.918a2.121 2.121 0 013 3l-6.92 6.918c-.383.383-.84.685-1.343.886l-3.154 1.262a.5.5 0 01-.65-.65z" |  | ||||||
|       /> |  | ||||||
|       <path |  | ||||||
|         d="M3.5 5.75c0-.69.56-1.25 1.25-1.25H10A.75.75 0 0010 3H4.75A2.75 2.75 0 002 5.75v9.5A2.75 2.75 0 004.75 18h9.5A2.75 2.75 0 0017 15.25V10a.75.75 0 00-1.5 0v5.25c0 .69-.56 1.25-1.25 1.25h-9.5c-.69 0-1.25-.56-1.25-1.25v-9.5z" |  | ||||||
|       /> |  | ||||||
|         </svg> |         </svg> | ||||||
|     </button> |     </button> | ||||||
| </a> | </a> | ||||||
|  | |||||||
| @ -1,7 +1,7 @@ | |||||||
| {% extends "base.html" %} | {% extends "base.html" %} | ||||||
|  | {% block title %} | ||||||
| {% block title %}{{ title }}{% endblock title %} |     {{ title }} | ||||||
|  | {% endblock title %} | ||||||
| {% block content %} | {% block content %} | ||||||
|     <div class="text-slate-300 mx-auto max-w-screen-lg text-center"> |     <div class="text-slate-300 mx-auto max-w-screen-lg text-center"> | ||||||
|         {% if session_count > 0 %} |         {% if session_count > 0 %} | ||||||
|  | |||||||
| @ -10,20 +10,20 @@ | |||||||
| <div class="mx-auto text-center my-4"> | <div class="mx-auto text-center my-4"> | ||||||
|   <a |   <a | ||||||
|     id="last-session-start" |     id="last-session-start" | ||||||
|     href="{% url 'start_session_same_as_last' last.id %}" |     href="{% url 'start_session' last.id %}" | ||||||
|     hx-get="{% url 'start_session_same_as_last' last.id %}" |     hx-get="{% url 'start_session' last.id %}" | ||||||
|  |     hx-indicator="#indicator" | ||||||
|     hx-swap="afterbegin" |     hx-swap="afterbegin" | ||||||
|     hx-target=".responsive-table tbody" |     hx-target=".responsive-table tbody" | ||||||
|     hx-select=".responsive-table tbody tr:first-child" |     hx-select=".responsive-table tbody tr:first-child" | ||||||
|     onClick="document.querySelector('#last-session-start').classList.add('invisible')" |     onClick="document.querySelector('#last-session-start').classList.add('invisible')" | ||||||
|     class="{% if last.timestamp_end == null %}invisible{% endif %}" |     class="{% if last.timestamp_end == null %}invisible{% endif %}" | ||||||
|   > |   > | ||||||
|     {% include 'components/button_start.html' with text=last.purchase title="Start session of last played game" only %} |     {% include 'components/button.html' with text=last.purchase title="Start session of last played game" only %} | ||||||
|   </a> |   </a> | ||||||
| </div> | </div> | ||||||
| {% endif %} | {% endif %} | ||||||
|  |  | ||||||
| {% if dataset.count != 0 %} |  | ||||||
| <table class="responsive-table"> | <table class="responsive-table"> | ||||||
|   <thead> |   <thead> | ||||||
|     <tr> |     <tr> | ||||||
| @ -39,11 +39,7 @@ | |||||||
|       <td |       <td | ||||||
|         class="px-2 sm:px-4 md:px-6 md:py-2 purchase-name truncate max-w-20char md:max-w-40char" |         class="px-2 sm:px-4 md:px-6 md:py-2 purchase-name truncate max-w-20char md:max-w-40char" | ||||||
|       > |       > | ||||||
|         <a |  | ||||||
|           class="underline decoration-slate-500 sm:decoration-2" |  | ||||||
|           href="{% url 'view_game' data.purchase.edition.game.id %}"> |  | ||||||
|         {{ data.purchase.edition }} |         {{ data.purchase.edition }} | ||||||
|         </a> |  | ||||||
|       </td> |       </td> | ||||||
|       <td class="px-2 sm:px-4 md:px-6 md:py-2 font-mono hidden sm:table-cell"> |       <td class="px-2 sm:px-4 md:px-6 md:py-2 font-mono hidden sm:table-cell"> | ||||||
|         {{ data.timestamp_start | date:"d/m/Y H:i" }} |         {{ data.timestamp_start | date:"d/m/Y H:i" }} | ||||||
| @ -74,7 +70,4 @@ | |||||||
|     {% endfor %} |     {% endfor %} | ||||||
|   </tbody> |   </tbody> | ||||||
| </table> | </table> | ||||||
| {% else %} |  | ||||||
| <div class="mx-auto text-center text-slate-300 text-xl">No sessions found.</div> |  | ||||||
| {% endif %} |  | ||||||
| {% endblock content %} | {% endblock content %} | ||||||
|  | |||||||
| @ -1,15 +1,17 @@ | |||||||
| {% extends "base.html" %} | {% extends "base.html" %} | ||||||
|  | {% block title %} | ||||||
| {% block title %}{{ title }}{% endblock title %} |     {{ title }} | ||||||
|  | {% endblock title %} | ||||||
| {% load static %} | {% load static %} | ||||||
|  |  | ||||||
| {% block content %} | {% block content %} | ||||||
|     <div class="dark:text-white max-w-sm sm:max-w-xl lg:max-w-3xl mx-auto"> |     <div class="dark:text-white max-w-sm sm:max-w-xl lg:max-w-3xl mx-auto"> | ||||||
|         <div class="flex justify-center items-center"> |         <div class="flex justify-center items-center"> | ||||||
|             <form method="get" class="text-center"> |             <form method="get" class="text-center"> | ||||||
|                 <label class="text-5xl text-center inline-block mb-10" for="yearSelect">Stats for:</label> |                 <label class="text-5xl text-center inline-block mb-10" for="yearSelect">Stats for:</label> | ||||||
|                 <select name="year" id="yearSelect" onchange="this.form.submit();" class="mx-2"> |                 <select name="year" | ||||||
|  |                         id="yearSelect" | ||||||
|  |                         onchange="this.form.submit();" | ||||||
|  |                         class="mx-2"> | ||||||
|                     {% for year_item in stats_dropdown_year_range %} |                     {% for year_item in stats_dropdown_year_range %} | ||||||
|                         <option value="{{ year_item }}" {% if year == year_item %}selected{% endif %}>{{ year_item }}</option> |                         <option value="{{ year_item }}" {% if year == year_item %}selected{% endif %}>{{ year_item }}</option> | ||||||
|                     {% endfor %} |                     {% endfor %} | ||||||
| @ -62,11 +64,15 @@ | |||||||
|                         </tr> |                         </tr> | ||||||
|                         <tr> |                         <tr> | ||||||
|                             <td class="px-2 sm:px-4 md:px-6 md:py-2">Refunded</td> |                             <td class="px-2 sm:px-4 md:px-6 md:py-2">Refunded</td> | ||||||
|                             <td class="px-2 sm:px-4 md:px-6 md:py-2 font-mono">{{ all_purchased_refunded_this_year.count }} ({{ refunded_percent }}%)</td> |                             <td class="px-2 sm:px-4 md:px-6 md:py-2 font-mono"> | ||||||
|  |                                 {{ all_purchased_refunded_this_year.count }} ({{ refunded_percent }}%) | ||||||
|  |                             </td> | ||||||
|                         </tr> |                         </tr> | ||||||
|                         <tr> |                         <tr> | ||||||
|                             <td class="px-2 sm:px-4 md:px-6 md:py-2">Unfinished</td> |                             <td class="px-2 sm:px-4 md:px-6 md:py-2">Unfinished</td> | ||||||
|                             <td class="px-2 sm:px-4 md:px-6 md:py-2 font-mono">{{ purchased_unfinished.count }} ({{ unfinished_purchases_percent }}%)</td> |                             <td class="px-2 sm:px-4 md:px-6 md:py-2 font-mono"> | ||||||
|  |                                 {{ purchased_unfinished.count }} ({{ unfinished_purchases_percent }}%) | ||||||
|  |                             </td> | ||||||
|                         </tr> |                         </tr> | ||||||
|                         <tr> |                         <tr> | ||||||
|                             <td class="px-2 sm:px-4 md:px-6 md:py-2">Backlog Decrease</td> |                             <td class="px-2 sm:px-4 md:px-6 md:py-2">Backlog Decrease</td> | ||||||
| @ -92,9 +98,8 @@ | |||||||
|                 {% for game in top_10_games_by_playtime %} |                 {% for game in top_10_games_by_playtime %} | ||||||
|                     <tr> |                     <tr> | ||||||
|                         <td class="px-2 sm:px-4 md:px-6 md:py-2 font-mono"> |                         <td class="px-2 sm:px-4 md:px-6 md:py-2 font-mono"> | ||||||
|                         <a class="underline decoration-slate-500 sm:decoration-2" href="{% url 'view_game' game.id  %}">{{ game.name }} |                             <a class="underline decoration-slate-500 sm:decoration-2" | ||||||
|  |                                href="{% url 'view_game' game.id %}">{{ game.name }}</a> | ||||||
|                         </a> |  | ||||||
|                         </td> |                         </td> | ||||||
|                         <td class="px-2 sm:px-4 md:px-6 md:py-2 font-mono">{{ game.formatted_playtime }}</td> |                         <td class="px-2 sm:px-4 md:px-6 md:py-2 font-mono">{{ game.formatted_playtime }}</td> | ||||||
|                     </tr> |                     </tr> | ||||||
| @ -129,7 +134,10 @@ | |||||||
|             <tbody> |             <tbody> | ||||||
|                 {% for purchase in all_finished_this_year %} |                 {% for purchase in all_finished_this_year %} | ||||||
|                     <tr> |                     <tr> | ||||||
|                     <td class="px-2 sm:px-4 md:px-6 md:py-2 font-mono"><a class="underline decoration-slate-500 sm:decoration-2" href="{% url 'edit_purchase' purchase.id %}">{{ purchase.edition.name }}</a></td> |                         <td class="px-2 sm:px-4 md:px-6 md:py-2 font-mono"> | ||||||
|  |                             <a class="underline decoration-slate-500 sm:decoration-2" | ||||||
|  |                                href="{% url 'edit_purchase' purchase.id %}">{{ purchase.edition.name }}</a> | ||||||
|  |                         </td> | ||||||
|                         <td class="px-2 sm:px-4 md:px-6 md:py-2 font-mono">{{ purchase.date_finished | date:"d/m/Y" }}</td> |                         <td class="px-2 sm:px-4 md:px-6 md:py-2 font-mono">{{ purchase.date_finished | date:"d/m/Y" }}</td> | ||||||
|                     </tr> |                     </tr> | ||||||
|                 {% endfor %} |                 {% endfor %} | ||||||
| @ -146,7 +154,10 @@ | |||||||
|             <tbody> |             <tbody> | ||||||
|                 {% for purchase in this_year_finished_this_year %} |                 {% for purchase in this_year_finished_this_year %} | ||||||
|                     <tr> |                     <tr> | ||||||
|                     <td class="px-2 sm:px-4 md:px-6 md:py-2 font-mono"><a class="underline decoration-slate-500 sm:decoration-2" href="{% url 'edit_purchase' purchase.id %}">{{ purchase.edition.name }}</a></td> |                         <td class="px-2 sm:px-4 md:px-6 md:py-2 font-mono"> | ||||||
|  |                             <a class="underline decoration-slate-500 sm:decoration-2" | ||||||
|  |                                href="{% url 'edit_purchase' purchase.id %}">{{ purchase.edition.name }}</a> | ||||||
|  |                         </td> | ||||||
|                         <td class="px-2 sm:px-4 md:px-6 md:py-2 font-mono">{{ purchase.date_finished | date:"d/m/Y" }}</td> |                         <td class="px-2 sm:px-4 md:px-6 md:py-2 font-mono">{{ purchase.date_finished | date:"d/m/Y" }}</td> | ||||||
|                     </tr> |                     </tr> | ||||||
|                 {% endfor %} |                 {% endfor %} | ||||||
| @ -163,7 +174,10 @@ | |||||||
|             <tbody> |             <tbody> | ||||||
|                 {% for purchase in purchased_this_year_finished_this_year %} |                 {% for purchase in purchased_this_year_finished_this_year %} | ||||||
|                     <tr> |                     <tr> | ||||||
|                     <td class="px-2 sm:px-4 md:px-6 md:py-2 font-mono"><a class="underline decoration-slate-500 sm:decoration-2" href="{% url 'edit_purchase' purchase.id %}">{{ purchase.edition.name }}</a></td> |                         <td class="px-2 sm:px-4 md:px-6 md:py-2 font-mono"> | ||||||
|  |                             <a class="underline decoration-slate-500 sm:decoration-2" | ||||||
|  |                                href="{% url 'edit_purchase' purchase.id %}">{{ purchase.edition.name }}</a> | ||||||
|  |                         </td> | ||||||
|                         <td class="px-2 sm:px-4 md:px-6 md:py-2 font-mono">{{ purchase.date_finished | date:"d/m/Y" }}</td> |                         <td class="px-2 sm:px-4 md:px-6 md:py-2 font-mono">{{ purchase.date_finished | date:"d/m/Y" }}</td> | ||||||
|                     </tr> |                     </tr> | ||||||
|                 {% endfor %} |                 {% endfor %} | ||||||
|  | |||||||
| @ -1,9 +1,8 @@ | |||||||
| {% extends "base.html" %} | {% extends "base.html" %} | ||||||
|  | {% block title %} | ||||||
| {% block title %}{{ title }}{% endblock title %} |     {{ title }} | ||||||
|  | {% endblock title %} | ||||||
| {% load static %} | {% load static %} | ||||||
|  |  | ||||||
| {% block content %} | {% block content %} | ||||||
|     <div class="dark:text-white max-w-sm sm:max-w-xl lg:max-w-3xl mx-auto"> |     <div class="dark:text-white max-w-sm sm:max-w-xl lg:max-w-3xl mx-auto"> | ||||||
|         <h1 class="text-4xl flex items-center"> |         <h1 class="text-4xl flex items-center"> | ||||||
| @ -15,10 +14,12 @@ | |||||||
|         <h2 class="text-lg my-2 ml-2"> |         <h2 class="text-lg my-2 ml-2"> | ||||||
|             {{ hours_sum }} <span class="dark:text-slate-500">total</span> |             {{ hours_sum }} <span class="dark:text-slate-500">total</span> | ||||||
|             {{ session_average }} <span class="dark:text-slate-500">avg</span> |             {{ session_average }} <span class="dark:text-slate-500">avg</span> | ||||||
|             ({{ playrange }}) </h2> |             ({{ playrange }}) | ||||||
|  |         </h2> | ||||||
|         <hr class="border-slate-500"> |         <hr class="border-slate-500"> | ||||||
|         <h1 class="text-3xl mt-4 mb-1">Editions <span class="dark:text-slate-500">({{ edition_count }})</span> and Purchases <span class="dark:text-slate-500">({{ purchase_count }})</span></h1> |         <h1 class="text-3xl mt-4 mb-1"> | ||||||
|  |             Editions <span class="dark:text-slate-500">({{ edition_count }})</span> and Purchases <span class="dark:text-slate-500">({{ purchase_count }})</span> | ||||||
|  |         </h1> | ||||||
|         <ul> |         <ul> | ||||||
|             {% for edition in editions %} |             {% for edition in editions %} | ||||||
|             <li class="sm:pl-2 flex items-center"> |             <li class="sm:pl-2 flex items-center"> | ||||||
| @ -33,64 +34,50 @@ | |||||||
|                 {% url 'edit_edition' edition.id as edit_url %} |                 {% url 'edit_edition' edition.id as edit_url %} | ||||||
|                 {% include 'components/edit_button.html' with edit_url=edit_url %} |                 {% include 'components/edit_button.html' with edit_url=edit_url %} | ||||||
|             </li> |             </li> | ||||||
|  |             {% endfor %} | ||||||
|  |         </ul> | ||||||
|  |         <h1 class="text-3xl mt-4 mb-1">Purchases <span class="dark:text-slate-500">({{ purchases.count }})</span></h1> | ||||||
|         <ul> |         <ul> | ||||||
|                     {% for purchase in edition.game_purchases %} |             {% for purchase in purchases %} | ||||||
|                     <li class="sm:pl-6 flex items-center"> |             <li class="sm:pl-2 flex items-center"> | ||||||
|                         {{ purchase.get_ownership_type_display }}, {{ purchase.date_purchased | date:"Y" }}, {{ purchase.price }} {{ purchase.price_currency}} |                 {{ purchase.platform }} | ||||||
|  |                 ({{ purchase.get_ownership_type_display }}, {{ purchase.date_purchased | date:"Y" }}, {{ purchase.price }} {{ purchase.price_currency}}) | ||||||
|                 {% url 'edit_purchase' purchase.id as edit_url %} |                 {% url 'edit_purchase' purchase.id as edit_url %} | ||||||
|                 {% include 'components/edit_button.html' with edit_url=edit_url %} |                 {% include 'components/edit_button.html' with edit_url=edit_url %} | ||||||
|                     </li> |                 {% if purchase.related_purchases %} | ||||||
|  |                     <li> | ||||||
|                         <ul> |                         <ul> | ||||||
|                         {% for related_purchase in purchase.nongame_related_purchases %} |                             {% for related_purchase in purchase.related_purchases %} | ||||||
|                             <li class="sm:pl-12 flex items-center"> |                                 <li class="sm:pl-6 flex items-center"> | ||||||
|                                 {{ related_purchase.name }} ({{ related_purchase.get_type_display }}, {{ purchase.platform }}, {{ related_purchase.date_purchased | date:"Y" }}, {{ related_purchase.price }} {{ related_purchase.price_currency}}) |                                     {{ related_purchase.name}} ({{ related_purchase.get_type_display }}, {{ related_purchase.date_purchased | date:"Y" }}, {{ related_purchase.price }} {{ related_purchase.price_currency}}) | ||||||
|                                     {% url 'edit_purchase' related_purchase.id as edit_url %} |                                     {% url 'edit_purchase' related_purchase.id as edit_url %} | ||||||
|                                     {% include 'components/edit_button.html' with edit_url=edit_url %} |                                     {% include 'components/edit_button.html' with edit_url=edit_url %} | ||||||
|                                 </li> |                                 </li> | ||||||
|                             {% endfor %} |                             {% endfor %} | ||||||
|                         </ul> |                         </ul> | ||||||
|  |                     </li> | ||||||
|  |                 {% endif %} | ||||||
|  |             </li> | ||||||
|             {% endfor %} |             {% endfor %} | ||||||
|         </ul> |         </ul> | ||||||
|             {% endfor %} |  | ||||||
|         </ul> |  | ||||||
|  |  | ||||||
|         <h1 class="text-3xl mt-4 mb-1 flex gap-2 items-center"> |         <h1 class="text-3xl mt-4 mb-1 flex gap-2 items-center"> | ||||||
|             Sessions |             Sessions | ||||||
|             <span class="dark:text-slate-500"> |             <span class="dark:text-slate-500">({{ sessions.count }})</span> | ||||||
|                 ({{ sessions.count }}) |  | ||||||
|             </span> |  | ||||||
|             {% url 'start_game_session' game.id as add_session_link %} |             {% url 'start_game_session' game.id as add_session_link %} | ||||||
|             {% include 'components/button.html' with title="Start new session" text="New" link=add_session_link %} |             {% include 'components/button.html' with title="Start new session" text="New" link=add_session_link %} | ||||||
|  |             and Notes <span class="dark:text-slate-500">({{ sessions_with_notes_count }})</span> | ||||||
|  |              | ||||||
|         </h1> |         </h1> | ||||||
|         <ul> |         <ul> | ||||||
|             {% for session in sessions %} |             {% for session in sessions %} | ||||||
|             <li class="sm:pl-2 flex items-center"> |                 <li class="sm:pl-2 mt-4 mb-2 dark:text-slate-400 flex items-center"> | ||||||
|                 {{ session.timestamp_start | date:"d/m/Y" }} |                     {{ session.timestamp_start | date:"d/m/Y H:m" }} | ||||||
|                     ({{ session.device.get_type_display | default:"Unknown" }}, {{ session.duration_formatted }}) |                     ({{ session.device.get_type_display | default:"Unknown" }}, {{ session.duration_formatted }}) | ||||||
|                     {% url 'edit_session' session.id as edit_url %} |                     {% url 'edit_session' session.id as edit_url %} | ||||||
|                     {% include 'components/edit_button.html' with edit_url=edit_url %} |                     {% include 'components/edit_button.html' with edit_url=edit_url %} | ||||||
|                 </li> |                 </li> | ||||||
|  |                 <li class="sm:pl-4 italic">{{ session.note|linebreaks }}</li> | ||||||
|             {% endfor %} |             {% endfor %} | ||||||
|         </ul> |         </ul> | ||||||
|         <h1 class="text-3xl mt-4 mb-1">Notes <span class="dark:text-slate-500">({{ sessions_with_notes.count }})</span></h1> |  | ||||||
|         <ul> |  | ||||||
|             {% for session in sessions_with_notes %} |  | ||||||
|             <li class="sm:pl-2"> |  | ||||||
|                 <ul> |  | ||||||
|                     <li class="block dark:text-slate-500"> |  | ||||||
|                         <span class="flex items-center"> |  | ||||||
|                             {{ session.timestamp_start | date:"d/m/Y H:m" }} |  | ||||||
|                             {% url 'edit_session' session.id as edit_session_url %} |  | ||||||
|                             {% include 'components/edit_button.html' with edit_url=edit_session_url %} |  | ||||||
|                         </span> |  | ||||||
|                     </li> |  | ||||||
|                     <li class="sm:pl-4 italic"> |  | ||||||
|                         {{ session.note|linebreaks }} |  | ||||||
|                     </li> |  | ||||||
|                 </ul> |  | ||||||
|             </li> |  | ||||||
|             {% endfor %} |  | ||||||
|         </ul> |  | ||||||
|          |  | ||||||
|     </div> |     </div> | ||||||
| {% endblock content %} | {% endblock content %} | ||||||
|  | |||||||
| @ -93,10 +93,4 @@ urlpatterns = [ | |||||||
|         {"filter": "ownership_type"}, |         {"filter": "ownership_type"}, | ||||||
|         name="list_sessions_by_ownership_type", |         name="list_sessions_by_ownership_type", | ||||||
|     ), |     ), | ||||||
|     path("stats/", views.stats, name="stats_current_year"), |  | ||||||
|     path( |  | ||||||
|         "stats/<int:year>", |  | ||||||
|         views.stats, |  | ||||||
|         name="stats_by_year", |  | ||||||
|     ), |  | ||||||
| ] | ] | ||||||
|  | |||||||
| @ -1,13 +1,11 @@ | |||||||
| from datetime import datetime, timedelta | from datetime import datetime, timedelta | ||||||
| from typing import Any, Callable | from zoneinfo import ZoneInfo | ||||||
|  |  | ||||||
| from django.db.models import Count, F, Prefetch, Sum | from common.time import now as now_with_tz | ||||||
| from django.db.models.functions import TruncDate | from django.conf import settings | ||||||
| from django.http import HttpRequest, HttpResponse, HttpResponseRedirect |  | ||||||
| from django.shortcuts import redirect, render | from django.shortcuts import redirect, render | ||||||
| from django.urls import reverse | from django.urls import reverse | ||||||
| from django.utils import timezone | from django.utils import timezone | ||||||
| from django.core.exceptions import ObjectDoesNotExist |  | ||||||
|  |  | ||||||
| from common.time import format_duration | from common.time import format_duration | ||||||
| from common.utils import safe_division | from common.utils import safe_division | ||||||
| @ -135,10 +133,23 @@ def edit_game(request, game_id=None): | |||||||
|  |  | ||||||
| def view_game(request, game_id=None): | def view_game(request, game_id=None): | ||||||
|     game = Game.objects.get(id=game_id) |     game = Game.objects.get(id=game_id) | ||||||
|     nongame_related_purchases_prefetch = Prefetch( |     context["title"] = "View Game" | ||||||
|         "related_purchases", |     context["game"] = game | ||||||
|         queryset=Purchase.objects.exclude(type=Purchase.GAME), |     context["editions"] = Edition.objects.filter(game_id=game_id) | ||||||
|         to_attr="nongame_related_purchases", |     game_purchases = Purchase.objects.filter(edition__game_id=game_id).filter( | ||||||
|  |         type=Purchase.GAME | ||||||
|  |     ) | ||||||
|  |     for purchase in game_purchases: | ||||||
|  |         purchase.related_purchases = Purchase.objects.exclude( | ||||||
|  |             type=Purchase.GAME | ||||||
|  |         ).filter(related_purchase=purchase.id) | ||||||
|  |  | ||||||
|  |     context["purchases"] = game_purchases | ||||||
|  |     context["sessions"] = Session.objects.filter( | ||||||
|  |         purchase__edition__game_id=game_id | ||||||
|  |     ).order_by("-timestamp_start") | ||||||
|  |     context["total_hours"] = float( | ||||||
|  |         format_duration(context["sessions"].total_duration_unformatted(), "%2.1H") | ||||||
|     ) |     ) | ||||||
|     game_purchases_prefetch = Prefetch( |     game_purchases_prefetch = Prefetch( | ||||||
|         "purchase_set", |         "purchase_set", | ||||||
| @ -174,7 +185,7 @@ def view_game(request, game_id=None): | |||||||
|         "purchase_count": Purchase.objects.filter(edition__game=game).count(), |         "purchase_count": Purchase.objects.filter(edition__game=game).count(), | ||||||
|         "session_average": round(total_hours / int(session_count), 1), |         "session_average": round(total_hours / int(session_count), 1), | ||||||
|         "session_count": session_count, |         "session_count": session_count, | ||||||
|         "sessions_with_notes": sessions.exclude(note=""), |         "sessions_with_notes_count": sessions.exclude(note="").count(), | ||||||
|         "sessions": sessions.order_by("-timestamp_start"), |         "sessions": sessions.order_by("-timestamp_start"), | ||||||
|         "title": f"Game Overview - {game.name}", |         "title": f"Game Overview - {game.name}", | ||||||
|         "hours_sum": total_hours, |         "hours_sum": total_hours, | ||||||
| @ -212,6 +223,8 @@ def edit_edition(request, edition_id=None): | |||||||
|  |  | ||||||
| def related_purchase_by_edition(request): | def related_purchase_by_edition(request): | ||||||
|     edition_id = request.GET.get("edition") |     edition_id = request.GET.get("edition") | ||||||
|  |     if not edition_id: | ||||||
|  |         return HttpResponseBadRequest("Invalid edition_id") | ||||||
|     form = PurchaseForm() |     form = PurchaseForm() | ||||||
|     form.fields["related_purchase"].queryset = Purchase.objects.filter( |     form.fields["related_purchase"].queryset = Purchase.objects.filter( | ||||||
|         edition_id=edition_id, type=Purchase.GAME |         edition_id=edition_id, type=Purchase.GAME | ||||||
| @ -246,12 +259,6 @@ def start_session_same_as_last(request, last_session_id: int): | |||||||
|     return redirect("list_sessions") |     return redirect("list_sessions") | ||||||
|  |  | ||||||
|  |  | ||||||
| # def delete_session(request, session_id=None): |  | ||||||
| #     session = Session.objects.get(id=session_id) |  | ||||||
| #     session.delete() |  | ||||||
| #     return redirect("list_sessions") |  | ||||||
|  |  | ||||||
|  |  | ||||||
| def list_sessions( | def list_sessions( | ||||||
|     request, |     request, | ||||||
|     filter="", |     filter="", | ||||||
| @ -280,12 +287,10 @@ def list_sessions( | |||||||
|         dataset = Session.objects.filter(purchase__ownership_type=ownership_type) |         dataset = Session.objects.filter(purchase__ownership_type=ownership_type) | ||||||
|         context["ownership_type"] = dict(Purchase.OWNERSHIP_TYPES)[ownership_type] |         context["ownership_type"] = dict(Purchase.OWNERSHIP_TYPES)[ownership_type] | ||||||
|     elif filter == "recent": |     elif filter == "recent": | ||||||
|         current_year = timezone.now().year |  | ||||||
|         first_day_of_year = timezone.make_aware(datetime(current_year, 1, 1)) |  | ||||||
|         dataset = Session.objects.filter( |         dataset = Session.objects.filter( | ||||||
|             timestamp_start__gte=first_day_of_year |             timestamp_start__gte=datetime.now() - timedelta(days=30) | ||||||
|         ).order_by("-timestamp_start") |         ) | ||||||
|         context["title"] = "This year" |         context["title"] = "Last 30 days" | ||||||
|     else: |     else: | ||||||
|         # by default, sort from newest to oldest |         # by default, sort from newest to oldest | ||||||
|         dataset = Session.objects.order_by("-timestamp_start") |         dataset = Session.objects.order_by("-timestamp_start") | ||||||
| @ -299,10 +304,8 @@ def list_sessions( | |||||||
|  |  | ||||||
|     context["total_duration"] = dataset.total_duration_formatted() |     context["total_duration"] = dataset.total_duration_formatted() | ||||||
|     context["dataset"] = dataset |     context["dataset"] = dataset | ||||||
|     try: |     # cannot use dataset[0] here because that might be only partial QuerySet | ||||||
|         context["last"] = Session.objects.latest() |     context["last"] = Session.objects.all().order_by("timestamp_start").last() | ||||||
|     except ObjectDoesNotExist: |  | ||||||
|         context["last"] = None |  | ||||||
|  |  | ||||||
|     return render(request, "list_sessions.html", context) |     return render(request, "list_sessions.html", context) | ||||||
|  |  | ||||||
| @ -540,19 +543,3 @@ def add_platform(request): | |||||||
|     context["form"] = form |     context["form"] = form | ||||||
|     context["title"] = "Add New Platform" |     context["title"] = "Add New Platform" | ||||||
|     return render(request, "add.html", context) |     return render(request, "add.html", context) | ||||||
|  |  | ||||||
|  |  | ||||||
| def add_device(request): |  | ||||||
|     context = {} |  | ||||||
|     form = DeviceForm(request.POST or None) |  | ||||||
|     if form.is_valid(): |  | ||||||
|         form.save() |  | ||||||
|         return redirect("index") |  | ||||||
|  |  | ||||||
|     context["form"] = form |  | ||||||
|     context["title"] = "Add New Device" |  | ||||||
|     return render(request, "add.html", context) |  | ||||||
|  |  | ||||||
|  |  | ||||||
| def index(request): |  | ||||||
|     return redirect("list_sessions_recent") |  | ||||||
|  | |||||||
| @ -1,7 +0,0 @@ | |||||||
| { |  | ||||||
|   "devDependencies": { |  | ||||||
|     "@tailwindcss/forms": "^0.5.6", |  | ||||||
|     "@tailwindcss/typography": "^0.5.10", |  | ||||||
|     "tailwindcss": "^3.3.3" |  | ||||||
|   } |  | ||||||
| } |  | ||||||
							
								
								
									
										271
									
								
								poetry.lock
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										271
									
								
								poetry.lock
									
									
									
										generated
									
									
									
								
							| @ -1,10 +1,9 @@ | |||||||
| # This file is automatically @generated by Poetry and should not be changed by hand. | # This file is automatically @generated by Poetry 1.7.0 and should not be changed by hand. | ||||||
|  |  | ||||||
| [[package]] | [[package]] | ||||||
| name = "asgiref" | name = "asgiref" | ||||||
| version = "3.7.2" | version = "3.7.2" | ||||||
| description = "ASGI specs, helper code, and adapters" | description = "ASGI specs, helper code, and adapters" | ||||||
| category = "main" |  | ||||||
| optional = false | optional = false | ||||||
| python-versions = ">=3.7" | python-versions = ">=3.7" | ||||||
| files = [ | files = [ | ||||||
| @ -19,7 +18,6 @@ tests = ["mypy (>=0.800)", "pytest", "pytest-asyncio"] | |||||||
| name = "black" | name = "black" | ||||||
| version = "22.12.0" | version = "22.12.0" | ||||||
| description = "The uncompromising code formatter." | description = "The uncompromising code formatter." | ||||||
| category = "dev" |  | ||||||
| optional = false | optional = false | ||||||
| python-versions = ">=3.7" | python-versions = ">=3.7" | ||||||
| files = [ | files = [ | ||||||
| @ -49,11 +47,21 @@ d = ["aiohttp (>=3.7.4)"] | |||||||
| jupyter = ["ipython (>=7.8.0)", "tokenize-rt (>=3.2.0)"] | jupyter = ["ipython (>=7.8.0)", "tokenize-rt (>=3.2.0)"] | ||||||
| uvloop = ["uvloop (>=0.15.2)"] | uvloop = ["uvloop (>=0.15.2)"] | ||||||
|  |  | ||||||
|  | [[package]] | ||||||
|  | name = "cfgv" | ||||||
|  | version = "3.4.0" | ||||||
|  | description = "Validate configuration and produce human readable error messages." | ||||||
|  | optional = false | ||||||
|  | python-versions = ">=3.8" | ||||||
|  | files = [ | ||||||
|  |     {file = "cfgv-3.4.0-py2.py3-none-any.whl", hash = "sha256:b7265b1f29fd3316bfcd2b330d63d024f2bfd8bcb8b0272f8e19a504856c48f9"}, | ||||||
|  |     {file = "cfgv-3.4.0.tar.gz", hash = "sha256:e52591d4c5f5dead8e0f673fb16db7949d2cfb3f7da4582893288f0ded8fe560"}, | ||||||
|  | ] | ||||||
|  |  | ||||||
| [[package]] | [[package]] | ||||||
| name = "click" | name = "click" | ||||||
| version = "8.1.7" | version = "8.1.7" | ||||||
| description = "Composable command line interface toolkit" | description = "Composable command line interface toolkit" | ||||||
| category = "main" |  | ||||||
| optional = false | optional = false | ||||||
| python-versions = ">=3.7" | python-versions = ">=3.7" | ||||||
| files = [ | files = [ | ||||||
| @ -68,7 +76,6 @@ colorama = {version = "*", markers = "platform_system == \"Windows\""} | |||||||
| name = "colorama" | name = "colorama" | ||||||
| version = "0.4.6" | version = "0.4.6" | ||||||
| description = "Cross-platform colored terminal text." | description = "Cross-platform colored terminal text." | ||||||
| category = "main" |  | ||||||
| optional = false | optional = false | ||||||
| python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,>=2.7" | python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,>=2.7" | ||||||
| files = [ | files = [ | ||||||
| @ -80,7 +87,6 @@ files = [ | |||||||
| name = "cssbeautifier" | name = "cssbeautifier" | ||||||
| version = "1.14.11" | version = "1.14.11" | ||||||
| description = "CSS unobfuscator and beautifier." | description = "CSS unobfuscator and beautifier." | ||||||
| category = "dev" |  | ||||||
| optional = false | optional = false | ||||||
| python-versions = "*" | python-versions = "*" | ||||||
| files = [ | files = [ | ||||||
| @ -96,7 +102,6 @@ six = ">=1.13.0" | |||||||
| name = "django" | name = "django" | ||||||
| version = "4.2.7" | version = "4.2.7" | ||||||
| description = "A high-level Python web framework that encourages rapid development and clean, pragmatic design." | description = "A high-level Python web framework that encourages rapid development and clean, pragmatic design." | ||||||
| category = "main" |  | ||||||
| optional = false | optional = false | ||||||
| python-versions = ">=3.8" | python-versions = ">=3.8" | ||||||
| files = [ | files = [ | ||||||
| @ -113,11 +118,25 @@ tzdata = {version = "*", markers = "sys_platform == \"win32\""} | |||||||
| argon2 = ["argon2-cffi (>=19.1.0)"] | argon2 = ["argon2-cffi (>=19.1.0)"] | ||||||
| bcrypt = ["bcrypt"] | bcrypt = ["bcrypt"] | ||||||
|  |  | ||||||
|  | [[package]] | ||||||
|  | name = "django-cors-headers" | ||||||
|  | version = "3.13.0" | ||||||
|  | description = "django-cors-headers is a Django application for handling the server headers required for Cross-Origin Resource Sharing (CORS)." | ||||||
|  | category = "main" | ||||||
|  | optional = false | ||||||
|  | python-versions = ">=3.7" | ||||||
|  | files = [ | ||||||
|  |     {file = "django-cors-headers-3.13.0.tar.gz", hash = "sha256:f9dc6b4e3f611c3199700b3e5f3398c28757dcd559c2f82932687f3d0443cfdf"}, | ||||||
|  |     {file = "django_cors_headers-3.13.0-py3-none-any.whl", hash = "sha256:37e42883b5f1f2295df6b4bba96eb2417a14a03270cb24b2a07f021cd4487cf4"}, | ||||||
|  | ] | ||||||
|  |  | ||||||
|  | [package.dependencies] | ||||||
|  | Django = ">=3.2" | ||||||
|  |  | ||||||
| [[package]] | [[package]] | ||||||
| name = "django-extensions" | name = "django-extensions" | ||||||
| version = "3.2.3" | version = "3.2.3" | ||||||
| description = "Extensions for Django" | description = "Extensions for Django" | ||||||
| category = "dev" |  | ||||||
| optional = false | optional = false | ||||||
| python-versions = ">=3.6" | python-versions = ">=3.6" | ||||||
| files = [ | files = [ | ||||||
| @ -128,11 +147,40 @@ files = [ | |||||||
| [package.dependencies] | [package.dependencies] | ||||||
| Django = ">=3.2" | Django = ">=3.2" | ||||||
|  |  | ||||||
|  | [[package]] | ||||||
|  | name = "django-rest-framework" | ||||||
|  | version = "0.1.0" | ||||||
|  | description = "alias." | ||||||
|  | category = "main" | ||||||
|  | optional = false | ||||||
|  | python-versions = "*" | ||||||
|  | files = [ | ||||||
|  |     {file = "django-rest-framework-0.1.0.tar.gz", hash = "sha256:47a8f496fa69e3b6bd79f68dd7a1527d907d6b77f009e9db7cf9bb21cc565e4a"}, | ||||||
|  | ] | ||||||
|  |  | ||||||
|  | [package.dependencies] | ||||||
|  | djangorestframework = "*" | ||||||
|  |  | ||||||
|  | [[package]] | ||||||
|  | name = "djangorestframework" | ||||||
|  | version = "3.14.0" | ||||||
|  | description = "Web APIs for Django, made easy." | ||||||
|  | category = "main" | ||||||
|  | optional = false | ||||||
|  | python-versions = ">=3.6" | ||||||
|  | files = [ | ||||||
|  |     {file = "djangorestframework-3.14.0-py3-none-any.whl", hash = "sha256:eb63f58c9f218e1a7d064d17a70751f528ed4e1d35547fdade9aaf4cd103fd08"}, | ||||||
|  |     {file = "djangorestframework-3.14.0.tar.gz", hash = "sha256:579a333e6256b09489cbe0a067e66abe55c6595d8926be6b99423786334350c8"}, | ||||||
|  | ] | ||||||
|  |  | ||||||
|  | [package.dependencies] | ||||||
|  | django = ">=3.0" | ||||||
|  | pytz = "*" | ||||||
|  |  | ||||||
| [[package]] | [[package]] | ||||||
| name = "djhtml" | name = "djhtml" | ||||||
| version = "1.5.2" | version = "1.5.2" | ||||||
| description = "Django/Jinja template indenter" | description = "Django/Jinja template indenter" | ||||||
| category = "dev" |  | ||||||
| optional = false | optional = false | ||||||
| python-versions = "*" | python-versions = "*" | ||||||
| files = [ | files = [ | ||||||
| @ -146,7 +194,6 @@ dev = ["black", "flake8", "isort", "nox", "pre-commit"] | |||||||
| name = "djlint" | name = "djlint" | ||||||
| version = "1.34.0" | version = "1.34.0" | ||||||
| description = "HTML Template Linter and Formatter" | description = "HTML Template Linter and Formatter" | ||||||
| category = "dev" |  | ||||||
| optional = false | optional = false | ||||||
| python-versions = ">=3.8.0,<4.0.0" | python-versions = ">=3.8.0,<4.0.0" | ||||||
| files = [ | files = [ | ||||||
| @ -171,7 +218,6 @@ tqdm = ">=4.62.2,<5.0.0" | |||||||
| name = "editorconfig" | name = "editorconfig" | ||||||
| version = "0.12.3" | version = "0.12.3" | ||||||
| description = "EditorConfig File Locator and Interpreter for Python" | description = "EditorConfig File Locator and Interpreter for Python" | ||||||
| category = "dev" |  | ||||||
| optional = false | optional = false | ||||||
| python-versions = "*" | python-versions = "*" | ||||||
| files = [ | files = [ | ||||||
| @ -179,11 +225,24 @@ files = [ | |||||||
|     {file = "EditorConfig-0.12.3.tar.gz", hash = "sha256:57f8ce78afcba15c8b18d46b5170848c88d56fd38f05c2ec60dbbfcb8996e89e"}, |     {file = "EditorConfig-0.12.3.tar.gz", hash = "sha256:57f8ce78afcba15c8b18d46b5170848c88d56fd38f05c2ec60dbbfcb8996e89e"}, | ||||||
| ] | ] | ||||||
|  |  | ||||||
|  | [[package]] | ||||||
|  | name = "filelock" | ||||||
|  | version = "3.13.1" | ||||||
|  | description = "A platform independent file lock." | ||||||
|  | optional = false | ||||||
|  | python-versions = ">=3.8" | ||||||
|  | files = [ | ||||||
|  |     {file = "filelock-3.13.1-py3-none-any.whl", hash = "sha256:57dbda9b35157b05fb3e58ee91448612eb674172fab98ee235ccb0b5bee19a1c"}, | ||||||
|  |     {file = "filelock-3.13.1.tar.gz", hash = "sha256:521f5f56c50f8426f5e03ad3b281b490a87ef15bc6c526f168290f0c7148d44e"}, | ||||||
|  | ] | ||||||
|  |  | ||||||
|  | [package.extras] | ||||||
|  | test = ["pytest (>=6)"] | ||||||
|  |  | ||||||
| [[package]] | [[package]] | ||||||
| name = "gunicorn" | name = "gunicorn" | ||||||
| version = "20.1.0" | version = "20.1.0" | ||||||
| description = "WSGI HTTP Server for UNIX" | description = "WSGI HTTP Server for UNIX" | ||||||
| category = "main" |  | ||||||
| optional = false | optional = false | ||||||
| python-versions = ">=3.5" | python-versions = ">=3.5" | ||||||
| files = [ | files = [ | ||||||
| @ -204,7 +263,6 @@ tornado = ["tornado (>=0.2)"] | |||||||
| name = "h11" | name = "h11" | ||||||
| version = "0.14.0" | version = "0.14.0" | ||||||
| description = "A pure-Python, bring-your-own-I/O implementation of HTTP/1.1" | description = "A pure-Python, bring-your-own-I/O implementation of HTTP/1.1" | ||||||
| category = "main" |  | ||||||
| optional = false | optional = false | ||||||
| python-versions = ">=3.7" | python-versions = ">=3.7" | ||||||
| files = [ | files = [ | ||||||
| @ -216,7 +274,6 @@ files = [ | |||||||
| name = "html-tag-names" | name = "html-tag-names" | ||||||
| version = "0.1.2" | version = "0.1.2" | ||||||
| description = "List of known HTML tag names" | description = "List of known HTML tag names" | ||||||
| category = "dev" |  | ||||||
| optional = false | optional = false | ||||||
| python-versions = ">=3.7,<4.0" | python-versions = ">=3.7,<4.0" | ||||||
| files = [ | files = [ | ||||||
| @ -228,7 +285,6 @@ files = [ | |||||||
| name = "html-void-elements" | name = "html-void-elements" | ||||||
| version = "0.1.0" | version = "0.1.0" | ||||||
| description = "List of HTML void tag names." | description = "List of HTML void tag names." | ||||||
| category = "dev" |  | ||||||
| optional = false | optional = false | ||||||
| python-versions = ">=3.7,<4.0" | python-versions = ">=3.7,<4.0" | ||||||
| files = [ | files = [ | ||||||
| @ -236,11 +292,24 @@ files = [ | |||||||
|     {file = "html_void_elements-0.1.0-py3-none-any.whl", hash = "sha256:784cf39db03cdeb017320d9301009f8f3480f9d7b254d0974272e80e0cb5e0d2"}, |     {file = "html_void_elements-0.1.0-py3-none-any.whl", hash = "sha256:784cf39db03cdeb017320d9301009f8f3480f9d7b254d0974272e80e0cb5e0d2"}, | ||||||
| ] | ] | ||||||
|  |  | ||||||
|  | [[package]] | ||||||
|  | name = "identify" | ||||||
|  | version = "2.5.31" | ||||||
|  | description = "File identification library for Python" | ||||||
|  | optional = false | ||||||
|  | python-versions = ">=3.8" | ||||||
|  | files = [ | ||||||
|  |     {file = "identify-2.5.31-py2.py3-none-any.whl", hash = "sha256:90199cb9e7bd3c5407a9b7e81b4abec4bb9d249991c79439ec8af740afc6293d"}, | ||||||
|  |     {file = "identify-2.5.31.tar.gz", hash = "sha256:7736b3c7a28233637e3c36550646fc6389bedd74ae84cb788200cc8e2dd60b75"}, | ||||||
|  | ] | ||||||
|  |  | ||||||
|  | [package.extras] | ||||||
|  | license = ["ukkonen"] | ||||||
|  |  | ||||||
| [[package]] | [[package]] | ||||||
| name = "iniconfig" | name = "iniconfig" | ||||||
| version = "2.0.0" | version = "2.0.0" | ||||||
| description = "brain-dead simple config-ini parsing" | description = "brain-dead simple config-ini parsing" | ||||||
| category = "dev" |  | ||||||
| optional = false | optional = false | ||||||
| python-versions = ">=3.7" | python-versions = ">=3.7" | ||||||
| files = [ | files = [ | ||||||
| @ -252,7 +321,6 @@ files = [ | |||||||
| name = "isort" | name = "isort" | ||||||
| version = "5.12.0" | version = "5.12.0" | ||||||
| description = "A Python utility / library to sort Python imports." | description = "A Python utility / library to sort Python imports." | ||||||
| category = "dev" |  | ||||||
| optional = false | optional = false | ||||||
| python-versions = ">=3.8.0" | python-versions = ">=3.8.0" | ||||||
| files = [ | files = [ | ||||||
| @ -270,7 +338,6 @@ requirements-deprecated-finder = ["pip-api", "pipreqs"] | |||||||
| name = "jsbeautifier" | name = "jsbeautifier" | ||||||
| version = "1.14.11" | version = "1.14.11" | ||||||
| description = "JavaScript unobfuscator and beautifier." | description = "JavaScript unobfuscator and beautifier." | ||||||
| category = "dev" |  | ||||||
| optional = false | optional = false | ||||||
| python-versions = "*" | python-versions = "*" | ||||||
| files = [ | files = [ | ||||||
| @ -281,26 +348,10 @@ files = [ | |||||||
| editorconfig = ">=0.12.2" | editorconfig = ">=0.12.2" | ||||||
| six = ">=1.13.0" | six = ">=1.13.0" | ||||||
|  |  | ||||||
| [[package]] |  | ||||||
| name = "json5" |  | ||||||
| version = "0.9.14" |  | ||||||
| description = "A Python implementation of the JSON5 data format." |  | ||||||
| category = "dev" |  | ||||||
| optional = false |  | ||||||
| python-versions = "*" |  | ||||||
| files = [ |  | ||||||
|     {file = "json5-0.9.14-py2.py3-none-any.whl", hash = "sha256:740c7f1b9e584a468dbb2939d8d458db3427f2c93ae2139d05f47e453eae964f"}, |  | ||||||
|     {file = "json5-0.9.14.tar.gz", hash = "sha256:9ed66c3a6ca3510a976a9ef9b8c0787de24802724ab1860bc0153c7fdd589b02"}, |  | ||||||
| ] |  | ||||||
|  |  | ||||||
| [package.extras] |  | ||||||
| dev = ["hypothesis"] |  | ||||||
|  |  | ||||||
| [[package]] | [[package]] | ||||||
| name = "markupsafe" | name = "markupsafe" | ||||||
| version = "2.1.3" | version = "2.1.3" | ||||||
| description = "Safely add untrusted strings to HTML/XML markup." | description = "Safely add untrusted strings to HTML/XML markup." | ||||||
| category = "dev" |  | ||||||
| optional = false | optional = false | ||||||
| python-versions = ">=3.7" | python-versions = ">=3.7" | ||||||
| files = [ | files = [ | ||||||
| @ -370,7 +421,6 @@ files = [ | |||||||
| name = "mypy" | name = "mypy" | ||||||
| version = "0.991" | version = "0.991" | ||||||
| description = "Optional static typing for Python" | description = "Optional static typing for Python" | ||||||
| category = "dev" |  | ||||||
| optional = false | optional = false | ||||||
| python-versions = ">=3.7" | python-versions = ">=3.7" | ||||||
| files = [ | files = [ | ||||||
| @ -420,7 +470,6 @@ reports = ["lxml"] | |||||||
| name = "mypy-extensions" | name = "mypy-extensions" | ||||||
| version = "1.0.0" | version = "1.0.0" | ||||||
| description = "Type system extensions for programs checked with the mypy type checker." | description = "Type system extensions for programs checked with the mypy type checker." | ||||||
| category = "dev" |  | ||||||
| optional = false | optional = false | ||||||
| python-versions = ">=3.5" | python-versions = ">=3.5" | ||||||
| files = [ | files = [ | ||||||
| @ -430,11 +479,23 @@ files = [ | |||||||
|  |  | ||||||
| [[package]] | [[package]] | ||||||
| name = "packaging" | name = "packaging" | ||||||
| version = "23.2" | version = "22.0" | ||||||
| description = "Core utilities for Python packages" | description = "Core utilities for Python packages" | ||||||
| category = "dev" | category = "dev" | ||||||
| optional = false | optional = false | ||||||
| python-versions = ">=3.7" | python-versions = ">=3.7" | ||||||
|  | files = [ | ||||||
|  |     {file = "packaging-22.0-py3-none-any.whl", hash = "sha256:957e2148ba0e1a3b282772e791ef1d8083648bc131c8ab0c1feba110ce1146c3"}, | ||||||
|  |     {file = "packaging-22.0.tar.gz", hash = "sha256:2198ec20bd4c017b8f9717e00f0c8714076fc2fd93816750ab48e2c41de2cfd3"}, | ||||||
|  | ] | ||||||
|  |  | ||||||
|  | [[package]] | ||||||
|  | name = "pathspec" | ||||||
|  | version = "0.10.3" | ||||||
|  | description = "Utility library for gitignore style pattern matching of file paths." | ||||||
|  | category = "dev" | ||||||
|  | optional = false | ||||||
|  | python-versions = ">=3.7" | ||||||
| files = [ | files = [ | ||||||
|     {file = "packaging-23.2-py3-none-any.whl", hash = "sha256:8c491190033a9af7e1d931d0b5dacc2ef47509b34dd0de67ed209b5203fc88c7"}, |     {file = "packaging-23.2-py3-none-any.whl", hash = "sha256:8c491190033a9af7e1d931d0b5dacc2ef47509b34dd0de67ed209b5203fc88c7"}, | ||||||
|     {file = "packaging-23.2.tar.gz", hash = "sha256:048fb0e9405036518eaaf48a55953c750c11e1a1b68e0dd1a9d62ed0c092cfc5"}, |     {file = "packaging-23.2.tar.gz", hash = "sha256:048fb0e9405036518eaaf48a55953c750c11e1a1b68e0dd1a9d62ed0c092cfc5"}, | ||||||
| @ -444,24 +505,109 @@ files = [ | |||||||
| name = "pathspec" | name = "pathspec" | ||||||
| version = "0.11.2" | version = "0.11.2" | ||||||
| description = "Utility library for gitignore style pattern matching of file paths." | description = "Utility library for gitignore style pattern matching of file paths." | ||||||
| category = "dev" |  | ||||||
| optional = false | optional = false | ||||||
| python-versions = ">=3.7" | python-versions = ">=3.7" | ||||||
| files = [ | files = [ | ||||||
|     {file = "pathspec-0.11.2-py3-none-any.whl", hash = "sha256:1d6ed233af05e679efb96b1851550ea95bbb64b7c490b0f5aa52996c11e92a20"}, |     {file = "pathspec-0.10.3-py3-none-any.whl", hash = "sha256:3c95343af8b756205e2aba76e843ba9520a24dd84f68c22b9f93251507509dd6"}, | ||||||
|     {file = "pathspec-0.11.2.tar.gz", hash = "sha256:e0d8d0ac2f12da61956eb2306b69f9469b42f4deb0f3cb6ed47b9cce9996ced3"}, |     {file = "pathspec-0.10.3.tar.gz", hash = "sha256:56200de4077d9d0791465aa9095a01d421861e405b5096955051deefd697d6f6"}, | ||||||
|  | ] | ||||||
|  |  | ||||||
|  | [[package]] | ||||||
|  | name = "pillow" | ||||||
|  | version = "9.4.0" | ||||||
|  | description = "Python Imaging Library (Fork)" | ||||||
|  | category = "main" | ||||||
|  | optional = false | ||||||
|  | python-versions = ">=3.7" | ||||||
|  | files = [ | ||||||
|  |     {file = "Pillow-9.4.0-1-cp310-cp310-macosx_10_10_x86_64.whl", hash = "sha256:1b4b4e9dda4f4e4c4e6896f93e84a8f0bcca3b059de9ddf67dac3c334b1195e1"}, | ||||||
|  |     {file = "Pillow-9.4.0-1-cp311-cp311-macosx_10_10_x86_64.whl", hash = "sha256:fb5c1ad6bad98c57482236a21bf985ab0ef42bd51f7ad4e4538e89a997624e12"}, | ||||||
|  |     {file = "Pillow-9.4.0-1-cp37-cp37m-macosx_10_10_x86_64.whl", hash = "sha256:f0caf4a5dcf610d96c3bd32932bfac8aee61c96e60481c2a0ea58da435e25acd"}, | ||||||
|  |     {file = "Pillow-9.4.0-1-cp38-cp38-macosx_10_10_x86_64.whl", hash = "sha256:3f4cc516e0b264c8d4ccd6b6cbc69a07c6d582d8337df79be1e15a5056b258c9"}, | ||||||
|  |     {file = "Pillow-9.4.0-1-cp39-cp39-macosx_10_10_x86_64.whl", hash = "sha256:b8c2f6eb0df979ee99433d8b3f6d193d9590f735cf12274c108bd954e30ca858"}, | ||||||
|  |     {file = "Pillow-9.4.0-1-pp38-pypy38_pp73-macosx_10_10_x86_64.whl", hash = "sha256:b70756ec9417c34e097f987b4d8c510975216ad26ba6e57ccb53bc758f490dab"}, | ||||||
|  |     {file = "Pillow-9.4.0-1-pp39-pypy39_pp73-macosx_10_10_x86_64.whl", hash = "sha256:43521ce2c4b865d385e78579a082b6ad1166ebed2b1a2293c3be1d68dd7ca3b9"}, | ||||||
|  |     {file = "Pillow-9.4.0-2-cp310-cp310-macosx_10_10_x86_64.whl", hash = "sha256:9d9a62576b68cd90f7075876f4e8444487db5eeea0e4df3ba298ee38a8d067b0"}, | ||||||
|  |     {file = "Pillow-9.4.0-2-cp311-cp311-macosx_10_10_x86_64.whl", hash = "sha256:87708d78a14d56a990fbf4f9cb350b7d89ee8988705e58e39bdf4d82c149210f"}, | ||||||
|  |     {file = "Pillow-9.4.0-2-cp37-cp37m-macosx_10_10_x86_64.whl", hash = "sha256:8a2b5874d17e72dfb80d917213abd55d7e1ed2479f38f001f264f7ce7bae757c"}, | ||||||
|  |     {file = "Pillow-9.4.0-2-cp38-cp38-macosx_10_10_x86_64.whl", hash = "sha256:83125753a60cfc8c412de5896d10a0a405e0bd88d0470ad82e0869ddf0cb3848"}, | ||||||
|  |     {file = "Pillow-9.4.0-2-cp39-cp39-macosx_10_10_x86_64.whl", hash = "sha256:9e5f94742033898bfe84c93c831a6f552bb629448d4072dd312306bab3bd96f1"}, | ||||||
|  |     {file = "Pillow-9.4.0-2-pp38-pypy38_pp73-macosx_10_10_x86_64.whl", hash = "sha256:013016af6b3a12a2f40b704677f8b51f72cb007dac785a9933d5c86a72a7fe33"}, | ||||||
|  |     {file = "Pillow-9.4.0-2-pp39-pypy39_pp73-macosx_10_10_x86_64.whl", hash = "sha256:99d92d148dd03fd19d16175b6d355cc1b01faf80dae93c6c3eb4163709edc0a9"}, | ||||||
|  |     {file = "Pillow-9.4.0-cp310-cp310-macosx_10_10_x86_64.whl", hash = "sha256:2968c58feca624bb6c8502f9564dd187d0e1389964898f5e9e1fbc8533169157"}, | ||||||
|  |     {file = "Pillow-9.4.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:c5c1362c14aee73f50143d74389b2c158707b4abce2cb055b7ad37ce60738d47"}, | ||||||
|  |     {file = "Pillow-9.4.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:bd752c5ff1b4a870b7661234694f24b1d2b9076b8bf337321a814c612665f343"}, | ||||||
|  |     {file = "Pillow-9.4.0-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:9a3049a10261d7f2b6514d35bbb7a4dfc3ece4c4de14ef5876c4b7a23a0e566d"}, | ||||||
|  |     {file = "Pillow-9.4.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:16a8df99701f9095bea8a6c4b3197da105df6f74e6176c5b410bc2df2fd29a57"}, | ||||||
|  |     {file = "Pillow-9.4.0-cp310-cp310-manylinux_2_28_aarch64.whl", hash = "sha256:94cdff45173b1919350601f82d61365e792895e3c3a3443cf99819e6fbf717a5"}, | ||||||
|  |     {file = "Pillow-9.4.0-cp310-cp310-manylinux_2_28_x86_64.whl", hash = "sha256:ed3e4b4e1e6de75fdc16d3259098de7c6571b1a6cc863b1a49e7d3d53e036070"}, | ||||||
|  |     {file = "Pillow-9.4.0-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:d5b2f8a31bd43e0f18172d8ac82347c8f37ef3e0b414431157718aa234991b28"}, | ||||||
|  |     {file = "Pillow-9.4.0-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:09b89ddc95c248ee788328528e6a2996e09eaccddeeb82a5356e92645733be35"}, | ||||||
|  |     {file = "Pillow-9.4.0-cp310-cp310-win32.whl", hash = "sha256:f09598b416ba39a8f489c124447b007fe865f786a89dbfa48bb5cf395693132a"}, | ||||||
|  |     {file = "Pillow-9.4.0-cp310-cp310-win_amd64.whl", hash = "sha256:f6e78171be3fb7941f9910ea15b4b14ec27725865a73c15277bc39f5ca4f8391"}, | ||||||
|  |     {file = "Pillow-9.4.0-cp311-cp311-macosx_10_10_x86_64.whl", hash = "sha256:3fa1284762aacca6dc97474ee9c16f83990b8eeb6697f2ba17140d54b453e133"}, | ||||||
|  |     {file = "Pillow-9.4.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:eaef5d2de3c7e9b21f1e762f289d17b726c2239a42b11e25446abf82b26ac132"}, | ||||||
|  |     {file = "Pillow-9.4.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a4dfdae195335abb4e89cc9762b2edc524f3c6e80d647a9a81bf81e17e3fb6f0"}, | ||||||
|  |     {file = "Pillow-9.4.0-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:6abfb51a82e919e3933eb137e17c4ae9c0475a25508ea88993bb59faf82f3b35"}, | ||||||
|  |     {file = "Pillow-9.4.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:451f10ef963918e65b8869e17d67db5e2f4ab40e716ee6ce7129b0cde2876eab"}, | ||||||
|  |     {file = "Pillow-9.4.0-cp311-cp311-manylinux_2_28_aarch64.whl", hash = "sha256:6663977496d616b618b6cfa43ec86e479ee62b942e1da76a2c3daa1c75933ef4"}, | ||||||
|  |     {file = "Pillow-9.4.0-cp311-cp311-manylinux_2_28_x86_64.whl", hash = "sha256:60e7da3a3ad1812c128750fc1bc14a7ceeb8d29f77e0a2356a8fb2aa8925287d"}, | ||||||
|  |     {file = "Pillow-9.4.0-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:19005a8e58b7c1796bc0167862b1f54a64d3b44ee5d48152b06bb861458bc0f8"}, | ||||||
|  |     {file = "Pillow-9.4.0-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:f715c32e774a60a337b2bb8ad9839b4abf75b267a0f18806f6f4f5f1688c4b5a"}, | ||||||
|  |     {file = "Pillow-9.4.0-cp311-cp311-win32.whl", hash = "sha256:b222090c455d6d1a64e6b7bb5f4035c4dff479e22455c9eaa1bdd4c75b52c80c"}, | ||||||
|  |     {file = "Pillow-9.4.0-cp311-cp311-win_amd64.whl", hash = "sha256:ba6612b6548220ff5e9df85261bddc811a057b0b465a1226b39bfb8550616aee"}, | ||||||
|  |     {file = "Pillow-9.4.0-cp37-cp37m-macosx_10_10_x86_64.whl", hash = "sha256:5f532a2ad4d174eb73494e7397988e22bf427f91acc8e6ebf5bb10597b49c493"}, | ||||||
|  |     {file = "Pillow-9.4.0-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:5dd5a9c3091a0f414a963d427f920368e2b6a4c2f7527fdd82cde8ef0bc7a327"}, | ||||||
|  |     {file = "Pillow-9.4.0-cp37-cp37m-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:ef21af928e807f10bf4141cad4746eee692a0dd3ff56cfb25fce076ec3cc8abe"}, | ||||||
|  |     {file = "Pillow-9.4.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:847b114580c5cc9ebaf216dd8c8dbc6b00a3b7ab0131e173d7120e6deade1f57"}, | ||||||
|  |     {file = "Pillow-9.4.0-cp37-cp37m-manylinux_2_28_aarch64.whl", hash = "sha256:653d7fb2df65efefbcbf81ef5fe5e5be931f1ee4332c2893ca638c9b11a409c4"}, | ||||||
|  |     {file = "Pillow-9.4.0-cp37-cp37m-manylinux_2_28_x86_64.whl", hash = "sha256:46f39cab8bbf4a384ba7cb0bc8bae7b7062b6a11cfac1ca4bc144dea90d4a9f5"}, | ||||||
|  |     {file = "Pillow-9.4.0-cp37-cp37m-win32.whl", hash = "sha256:7ac7594397698f77bce84382929747130765f66406dc2cd8b4ab4da68ade4c6e"}, | ||||||
|  |     {file = "Pillow-9.4.0-cp37-cp37m-win_amd64.whl", hash = "sha256:46c259e87199041583658457372a183636ae8cd56dbf3f0755e0f376a7f9d0e6"}, | ||||||
|  |     {file = "Pillow-9.4.0-cp38-cp38-macosx_10_10_x86_64.whl", hash = "sha256:0e51f608da093e5d9038c592b5b575cadc12fd748af1479b5e858045fff955a9"}, | ||||||
|  |     {file = "Pillow-9.4.0-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:765cb54c0b8724a7c12c55146ae4647e0274a839fb6de7bcba841e04298e1011"}, | ||||||
|  |     {file = "Pillow-9.4.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:519e14e2c49fcf7616d6d2cfc5c70adae95682ae20f0395e9280db85e8d6c4df"}, | ||||||
|  |     {file = "Pillow-9.4.0-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:d197df5489004db87d90b918033edbeee0bd6df3848a204bca3ff0a903bef837"}, | ||||||
|  |     {file = "Pillow-9.4.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:0845adc64fe9886db00f5ab68c4a8cd933ab749a87747555cec1c95acea64b0b"}, | ||||||
|  |     {file = "Pillow-9.4.0-cp38-cp38-manylinux_2_28_aarch64.whl", hash = "sha256:e1339790c083c5a4de48f688b4841f18df839eb3c9584a770cbd818b33e26d5d"}, | ||||||
|  |     {file = "Pillow-9.4.0-cp38-cp38-manylinux_2_28_x86_64.whl", hash = "sha256:a96e6e23f2b79433390273eaf8cc94fec9c6370842e577ab10dabdcc7ea0a66b"}, | ||||||
|  |     {file = "Pillow-9.4.0-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:7cfc287da09f9d2a7ec146ee4d72d6ea1342e770d975e49a8621bf54eaa8f30f"}, | ||||||
|  |     {file = "Pillow-9.4.0-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:d7081c084ceb58278dd3cf81f836bc818978c0ccc770cbbb202125ddabec6628"}, | ||||||
|  |     {file = "Pillow-9.4.0-cp38-cp38-win32.whl", hash = "sha256:df41112ccce5d47770a0c13651479fbcd8793f34232a2dd9faeccb75eb5d0d0d"}, | ||||||
|  |     {file = "Pillow-9.4.0-cp38-cp38-win_amd64.whl", hash = "sha256:7a21222644ab69ddd9967cfe6f2bb420b460dae4289c9d40ff9a4896e7c35c9a"}, | ||||||
|  |     {file = "Pillow-9.4.0-cp39-cp39-macosx_10_10_x86_64.whl", hash = "sha256:0f3269304c1a7ce82f1759c12ce731ef9b6e95b6df829dccd9fe42912cc48569"}, | ||||||
|  |     {file = "Pillow-9.4.0-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:cb362e3b0976dc994857391b776ddaa8c13c28a16f80ac6522c23d5257156bed"}, | ||||||
|  |     {file = "Pillow-9.4.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a2e0f87144fcbbe54297cae708c5e7f9da21a4646523456b00cc956bd4c65815"}, | ||||||
|  |     {file = "Pillow-9.4.0-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:28676836c7796805914b76b1837a40f76827ee0d5398f72f7dcc634bae7c6264"}, | ||||||
|  |     {file = "Pillow-9.4.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:0884ba7b515163a1a05440a138adeb722b8a6ae2c2b33aea93ea3118dd3a899e"}, | ||||||
|  |     {file = "Pillow-9.4.0-cp39-cp39-manylinux_2_28_aarch64.whl", hash = "sha256:53dcb50fbdc3fb2c55431a9b30caeb2f7027fcd2aeb501459464f0214200a503"}, | ||||||
|  |     {file = "Pillow-9.4.0-cp39-cp39-manylinux_2_28_x86_64.whl", hash = "sha256:e8c5cf126889a4de385c02a2c3d3aba4b00f70234bfddae82a5eaa3ee6d5e3e6"}, | ||||||
|  |     {file = "Pillow-9.4.0-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:6c6b1389ed66cdd174d040105123a5a1bc91d0aa7059c7261d20e583b6d8cbd2"}, | ||||||
|  |     {file = "Pillow-9.4.0-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:0dd4c681b82214b36273c18ca7ee87065a50e013112eea7d78c7a1b89a739153"}, | ||||||
|  |     {file = "Pillow-9.4.0-cp39-cp39-win32.whl", hash = "sha256:6d9dfb9959a3b0039ee06c1a1a90dc23bac3b430842dcb97908ddde05870601c"}, | ||||||
|  |     {file = "Pillow-9.4.0-cp39-cp39-win_amd64.whl", hash = "sha256:54614444887e0d3043557d9dbc697dbb16cfb5a35d672b7a0fcc1ed0cf1c600b"}, | ||||||
|  |     {file = "Pillow-9.4.0-pp38-pypy38_pp73-macosx_10_10_x86_64.whl", hash = "sha256:b9b752ab91e78234941e44abdecc07f1f0d8f51fb62941d32995b8161f68cfe5"}, | ||||||
|  |     {file = "Pillow-9.4.0-pp38-pypy38_pp73-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:d3b56206244dc8711f7e8b7d6cad4663917cd5b2d950799425076681e8766286"}, | ||||||
|  |     {file = "Pillow-9.4.0-pp38-pypy38_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:aabdab8ec1e7ca7f1434d042bf8b1e92056245fb179790dc97ed040361f16bfd"}, | ||||||
|  |     {file = "Pillow-9.4.0-pp38-pypy38_pp73-manylinux_2_28_x86_64.whl", hash = "sha256:db74f5562c09953b2c5f8ec4b7dfd3f5421f31811e97d1dbc0a7c93d6e3a24df"}, | ||||||
|  |     {file = "Pillow-9.4.0-pp38-pypy38_pp73-win_amd64.whl", hash = "sha256:e9d7747847c53a16a729b6ee5e737cf170f7a16611c143d95aa60a109a59c336"}, | ||||||
|  |     {file = "Pillow-9.4.0-pp39-pypy39_pp73-macosx_10_10_x86_64.whl", hash = "sha256:b52ff4f4e002f828ea6483faf4c4e8deea8d743cf801b74910243c58acc6eda3"}, | ||||||
|  |     {file = "Pillow-9.4.0-pp39-pypy39_pp73-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:575d8912dca808edd9acd6f7795199332696d3469665ef26163cd090fa1f8bfa"}, | ||||||
|  |     {file = "Pillow-9.4.0-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:c3c4ed2ff6760e98d262e0cc9c9a7f7b8a9f61aa4d47c58835cdaf7b0b8811bb"}, | ||||||
|  |     {file = "Pillow-9.4.0-pp39-pypy39_pp73-manylinux_2_28_x86_64.whl", hash = "sha256:e621b0246192d3b9cb1dc62c78cfa4c6f6d2ddc0ec207d43c0dedecb914f152a"}, | ||||||
|  |     {file = "Pillow-9.4.0-pp39-pypy39_pp73-win_amd64.whl", hash = "sha256:8f127e7b028900421cad64f51f75c051b628db17fb00e099eb148761eed598c9"}, | ||||||
|  |     {file = "Pillow-9.4.0.tar.gz", hash = "sha256:a1c2d7780448eb93fbcc3789bf3916aa5720d942e37945f4056680317f1cd23e"}, | ||||||
| ] | ] | ||||||
|  |  | ||||||
| [[package]] | [[package]] | ||||||
| name = "platformdirs" | name = "platformdirs" | ||||||
| version = "4.0.0" | version = "3.11.0" | ||||||
| description = "A small Python package for determining appropriate platform-specific dirs, e.g. a \"user data dir\"." | description = "A small Python package for determining appropriate platform-specific dirs, e.g. a \"user data dir\"." | ||||||
| category = "dev" |  | ||||||
| optional = false | optional = false | ||||||
| python-versions = ">=3.7" | python-versions = ">=3.7" | ||||||
| files = [ | files = [ | ||||||
|     {file = "platformdirs-4.0.0-py3-none-any.whl", hash = "sha256:118c954d7e949b35437270383a3f2531e99dd93cf7ce4dc8340d3356d30f173b"}, |     {file = "platformdirs-3.11.0-py3-none-any.whl", hash = "sha256:e9d171d00af68be50e9202731309c4e658fd8bc76f55c11c7dd760d023bda68e"}, | ||||||
|     {file = "platformdirs-4.0.0.tar.gz", hash = "sha256:cb633b2bcf10c51af60beb0ab06d2f1d69064b43abf4c185ca6b28865f3f9731"}, |     {file = "platformdirs-3.11.0.tar.gz", hash = "sha256:cf8ee52a3afdb965072dcc652433e0c7e3e40cf5ea1477cd4b3b1d2eb75495b3"}, | ||||||
| ] | ] | ||||||
|  |  | ||||||
| [package.extras] | [package.extras] | ||||||
| @ -472,7 +618,6 @@ test = ["appdirs (==1.4.4)", "covdefaults (>=2.3)", "pytest (>=7.4)", "pytest-co | |||||||
| name = "pluggy" | name = "pluggy" | ||||||
| version = "1.3.0" | version = "1.3.0" | ||||||
| description = "plugin and hook calling mechanisms for python" | description = "plugin and hook calling mechanisms for python" | ||||||
| category = "dev" |  | ||||||
| optional = false | optional = false | ||||||
| python-versions = ">=3.8" | python-versions = ">=3.8" | ||||||
| files = [ | files = [ | ||||||
| @ -488,7 +633,6 @@ testing = ["pytest", "pytest-benchmark"] | |||||||
| name = "pytest" | name = "pytest" | ||||||
| version = "7.4.3" | version = "7.4.3" | ||||||
| description = "pytest: simple powerful testing with Python" | description = "pytest: simple powerful testing with Python" | ||||||
| category = "dev" |  | ||||||
| optional = false | optional = false | ||||||
| python-versions = ">=3.7" | python-versions = ">=3.7" | ||||||
| files = [ | files = [ | ||||||
| @ -503,13 +647,12 @@ packaging = "*" | |||||||
| pluggy = ">=0.12,<2.0" | pluggy = ">=0.12,<2.0" | ||||||
|  |  | ||||||
| [package.extras] | [package.extras] | ||||||
| testing = ["argcomplete", "attrs (>=19.2.0)", "hypothesis (>=3.56)", "mock", "nose", "pygments (>=2.7.2)", "requests", "setuptools", "xmlschema"] | testing = ["argcomplete", "hypothesis (>=3.56)", "mock", "nose", "pygments (>=2.7.2)", "requests", "xmlschema"] | ||||||
|  |  | ||||||
| [[package]] | [[package]] | ||||||
| name = "pyyaml" | name = "pyyaml" | ||||||
| version = "6.0.1" | version = "6.0.1" | ||||||
| description = "YAML parser and emitter for Python" | description = "YAML parser and emitter for Python" | ||||||
| category = "dev" |  | ||||||
| optional = false | optional = false | ||||||
| python-versions = ">=3.6" | python-versions = ">=3.6" | ||||||
| files = [ | files = [ | ||||||
| @ -569,7 +712,6 @@ files = [ | |||||||
| name = "regex" | name = "regex" | ||||||
| version = "2023.10.3" | version = "2023.10.3" | ||||||
| description = "Alternative regular expression module, to replace re." | description = "Alternative regular expression module, to replace re." | ||||||
| category = "dev" |  | ||||||
| optional = false | optional = false | ||||||
| python-versions = ">=3.7" | python-versions = ">=3.7" | ||||||
| files = [ | files = [ | ||||||
| @ -667,7 +809,6 @@ files = [ | |||||||
| name = "setuptools" | name = "setuptools" | ||||||
| version = "68.2.2" | version = "68.2.2" | ||||||
| description = "Easily download, build, install, upgrade, and uninstall Python packages" | description = "Easily download, build, install, upgrade, and uninstall Python packages" | ||||||
| category = "main" |  | ||||||
| optional = false | optional = false | ||||||
| python-versions = ">=3.8" | python-versions = ">=3.8" | ||||||
| files = [ | files = [ | ||||||
| @ -696,7 +837,6 @@ files = [ | |||||||
| name = "sqlparse" | name = "sqlparse" | ||||||
| version = "0.4.4" | version = "0.4.4" | ||||||
| description = "A non-validating SQL parser." | description = "A non-validating SQL parser." | ||||||
| category = "main" |  | ||||||
| optional = false | optional = false | ||||||
| python-versions = ">=3.5" | python-versions = ">=3.5" | ||||||
| files = [ | files = [ | ||||||
| @ -713,7 +853,6 @@ test = ["pytest", "pytest-cov"] | |||||||
| name = "tqdm" | name = "tqdm" | ||||||
| version = "4.66.1" | version = "4.66.1" | ||||||
| description = "Fast, Extensible Progress Meter" | description = "Fast, Extensible Progress Meter" | ||||||
| category = "dev" |  | ||||||
| optional = false | optional = false | ||||||
| python-versions = ">=3.7" | python-versions = ">=3.7" | ||||||
| files = [ | files = [ | ||||||
| @ -734,7 +873,6 @@ telegram = ["requests"] | |||||||
| name = "typing-extensions" | name = "typing-extensions" | ||||||
| version = "4.8.0" | version = "4.8.0" | ||||||
| description = "Backported and Experimental Type Hints for Python 3.8+" | description = "Backported and Experimental Type Hints for Python 3.8+" | ||||||
| category = "dev" |  | ||||||
| optional = false | optional = false | ||||||
| python-versions = ">=3.8" | python-versions = ">=3.8" | ||||||
| files = [ | files = [ | ||||||
| @ -746,7 +884,6 @@ files = [ | |||||||
| name = "tzdata" | name = "tzdata" | ||||||
| version = "2023.3" | version = "2023.3" | ||||||
| description = "Provider of IANA time zone data" | description = "Provider of IANA time zone data" | ||||||
| category = "main" |  | ||||||
| optional = false | optional = false | ||||||
| python-versions = ">=2" | python-versions = ">=2" | ||||||
| files = [ | files = [ | ||||||
| @ -758,7 +895,6 @@ files = [ | |||||||
| name = "uvicorn" | name = "uvicorn" | ||||||
| version = "0.20.0" | version = "0.20.0" | ||||||
| description = "The lightning-fast ASGI server." | description = "The lightning-fast ASGI server." | ||||||
| category = "main" |  | ||||||
| optional = false | optional = false | ||||||
| python-versions = ">=3.7" | python-versions = ">=3.7" | ||||||
| files = [ | files = [ | ||||||
| @ -773,11 +909,30 @@ h11 = ">=0.8" | |||||||
| [package.extras] | [package.extras] | ||||||
| standard = ["colorama (>=0.4)", "httptools (>=0.5.0)", "python-dotenv (>=0.13)", "pyyaml (>=5.1)", "uvloop (>=0.14.0,!=0.15.0,!=0.15.1)", "watchfiles (>=0.13)", "websockets (>=10.4)"] | standard = ["colorama (>=0.4)", "httptools (>=0.5.0)", "python-dotenv (>=0.13)", "pyyaml (>=5.1)", "uvloop (>=0.14.0,!=0.15.0,!=0.15.1)", "watchfiles (>=0.13)", "websockets (>=10.4)"] | ||||||
|  |  | ||||||
|  | [[package]] | ||||||
|  | name = "virtualenv" | ||||||
|  | version = "20.24.6" | ||||||
|  | description = "Virtual Python Environment builder" | ||||||
|  | optional = false | ||||||
|  | python-versions = ">=3.7" | ||||||
|  | files = [ | ||||||
|  |     {file = "virtualenv-20.24.6-py3-none-any.whl", hash = "sha256:520d056652454c5098a00c0f073611ccbea4c79089331f60bf9d7ba247bb7381"}, | ||||||
|  |     {file = "virtualenv-20.24.6.tar.gz", hash = "sha256:02ece4f56fbf939dbbc33c0715159951d6bf14aaf5457b092e4548e1382455af"}, | ||||||
|  | ] | ||||||
|  |  | ||||||
|  | [package.dependencies] | ||||||
|  | distlib = ">=0.3.7,<1" | ||||||
|  | filelock = ">=3.12.2,<4" | ||||||
|  | platformdirs = ">=3.9.1,<4" | ||||||
|  |  | ||||||
|  | [package.extras] | ||||||
|  | docs = ["furo (>=2023.7.26)", "proselint (>=0.13)", "sphinx (>=7.1.2)", "sphinx-argparse (>=0.4)", "sphinxcontrib-towncrier (>=0.2.1a0)", "towncrier (>=23.6)"] | ||||||
|  | test = ["covdefaults (>=2.3)", "coverage (>=7.2.7)", "coverage-enable-subprocess (>=1)", "flaky (>=3.7)", "packaging (>=23.1)", "pytest (>=7.4)", "pytest-env (>=0.8.2)", "pytest-freezer (>=0.4.8)", "pytest-mock (>=3.11.1)", "pytest-randomly (>=3.12)", "pytest-timeout (>=2.1)", "setuptools (>=68)", "time-machine (>=2.10)"] | ||||||
|  |  | ||||||
| [[package]] | [[package]] | ||||||
| name = "werkzeug" | name = "werkzeug" | ||||||
| version = "2.3.8" | version = "2.3.8" | ||||||
| description = "The comprehensive WSGI web application library." | description = "The comprehensive WSGI web application library." | ||||||
| category = "dev" |  | ||||||
| optional = false | optional = false | ||||||
| python-versions = ">=3.8" | python-versions = ">=3.8" | ||||||
| files = [ | files = [ | ||||||
| @ -793,5 +948,5 @@ watchdog = ["watchdog (>=2.3)"] | |||||||
|  |  | ||||||
| [metadata] | [metadata] | ||||||
| lock-version = "2.0" | lock-version = "2.0" | ||||||
| python-versions = "^3.11" | python-versions = "^3.10" | ||||||
| content-hash = "c82d09d48e81655bd981938540184878d986253d41858277180d3a48244fd069" | content-hash = "7a7ba3831802cf91b722b956817a0606b7b8f97724b1a23e5e581657fb34ea19" | ||||||
|  | |||||||
| @ -12,6 +12,10 @@ python = "^3.12" | |||||||
| django = "^4.2.0" | django = "^4.2.0" | ||||||
| gunicorn = "^20.1.0" | gunicorn = "^20.1.0" | ||||||
| uvicorn = "^0.20.0" | uvicorn = "^0.20.0" | ||||||
|  | pandas = "^1.5.2" | ||||||
|  | matplotlib = "^3.6.3" | ||||||
|  | django-rest-framework = "^0.1.0" | ||||||
|  | django-cors-headers = "^3.13.0" | ||||||
|  |  | ||||||
| [tool.poetry.group.dev.dependencies] | [tool.poetry.group.dev.dependencies] | ||||||
| black = "^22.12.0" | black = "^22.12.0" | ||||||
| @ -23,6 +27,10 @@ werkzeug = "^2.2.2" | |||||||
| djhtml = "^1.5.2" | djhtml = "^1.5.2" | ||||||
| djlint = "^1.19.11" | djlint = "^1.19.11" | ||||||
| isort = "^5.11.4" | isort = "^5.11.4" | ||||||
|  | pre-commit = "^3.5.0" | ||||||
|  |  | ||||||
|  | [tool.isort] | ||||||
|  | profile = "black" | ||||||
|  |  | ||||||
| [build-system] | [build-system] | ||||||
| requires = ["poetry-core"] | requires = ["poetry-core"] | ||||||
|  | |||||||
| @ -1,19 +0,0 @@ | |||||||
| const defaultTheme = require('tailwindcss/defaultTheme') |  | ||||||
|  |  | ||||||
| module.exports = { |  | ||||||
|     darkMode: 'class', |  | ||||||
|     content: ["./games/**/*.{html,js}"], |  | ||||||
|     theme: { |  | ||||||
|         extend: { |  | ||||||
|           fontFamily: { |  | ||||||
|             'sans': ['IBM Plex Sans', ...defaultTheme.fontFamily.sans], |  | ||||||
|             'mono': ['IBM Plex Mono', ...defaultTheme.fontFamily.mono], |  | ||||||
|             'serif': ['IBM Plex Serif', ...defaultTheme.fontFamily.serif], |  | ||||||
|           } |  | ||||||
|         }, |  | ||||||
|     }, |  | ||||||
|     plugins: [ |  | ||||||
|         require('@tailwindcss/typography'), |  | ||||||
|         require('@tailwindcss/forms') |  | ||||||
|     ], |  | ||||||
| } |  | ||||||
| @ -12,6 +12,7 @@ https://docs.djangoproject.com/en/4.1/ref/settings/ | |||||||
|  |  | ||||||
| import os | import os | ||||||
| from pathlib import Path | from pathlib import Path | ||||||
|  | from corsheaders.defaults import default_headers, default_methods | ||||||
|  |  | ||||||
| # Build paths inside the project like this: BASE_DIR / 'subdir'. | # Build paths inside the project like this: BASE_DIR / 'subdir'. | ||||||
| BASE_DIR = Path(__file__).resolve().parent.parent | BASE_DIR = Path(__file__).resolve().parent.parent | ||||||
| @ -38,6 +39,8 @@ INSTALLED_APPS = [ | |||||||
|     "django.contrib.sessions", |     "django.contrib.sessions", | ||||||
|     "django.contrib.messages", |     "django.contrib.messages", | ||||||
|     "django.contrib.staticfiles", |     "django.contrib.staticfiles", | ||||||
|  |     "rest_framework", | ||||||
|  |     "corsheaders", | ||||||
| ] | ] | ||||||
|  |  | ||||||
| if DEBUG: | if DEBUG: | ||||||
| @ -45,6 +48,7 @@ if DEBUG: | |||||||
|     INSTALLED_APPS.append("django.contrib.admin") |     INSTALLED_APPS.append("django.contrib.admin") | ||||||
|  |  | ||||||
| MIDDLEWARE = [ | MIDDLEWARE = [ | ||||||
|  |     "corsheaders.middleware.CorsMiddleware", | ||||||
|     "django.middleware.security.SecurityMiddleware", |     "django.middleware.security.SecurityMiddleware", | ||||||
|     "django.contrib.sessions.middleware.SessionMiddleware", |     "django.contrib.sessions.middleware.SessionMiddleware", | ||||||
|     "django.middleware.common.CommonMiddleware", |     "django.middleware.common.CommonMiddleware", | ||||||
| @ -150,3 +154,24 @@ if _csrf_trusted_origins: | |||||||
|     CSRF_TRUSTED_ORIGINS = _csrf_trusted_origins.split(",") |     CSRF_TRUSTED_ORIGINS = _csrf_trusted_origins.split(",") | ||||||
| else: | else: | ||||||
|     CSRF_TRUSTED_ORIGINS = [] |     CSRF_TRUSTED_ORIGINS = [] | ||||||
|  |  | ||||||
|  | REST_FRAMEWORK = { | ||||||
|  |     "DEFAULT_PERMISSION_CLASSES": [ | ||||||
|  |         "rest_framework.permissions.DjangoModelPermissionsOrAnonReadOnly" | ||||||
|  |     ] | ||||||
|  | } | ||||||
|  |  | ||||||
|  | FRONTEND_ROOT = os.path.abspath(os.path.join(BASE_DIR, "..", "frontend", "dist")) | ||||||
|  | CORS_ORIGIN_ALLOW_ALL = True | ||||||
|  | CORS_ALLOW_CREDENTIALS = True | ||||||
|  |  | ||||||
|  | CORS_ALLOW_HEADERS = list(default_headers) + [ | ||||||
|  |     "Accept-Language", | ||||||
|  |     "Connection", | ||||||
|  |     "Host", | ||||||
|  |     "Origin", | ||||||
|  |     "Referer", | ||||||
|  |     "Sec-Fetch-Dest", | ||||||
|  |     "Sec-Fetch-Mode", | ||||||
|  |     "Sec-Fetch-Site", | ||||||
|  | ] | ||||||
|  | |||||||
| @ -17,10 +17,64 @@ from django.conf import settings | |||||||
| from django.contrib import admin | from django.contrib import admin | ||||||
| from django.urls import include, path | from django.urls import include, path | ||||||
| from django.views.generic import RedirectView | from django.views.generic import RedirectView | ||||||
|  | from rest_framework import routers, serializers, viewsets | ||||||
|  | from games.models import Game, Purchase, Platform, Session | ||||||
|  |  | ||||||
|  |  | ||||||
|  | class GameSerializer(serializers.HyperlinkedModelSerializer): | ||||||
|  |     class Meta: | ||||||
|  |         model = Game | ||||||
|  |         fields = "__all__" | ||||||
|  |  | ||||||
|  |  | ||||||
|  | class PlatformSerializer(serializers.HyperlinkedModelSerializer): | ||||||
|  |     class Meta: | ||||||
|  |         model = Platform | ||||||
|  |         fields = "__all__" | ||||||
|  |  | ||||||
|  |  | ||||||
|  | class PurchaseSerializer(serializers.HyperlinkedModelSerializer): | ||||||
|  |     class Meta: | ||||||
|  |         model = Purchase | ||||||
|  |         fields = "__all__" | ||||||
|  |  | ||||||
|  |  | ||||||
|  | class SessionSerializer(serializers.HyperlinkedModelSerializer): | ||||||
|  |     class Meta: | ||||||
|  |         model = Session | ||||||
|  |         fields = "__all__" | ||||||
|  |  | ||||||
|  |  | ||||||
|  | class GameViewSet(viewsets.ModelViewSet): | ||||||
|  |     queryset = Game.objects.all() | ||||||
|  |     serializer_class = GameSerializer | ||||||
|  |  | ||||||
|  |  | ||||||
|  | class PlatformViewSet(viewsets.ModelViewSet): | ||||||
|  |     queryset = Platform.objects.all() | ||||||
|  |     serializer_class = PlatformSerializer | ||||||
|  |  | ||||||
|  |  | ||||||
|  | class PurchaseViewSet(viewsets.ModelViewSet): | ||||||
|  |     queryset = Purchase.objects.all() | ||||||
|  |     serializer_class = PurchaseSerializer | ||||||
|  |  | ||||||
|  |  | ||||||
|  | class SessionViewSet(viewsets.ModelViewSet): | ||||||
|  |     queryset = Session.objects.all() | ||||||
|  |     serializer_class = SessionSerializer | ||||||
|  |  | ||||||
|  |  | ||||||
|  | router = routers.DefaultRouter() | ||||||
|  | router.register(r"games", GameViewSet) | ||||||
|  | router.register(r"platforms", PlatformViewSet) | ||||||
|  | router.register(r"purchases", PurchaseViewSet) | ||||||
|  | router.register(r"sessions", SessionViewSet) | ||||||
|  |  | ||||||
|  |  | ||||||
| urlpatterns = [ | urlpatterns = [ | ||||||
|     path("", RedirectView.as_view(url="/tracker")), |     path("api/", include(router.urls)), | ||||||
|     path("tracker/", include("games.urls")), |     path("api-auth/", include("rest_framework.urls", namespace="rest_framework")), | ||||||
| ] | ] | ||||||
|  |  | ||||||
| if settings.DEBUG: | if settings.DEBUG: | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user