|
|
|
@ -1,21 +1,34 @@
|
|
|
|
|
from datetime import timedelta, datetime |
|
|
|
|
from django.contrib.auth.models import User, Group |
|
|
|
|
from django.http import HttpResponseRedirect |
|
|
|
|
from django.contrib.admin.helpers import ACTION_CHECKBOX_NAME |
|
|
|
|
from django.utils.safestring import mark_safe |
|
|
|
|
from django_admin_listfilter_dropdown.filters import DropdownFilter |
|
|
|
|
from .models import Orders, Users |
|
|
|
|
|
|
|
|
|
from django.contrib import admin, messages |
|
|
|
|
from django.urls import reverse |
|
|
|
|
|
|
|
|
|
from rangefilter.filters import DateRangeFilter |
|
|
|
|
|
|
|
|
|
class OrdersAdmin(admin.ModelAdmin): |
|
|
|
|
|
|
|
|
|
list_display = ( |
|
|
|
|
'orderName', 'orderCreateDateTime', 'orderDesc', 'orderAddress', |
|
|
|
|
'catID', 'userName', 'orderStatus', 'show_photo', 'show_photopay', |
|
|
|
|
) |
|
|
|
|
) |
|
|
|
|
actions = ['send_message'] |
|
|
|
|
exclude = ['orderAccess', 'userID', 'orderPhoto', 'orderPhotoPay'] |
|
|
|
|
search_fields = ['orderName__regex', 'orderCreateDateTime__regex', 'orderDesc__regex', |
|
|
|
|
'orderAddress__regex', 'catID__regex', 'orderStatus__regex' |
|
|
|
|
] |
|
|
|
|
|
|
|
|
|
list_filter = [ |
|
|
|
|
('orderName', DropdownFilter), |
|
|
|
|
('orderAddress', DropdownFilter), |
|
|
|
|
('orderDesc', DropdownFilter), |
|
|
|
|
('catID', DropdownFilter), |
|
|
|
|
('orderCreateDateTime', DateRangeFilter) |
|
|
|
|
|
|
|
|
|
] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def userName(self, obj): |
|
|
|
|