Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
nk20
Manage
Activity
Members
Labels
Plan
Issues
32
Issue boards
Milestones
Wiki
Code
Merge requests
5
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
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
BDE
nk20
Commits
126686ab
Commit
126686ab
authored
5 years ago
by
Pierre-antoine Comby
Browse files
Options
Downloads
Patches
Plain Diff
add a TransactionType model
parent
f3ec0836
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!19
Import nk15
Pipeline
#7781
passed with warnings with stages
in 3 minutes and 50 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
apps/note/admin.py
+9
-1
9 additions, 1 deletion
apps/note/admin.py
apps/note/models/__init__.py
+2
-2
2 additions, 2 deletions
apps/note/models/__init__.py
apps/note/models/transactions.py
+23
-1
23 additions, 1 deletion
apps/note/models/transactions.py
with
34 additions
and
4 deletions
apps/note/admin.py
+
9
−
1
View file @
126686ab
...
...
@@ -7,7 +7,7 @@ from polymorphic.admin import PolymorphicChildModelAdmin, \
PolymorphicChildModelFilter
,
PolymorphicParentModelAdmin
from
.models.notes
import
Alias
,
Note
,
NoteClub
,
NoteSpecial
,
NoteUser
from
.models.transactions
import
Transaction
,
TransactionCategory
,
TransactionTemplate
from
.models.transactions
import
Transaction
,
TransactionCategory
,
TransactionTemplate
,
TransactionType
class
AliasInlines
(
admin
.
TabularInline
):
...
...
@@ -161,3 +161,11 @@ class TransactionCategoryAdmin(admin.ModelAdmin):
"""
list_display
=
(
'
name
'
,
)
list_filter
=
(
'
name
'
,
)
@admin.register
(
TransactionType
)
class
TransactionTypeAdmin
(
admin
.
ModelAdmin
):
"""
Admin customisation for TransactionTemplate
"""
list_display
=
(
'
name
'
,
)
list_filter
=
(
'
name
'
,
)
This diff is collapsed.
Click to expand it.
apps/note/models/__init__.py
+
2
−
2
View file @
126686ab
...
...
@@ -3,11 +3,11 @@
from
.notes
import
Alias
,
Note
,
NoteClub
,
NoteSpecial
,
NoteUser
from
.transactions
import
MembershipTransaction
,
Transaction
,
\
TransactionCategory
,
TransactionTemplate
TransactionCategory
,
TransactionTemplate
,
TransactionType
__all__
=
[
# Notes
'
Alias
'
,
'
Note
'
,
'
NoteClub
'
,
'
NoteSpecial
'
,
'
NoteUser
'
,
# Transactions
'
MembershipTransaction
'
,
'
Transaction
'
,
'
TransactionCategory
'
,
'
TransactionTemplate
'
,
'
MembershipTransaction
'
,
'
Transaction
'
,
'
TransactionCategory
'
,
'
TransactionTemplate
'
,
'
TransactionType
'
,
]
This diff is collapsed.
Click to expand it.
apps/note/models/transactions.py
+
23
−
1
View file @
126686ab
...
...
@@ -76,6 +76,26 @@ class TransactionTemplate(models.Model):
return
reverse
(
'
note:template_update
'
,
args
=
(
self
.
pk
,
))
class
TransactionType
(
models
.
Model
):
"""
Defined a recurrent transaction category
Example: food, softs, ...
"""
name
=
models
.
CharField
(
verbose_name
=
_
(
"
name
"
),
max_length
=
31
,
unique
=
True
,
)
class
Meta
:
verbose_name
=
_
(
"
transaction type
"
)
verbose_name_plural
=
_
(
"
transaction types
"
)
def
__str__
(
self
):
return
str
(
self
.
name
)
class
Transaction
(
models
.
Model
):
"""
General transaction between two :model:`note.Note`
...
...
@@ -107,7 +127,9 @@ class Transaction(models.Model):
default
=
1
,
)
amount
=
models
.
PositiveIntegerField
(
verbose_name
=
_
(
'
amount
'
),
)
transaction_type
=
models
.
CharField
(
transaction_type
=
models
.
ForeignKey
(
TransactionType
,
on_delete
=
models
.
PROTECT
,
verbose_name
=
_
(
'
type
'
),
max_length
=
31
,
)
...
...
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