Now i have a situation in separate models choices and display in admin with different url
here it's my models action:
class LogAction(Enum):
BUY = "buy"
REFUND = "refund"
SEND = "send"
RECEIVE = "receive"
WITHDRAW = "withdraw"
SUBSCRIPTION = "subscription"
NONE = "none"
my models:
class TransactionLog(models.Model):
...
action = models.CharField(max_length=32, choices=[(str(tag), tag.value) for tag in
LogAction],default=str(LogAction.NONE), db_index=True)
...
admin:
class TransactionLogAdmin(admin.ModelAdmin):
list_display = (
'get_event_type', 'user', 'target_user', 'action', 'created_at','get_real_point','success', 'note')
def get_event_type(self, instance: TransactionLog):
if instance.action == str(LogAction.SUBSCRIPTION):
return "SUBSCRIPTION"
elif instance.action == str(LogAction.WITHDRAW):
return "WITHDRAW"
elif instance.action == str(LogAction.REFUND):
return "REFUND"
elif instance.action == str(LogAction.BUY):
return "BUY"
else:
return instance.action
get_event_type.short_description = 'bill type'
here it's my backend admin. i'd like to show all 'buy' type in one table but different urls. and all 'refund','withdraw','subscription' is as same as 'buy' type so as to let me toggle to different pages. the multiple admin site is the option but is not suitable for this situation. what django tool can i use? plz give me some hint or some suggestion thanks a lot