Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
AlekSIS-App-Paweljong
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Teckids
Projekt Hack-n-Fun
AlekSIS-App-Paweljong
Commits
18e38fa8
Verified
Commit
18e38fa8
authored
2 years ago
by
Nik | Klampfradler
Browse files
Options
Downloads
Patches
Plain Diff
Implement view to save checkpoint
parent
f9ff735f
No related branches found
No related tags found
1 merge request
!30
Resolve "Checkpoint system"
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
aleksis/apps/paweljong/views.py
+19
-3
19 additions, 3 deletions
aleksis/apps/paweljong/views.py
with
19 additions
and
3 deletions
aleksis/apps/paweljong/views.py
+
19
−
3
View file @
18e38fa8
...
...
@@ -5,7 +5,7 @@ from django.contrib.auth import get_user_model
from
django.contrib.syndication.views
import
Feed
from
django.core.exceptions
import
ValidationError
from
django.http
import
HttpRequest
,
HttpResponse
from
django.shortcuts
import
redirect
,
render
from
django.shortcuts
import
get_object_or_404
,
redirect
,
render
from
django.urls
import
reverse
,
reverse_lazy
from
django.utils
import
timezone
from
django.utils.decorators
import
method_decorator
...
...
@@ -41,7 +41,7 @@ from .forms import (
RegistrationNotificationForm
,
RegistrationStatesForm
,
)
from
.models
import
Event
,
EventRegistration
,
InfoMailing
,
RegistrationState
,
Terms
,
Voucher
from
.models
import
Checkpoint
,
Event
,
EventRegistration
,
InfoMailing
,
RegistrationState
,
Terms
,
Voucher
from
.tables
import
(
AdditionalFieldsTable
,
ChildGroupsTable
,
...
...
@@ -973,7 +973,23 @@ class EventCheckpointView(PermissionRequiredMixin, FormView):
form_class
=
EventCheckpointForm
def
form_valid
(
self
,
form
):
event
=
Event
.
objects
.
get
(
id
=
self
.
kwargs
[
"
slug
"
])
checkpoint
=
Checkpoint
()
checkpoint
.
event
=
get_object_or_404
(
Event
,
slug
=
self
.
kwargs
[
"
slug
"
])
try
:
checkpoint
.
person
=
Person
.
objects
.
get
(
user__username
=
form
.
cleaned_data
[
"
username
"
])
except
Person
.
DoesNotExist
:
messages
.
error
(
self
.
request
,
_
(
"
The provided username is not linked to a person.
"
))
checkpoint
.
comment
=
form
.
cleaned_data
[
"
comment
"
]
checkpoint
.
timestamp
=
timezone
.
now
()
if
"
lat
"
in
form
.
cleaned_data
and
"
lon
"
in
form
.
cleaned_data
:
checkpoint
.
lat
=
form
.
cleaned_data
[
"
lat
"
]
checkpoint
.
lon
=
form
.
cleaned_data
[
"
lon
"
]
checkpoint
.
save
()
messages
.
success
(
self
.
request
,
_
(
"
Person successfully checked.
"
))
return
super
().
form_valid
(
self
)
def
get_success_url
(
self
):
return
reverse
(
"
event_by_name_checkpoint
"
,
kwargs
=
{
"
slug
"
:
self
.
kwargs
[
"
slug
"
]})
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment