2018-06-23 19:08:56 +00:00
|
|
|
from django.contrib import admin
|
|
|
|
from django.utils.translation import gettext_lazy as _
|
|
|
|
|
|
|
|
from . import models
|
|
|
|
|
|
|
|
|
|
|
|
@admin.register(models.Order)
|
|
|
|
class OrderAdmin(admin.ModelAdmin):
|
|
|
|
|
2019-08-31 22:27:36 +00:00
|
|
|
list_display = ("who", "description", "created", "is_paid")
|
2018-06-23 19:08:56 +00:00
|
|
|
|
|
|
|
def who(self, instance):
|
|
|
|
return instance.user.get_full_name()
|
2019-08-31 22:27:36 +00:00
|
|
|
|
2018-06-23 19:08:56 +00:00
|
|
|
who.short_description = _("Customer")
|
|
|
|
|
|
|
|
|
|
|
|
@admin.register(models.Payment)
|
|
|
|
class PaymentAdmin(admin.ModelAdmin):
|
|
|
|
|
2019-08-31 22:27:36 +00:00
|
|
|
list_display = ("who", "description", "order_id", "created")
|
2018-06-23 19:08:56 +00:00
|
|
|
|
|
|
|
def who(self, instance):
|
|
|
|
return instance.order.user.get_full_name()
|
2019-08-31 22:27:36 +00:00
|
|
|
|
2018-06-23 19:08:56 +00:00
|
|
|
who.short_description = _("Customer")
|
|
|
|
|
|
|
|
def order_id(self, instance):
|
|
|
|
return instance.order.id
|
2019-08-31 22:27:36 +00:00
|
|
|
|
2018-06-23 19:08:56 +00:00
|
|
|
order_id.short_description = _("Order ID")
|