Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
AlekSIS-App-Tezor
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
AlekSIS®
Onboarding
AlekSIS-App-Tezor
Commits
9449393b
Commit
9449393b
authored
2 years ago
by
Nik | Klampfradler
Committed by
Tom Teichler
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Make get_variant_choices callable on the whole dependency chain
parent
60056904
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!15
Update dependency django-payments to v1
Pipeline
#60605
failed
2 years ago
Stage: prepare
Stage: test
Stage: build
Stage: publish
Stage: docker
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
aleksis/apps/tezor/models/base.py
+14
-0
14 additions, 0 deletions
aleksis/apps/tezor/models/base.py
aleksis/apps/tezor/models/invoice.py
+12
-19
12 additions, 19 deletions
aleksis/apps/tezor/models/invoice.py
with
26 additions
and
19 deletions
aleksis/apps/tezor/models/base.py
+
14
−
0
View file @
9449393b
...
...
@@ -10,6 +10,12 @@ from aleksis.core.mixins import ExtensibleModel
class
Client
(
ExtensibleModel
):
VARIANT_DISPLAY
=
{
"
paypal
"
:
(
_
(
"
PayPal
"
),
"
logos:paypal
"
),
"
sofort
"
:
(
_
(
"
Klarna / Sofort
"
),
"
simple-icons:klarna
"
),
"
pledge
"
:
(
_
(
"
Payment pledge / manual payment
"
),
"
mdi:hand-coin
"
),
"
sdd
"
:
(
_
(
"
SEPA Direct Debit
"
),
"
mdi:bank-transfer
"
),
}
name
=
models
.
CharField
(
verbose_name
=
_
(
"
Name
"
),
max_length
=
255
)
email
=
models
.
EmailField
(
verbose_name
=
_
(
"
Email
"
))
...
...
@@ -69,3 +75,11 @@ class Client(ExtensibleModel):
def
__str__
(
self
)
->
str
:
return
self
.
name
def
get_variant_choices
(
self
=
None
):
choices
=
[]
for
variant
in
Client
.
VARIANT_DISPLAY
.
keys
():
if
self
and
not
getattr
(
self
,
f
"
{
variant
}
_enabled
"
):
continue
choices
.
append
((
variant
,
Client
.
VARIANT_DISPLAY
[
variant
][
0
]))
return
choices
This diff is collapsed.
Click to expand it.
aleksis/apps/tezor/models/invoice.py
+
12
−
19
View file @
9449393b
...
...
@@ -32,6 +32,12 @@ class InvoiceGroup(ExtensibleModel):
def
__str__
(
self
)
->
str
:
return
self
.
name
def
get_variant_choices
(
self
=
None
):
if
self
and
self
.
client
:
return
self
.
client
.
get_variant_choices
()
else
:
return
Client
.
get_variant_choices
()
class
Meta
:
constraints
=
[
models
.
UniqueConstraint
(
fields
=
[
"
client
"
,
"
name
"
],
name
=
"
group_uniq_per_client
"
)
...
...
@@ -39,12 +45,6 @@ class InvoiceGroup(ExtensibleModel):
class
Invoice
(
BasePayment
,
PureDjangoModel
):
VARIANT_DISPLAY
=
{
"
paypal
"
:
(
_
(
"
PayPal
"
),
"
logos:paypal
"
),
"
sofort
"
:
(
_
(
"
Klarna / Sofort
"
),
"
simple-icons:klarna
"
),
"
pledge
"
:
(
_
(
"
Payment pledge / manual payment
"
),
"
mdi:hand-coin
"
),
"
sdd
"
:
(
_
(
"
SEPA Direct Debit
"
),
"
mdi:bank-transfer
"
),
}
STATUS_ICONS
=
{
PaymentStatus
.
WAITING
:
"
mdi:cash-lock-open
"
,
PaymentStatus
.
INPUT
:
"
mdi:cash-lock-open
"
,
...
...
@@ -105,23 +105,16 @@ class Invoice(BasePayment, PureDjangoModel):
super
().
save
(
*
args
,
**
kwargs
)
def
get_variant_choices
(
self
=
None
):
choices
=
[]
for
variant
in
Invoice
.
VARIANT_DISPLAY
.
keys
():
if
(
self
and
self
.
group
and
self
.
group
.
client
and
not
getattr
(
self
.
group
.
client
,
f
"
{
variant
}
_enabled
"
)
):
continue
choices
.
append
((
variant
,
Invoice
.
VARIANT_DISPLAY
[
variant
][
0
]))
return
choices
if
self
and
self
.
group
:
return
self
.
group
.
get_variant_choices
()
else
:
return
InvoiceGroup
.
get_variant_choices
()
def
get_variant_name
(
self
):
return
self
.
__class__
.
VARIANT_DISPLAY
[
self
.
variant
][
0
]
return
Client
.
VARIANT_DISPLAY
[
self
.
variant
][
0
]
def
get_variant_icon
(
self
):
return
self
.
__class__
.
VARIANT_DISPLAY
[
self
.
variant
][
1
]
return
Client
.
VARIANT_DISPLAY
[
self
.
variant
][
1
]
def
get_status_icon
(
self
):
return
self
.
__class__
.
STATUS_ICONS
[
self
.
status
]
...
...
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