Update django-admin to support ForeignKey

Brightcells 7 anni fa
parent
commit
5a3e7b03a3
2 ha cambiato i file con 6 aggiunte e 1 eliminazioni
  1. 1 1
      requirements.txt
  2. 5 0
      support/admin.py

+ 1 - 1
requirements.txt

@@ -2,7 +2,7 @@ Django==1.11.3
2 2
 MySQL-python==1.2.5
3 3
 StatusCode==1.0.0
4 4
 TimeConvert==1.4.1
5
-django-admin==1.0.12
5
+django-admin==1.0.13
6 6
 django-detect==1.0.5
7 7
 django-json-response==1.1.5
8 8
 django-logit==1.0.6

+ 5 - 0
support/admin.py

@@ -20,6 +20,11 @@ class MachineSupportPrebookInfoAdmin(AdvancedExportExcelModelAdmin, admin.ModelA
20 20
     list_display = ('prebook_id', 'user_id', 'name', 'sex', 'phone', 'weekday', 'timeslice', 'body', 'back', 'handle_status', 'status', 'created_at', 'updated_at')
21 21
     list_filter = ('weekday', 'timeslice', 'body', 'back', 'handle_status', 'status')
22 22
     search_fields = ('prebook_id', 'user_id', 'name', 'phone', 'body', 'back')
23
+    excel_fields_exclude = ('weekday',)
24
+    extra_excel_fields = ('weekday',)
25
+
26
+    def add_extra_excel_fields(self, request, query):
27
+        return [[u'星期日', u'星期一', u'星期二', u'星期三', u'星期四', u'星期五', u'星期六'][query.weekday]]
23 28
 
24 29
 
25 30
 admin.site.register(MachineBodyInfo, MachineBodyInfoAdmin)