32 lines
962 B
Python
32 lines
962 B
Python
from django.views.generic import ListView
|
|
|
|
from backoffice.mixins import BackofficeCRUDMixin, BackofficeHtmxMixin
|
|
from shop.models import Payment
|
|
|
|
SECTION = 'payments'
|
|
|
|
|
|
class PaymentListView(BackofficeCRUDMixin, BackofficeHtmxMixin, ListView):
|
|
model = Payment
|
|
permission_required = 'shop.view_payment'
|
|
section = SECTION
|
|
paginate_by = 20
|
|
template_name = 'backoffice/generic/list.html'
|
|
fragment_template_name = 'backoffice/generic/_list_fragment.html'
|
|
ordering = '-creation_date'
|
|
|
|
def get_context_data(self, **kwargs):
|
|
context = super().get_context_data(**kwargs)
|
|
context.update(
|
|
{
|
|
'title': 'Pagos',
|
|
'columns': [
|
|
('Fecha', 'creation_date'),
|
|
('Pedido', 'order.code'),
|
|
('Importe', 'amount'),
|
|
('Método', 'get_method_display'),
|
|
],
|
|
}
|
|
)
|
|
return context
|