from django.contrib import admin

from .models import User, BonusProgramTransaction


@admin.register(User)
class UserAdmin(admin.ModelAdmin):
    list_display = ('email', 'role', 'full_name', 'phone', 'telegram', 'balance')

    def get_queryset(self, request):
        return User.objects.with_base_related()


@admin.register(BonusProgramTransaction)
class BonusProgramTransactionAdmin(admin.ModelAdmin):
    list_display = ('id', 'type', 'user', 'date', 'amount', 'comment', 'order', 'was_cancelled')

    def delete_queryset(self, request, queryset):
        for obj in queryset:
            obj.cancel()

