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
561a676c
Commit
561a676c
authored
7 months ago
by
Hangzhi Yu
Browse files
Options
Downloads
Patches
Plain Diff
Fix migrations
parent
338ef0d9
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!54
Resolve "Remove additional fields support and re-implement additional fields in paweljong"
Pipeline
#192043
failed
7 months ago
Stage: prepare
Stage: test
Stage: build
Stage: publish
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
aleksis/apps/paweljong/migrations/0018_payment_with_tezor.py
+19
-2
19 additions, 2 deletions
aleksis/apps/paweljong/migrations/0018_payment_with_tezor.py
with
19 additions
and
2 deletions
aleksis/apps/paweljong/migrations/0018_payment_with_tezor.py
+
19
−
2
View file @
561a676c
...
...
@@ -4,11 +4,28 @@ from django.db import migrations, models
from
payments
import
PaymentStatus
def
move_additional_field
s
(
apps
,
schema_editor
):
def
create_invoice
s
(
apps
,
schema_editor
):
Person
=
apps
.
get_model
(
"
core
"
,
"
Person
"
)
EventRegistration
=
apps
.
get_model
(
"
paweljong
"
,
"
EventRegistration
"
)
SEPAMandate
=
apps
.
get_model
(
"
djp_sepa
"
,
"
SEPAMandate
"
)
from
aleksis.apps.paweljong.models
import
EventRegistration
as
RealEventRegistration
EventRegistration
.
get_invoice
=
RealEventRegistration
.
get_invoice
EventRegistration
.
_get_total_amount
=
RealEventRegistration
.
_get_total_amount
EventRegistration
.
get_purchased_items
=
RealEventRegistration
.
get_purchased_items
Person
.
addressing_name
=
property
(
lambda
p
:
p
.
first_name
+
"
"
+
p
.
last_name
)
for
registration
in
EventRegistration
.
_base_manager
.
all
():
invoice
=
registration
.
get_invoice
()
invoice
.
status
=
PaymentStatus
.
PREAUTH
if
registration
.
accept_sepa
:
invoice
.
variant
=
"
sdd
"
SEPAMandate
.
objects
.
create
(
payment_id
=
invoice
.
pk
,
account_holder
=
f
"
{
registration
.
person
.
addressing_name
}
"
,
iban
=
registration
.
iban
,
bic
=
"
XXXXXXXXXXX
"
,
date
=
registration
.
date_registered
)
else
:
invoice
.
variant
=
"
pledge
"
invoice
.
save
()
class
Migration
(
migrations
.
Migration
):
...
...
@@ -18,7 +35,7 @@ class Migration(migrations.Migration):
]
operations
=
[
migrations
.
RunPython
(
move_additional_field
s
),
migrations
.
RunPython
(
create_invoice
s
),
migrations
.
RemoveField
(
model_name
=
'
eventregistration
'
,
name
=
'
accept_sepa
'
,
...
...
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