Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Aggrid #74

Merged
merged 17 commits into from
Nov 6, 2023
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docker-compose.yml
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

run pre-commit install pls

Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ services:
hostname: parkour2-django
build:
dockerfile: ./Dockerfile
target: pk2_base
target: pk2_dev
env_file:
- ./misc/parkour.env
restart: always
Expand Down
2 changes: 1 addition & 1 deletion misc/parkour.env
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ [email protected]
EMAIL_HOST=mail.server.tld
EMAIL_SUBJECT_PREFIX=[Parkour]
[email protected]
CSRF_TRUSTED_ORIGINS=http://127.0.0.1,https://*.server.tld
CSRF_TRUSTED_ORIGINS=http://127.0.0.1,https://*.server.tld,http://localhost:5173
POSTGRES_USER=postgres
POSTGRES_DB=postgres
POSTGRES_PASSWORD=change_me__stay_safe
Expand Down
19 changes: 17 additions & 2 deletions parkour_app/common/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from django.http import Http404, HttpResponse, JsonResponse
from django.shortcuts import get_object_or_404, render
from request.models import Request
from django.utils import timezone
from rest_framework import status, viewsets
from rest_framework.authentication import SessionAuthentication
from rest_framework.decorators import action
Expand Down Expand Up @@ -209,8 +210,22 @@ def responsibles(self, request, *args, **kwargs):
)
return Response(serializer.data, status=status.HTTP_200_OK)

def get(self, request, *args, **kwargs):
serializer = DutySerializer(self.queryset, many=True)
def list(self, request, *args, **kwargs):
today_var = timezone.now()
start_date_var = request.query_params.get('start_date')
end_date_var = request.query_params.get('end_date')
ongoing_var = request.query_params.get('ongoing')
upcoming_var = request.query_params.get('upcoming')
queryset_var = self.queryset.filter()

if str(ongoing_var).lower() in ["true", 't', 'yes','y', '1']:
queryset_var = self.queryset.filter(Q(start_date__lte=today_var, end_date__gte=today_var) | Q(start_date__lte=today_var, end_date__isnull=True))
elif str(upcoming_var).lower() in ["true", 't', 'yes','y', '1']:
queryset_var = self.queryset.filter(start_date__gte=today_var)
elif start_date_var and end_date_var:
queryset_var = self.queryset.filter(Q(start_date__gte=start_date_var, start_date__lte=end_date_var)| Q(start_date__gte=start_date_var, end_date__isnull=True))

serializer = DutySerializer(queryset_var, many=True)
return Response(serializer.data, status=status.HTTP_200_OK)

def post(self, request, *args, **kwargs):
Expand Down
59 changes: 59 additions & 0 deletions parkour_app/duties/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
.pnpm-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional stylelint cache
.stylelintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Dotenv environment variable files
.env
.env.development.local
.env.test.local
.env.production.local
.env.local

# Yarn Integrity file
.yarn-integrity

# Yarn v2
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*
12 changes: 12 additions & 0 deletions parkour_app/duties/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Duties</title>
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/main.js"></script>
</body>
</html>
Loading