Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
Projekt+Hack-n-Fun
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
9sorneWpersma
Projekt+Hack-n-Fun
Commits
89b61d27
Commit
89b61d27
authored
2 years ago
by
Tom Teichler
Browse files
Options
Downloads
Patches
Plain Diff
Add basic backend code
parent
fedcb0f9
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
aleksis/apps/paweljong/models.py
+21
-0
21 additions, 0 deletions
aleksis/apps/paweljong/models.py
aleksis/apps/paweljong/urls.py
+5
-0
5 additions, 0 deletions
aleksis/apps/paweljong/urls.py
aleksis/apps/paweljong/views.py
+7
-0
7 additions, 0 deletions
aleksis/apps/paweljong/views.py
with
33 additions
and
0 deletions
aleksis/apps/paweljong/models.py
+
21
−
0
View file @
89b61d27
...
...
@@ -2,6 +2,7 @@ from datetime import datetime
from
decimal
import
Decimal
from
django.contrib.contenttypes.models
import
ContentType
from
django.core.exceptions
import
ValidationError
from
django.db
import
models
from
django.urls
import
reverse
from
django.utils.text
import
slugify
...
...
@@ -280,6 +281,26 @@ class EventRegistration(ExtensibleModel):
RegistrationState
,
verbose_name
=
_
(
"
States
"
),
related_name
=
"
registrations
"
)
retracted
=
models
.
BooleanField
(
verbose_name
=
_
(
"
Retracted
"
),
default
=
False
)
@property
def
retractable
(
self
):
return
datetime
.
today
()
<
self
.
event
.
date_retraction
def
retract
(
self
):
if
self
.
retractable
:
# Remove person from group
self
.
linked_group
.
members
.
remove
(
self
.
person
)
# Invoice
inv
=
self
.
get_invoice
()
inv
.
for_object
=
None
inv
.
for_object_class
=
None
inv
.
save
()
self
.
retraced
=
True
self
.
save
()
else
:
return
ValidationError
(
_
(
"
Registration is not retractable!
"
))
def
get_person
(
self
):
return
self
.
person
...
...
This diff is collapsed.
Click to expand it.
aleksis/apps/paweljong/urls.py
+
5
−
0
View file @
89b61d27
...
...
@@ -72,6 +72,11 @@ urlpatterns = [
path
(
"
vouchers/
"
,
views
.
vouchers
,
name
=
"
vouchers
"
),
path
(
"
event/lists/generate
"
,
views
.
generate_lists
,
name
=
"
generate_lists
"
),
path
(
"
event/registrations/list
"
,
views
.
registrations
,
name
=
"
registrations
"
),
path
(
"
event/registrations/<int:pk>/retract
"
,
views
.
registrations
,
name
=
"
retract_registration_by_id
"
,
),
path
(
"
event/registrations/<int:pk>
"
,
views
.
EventRegistrationDetailView
.
as_view
(),
...
...
This diff is collapsed.
Click to expand it.
aleksis/apps/paweljong/views.py
+
7
−
0
View file @
89b61d27
...
...
@@ -899,3 +899,10 @@ class RegistrationStateEditView(PermissionRequiredMixin, AdvancedEditView):
template_name
=
"
paweljong/registration_state/edit.html
"
success_url
=
reverse_lazy
(
"
registration_states
"
)
success_message
=
_
(
"
The term has been saved.
"
)
class
RetractRegistration
(
View
):
def
get
(
self
):
registration
=
EventRegistration
.
objects
.
get
(
id
=
self
.
kwargs
[
"
pk
"
])
registration
.
retract
()
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