admin
This commit is contained in:
parent
e27fe27bf0
commit
0a179bf350
2 changed files with 9 additions and 1 deletions
|
|
@ -7,7 +7,7 @@ class TransactionAdmin(admin.ModelAdmin):
|
|||
list_filter = ['state']
|
||||
|
||||
class AccountAdmin(admin.ModelAdmin):
|
||||
list_display = ['uuid', 'owner_uuid', 'wallet', 'owner_type', 'balance',]
|
||||
list_display = ['uuid', 'owner_uuid', 'wallet', 'owner_type', 'balance', 'get_name']
|
||||
search_fields = ['uuid', 'owner_uuid']
|
||||
list_filter = ['wallet__label', 'owner_type']
|
||||
|
||||
|
|
|
|||
|
|
@ -54,6 +54,11 @@ class Account(BaseModel):
|
|||
|
||||
return owner
|
||||
|
||||
def get_name(self):
|
||||
if self.owner_type == TypeChoices.APPLICATION:
|
||||
owner: Application = Application.objects.get(pk=self.owner_uuid)
|
||||
return owner.name
|
||||
|
||||
|
||||
class WalletQuerySet(models.QuerySet):
|
||||
pass
|
||||
|
|
@ -66,6 +71,9 @@ class Wallet(BaseModel):
|
|||
|
||||
objects = WalletQuerySet.as_manager()
|
||||
|
||||
def __str__(self):
|
||||
return self.label
|
||||
|
||||
|
||||
# TODO: move DRF functionalities to view or serializers
|
||||
# class TransactionManager(models.Manager):
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue