Coverage for /home/tribaal/workspace/django-shop/shop/admin/orderadmin: 96.67%

# Coverage for /home/tribaal/workspace/django-shop/shop/admin/orderadmin : 96.67%

## 28 statements 28 run 0 missing 0 excluded 1 partial

Hot-keys on this page

r m x p toggle line displays

j k next/prev highlighted chunk

0 (zero) top of page

1 (one) first highlighted chunk

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | #-*- coding: utf-8 -*- from django.contrib import admin from django.contrib.admin.options import ModelAdmin from django.utils.translation import ugettext_lazy as _ from django.conf import settings from shop.models.ordermodel import (Order, OrderItem, OrderExtraInfo, ExtraOrderPriceField, OrderPayment) class OrderExtraInfoInline(admin.TabularInline): model = OrderExtraInfo extra = 0 class OrderPaymentInline(admin.TabularInline): model = OrderPayment extra = 0 class ExtraOrderPriceFieldInline(admin.TabularInline): model = ExtraOrderPriceField extra = 0 class OrderItemInline(admin.TabularInline): model = OrderItem extra = 0 #TODO: add ExtraOrderItemPriceField inline, ideas? class OrderAdmin(ModelAdmin): list_display = ('id', 'user', 'status', 'order_total', 'created') list_filter = ('status', 'user') search_fields = ('id', 'shipping_address_text', 'user__username') date_hierarchy = 'created' inlines = (OrderItemInline, OrderExtraInfoInline, ExtraOrderPriceFieldInline, OrderPaymentInline) readonly_fields = ('created', 'modified',) fieldsets = ( (None, {'fields': ('user', 'status', 'order_total', 'order_subtotal', 'created', 'modified')}), (_('Shipping'), { 'fields': ('shipping_address_text',), }), (_('Billing'), { 'fields': ('billing_address_text',) }), ) ORDER_MODEL = getattr(settings, 'SHOP_ORDER_MODEL', None) exitif not ORDER_MODEL: admin.site.register(Order, OrderAdmin)