Add prebook_id

Brightcells 7 anos atrás
pai
commit
2d220b5f80

+ 1 - 1
requirements.txt

@@ -9,7 +9,7 @@ django-logit==1.0.6
9 9
 django-paginator2==1.0.3
10 10
 django-shortuuidfield==0.1.3
11 11
 django-uniapi==1.0.0
12
-django-we==1.0.11
12
+django-we==1.0.12
13 13
 hiredis==0.2.0
14 14
 pyPdf==1.13
15 15
 redis==2.10.6

+ 4 - 2
support/admin.py

@@ -1,5 +1,6 @@
1 1
 # -*- coding: utf-8 -*-
2 2
 
3
+from djadmin import ExportExcelModelAdmin
3 4
 from django.contrib import admin
4 5
 
5 6
 from support.models import MachineBackInfo, MachineBodyInfo, MachineSupportPrebookInfo
@@ -15,9 +16,10 @@ class MachineBackInfoAdmin(admin.ModelAdmin):
15 16
     list_filter = ('status', )
16 17
 
17 18
 
18
-class MachineSupportPrebookInfoAdmin(admin.ModelAdmin):
19
-    list_display = ('user_id', 'name', 'sex', 'phone', 'weekday', 'timeslice', 'body', 'back', 'handle_status', 'status', 'created_at', 'updated_at')
19
+class MachineSupportPrebookInfoAdmin(ExportExcelModelAdmin, admin.ModelAdmin):
20
+    list_display = ('prebook_id', 'user_id', 'name', 'sex', 'phone', 'weekday', 'timeslice', 'body', 'back', 'handle_status', 'status', 'created_at', 'updated_at')
20 21
     list_filter = ('weekday', 'timeslice', 'body', 'back', 'handle_status', 'status')
22
+    search_fields = ('prebook_id', 'user_id', 'name', 'phone', 'body', 'back')
21 23
 
22 24
 
23 25
 admin.site.register(MachineBodyInfo, MachineBodyInfoAdmin)

+ 21 - 0
support/migrations/0005_machinesupportprebookinfo_prebook_id.py

@@ -0,0 +1,21 @@
1
+# -*- coding: utf-8 -*-
2
+# Generated by Django 1.11.3 on 2017-09-18 10:51
3
+from __future__ import unicode_literals
4
+
5
+from django.db import migrations
6
+import shortuuidfield.fields
7
+
8
+
9
+class Migration(migrations.Migration):
10
+
11
+    dependencies = [
12
+        ('support', '0004_auto_20170816_1604'),
13
+    ]
14
+
15
+    operations = [
16
+        migrations.AddField(
17
+            model_name='machinesupportprebookinfo',
18
+            name='prebook_id',
19
+            field=shortuuidfield.fields.ShortUUIDField(blank=True, db_index=True, editable=False, help_text='\u652f\u6301\u552f\u4e00\u6807\u8bc6', max_length=22, unique=True),
20
+        ),
21
+    ]

+ 2 - 0
support/models.py

@@ -2,6 +2,7 @@
2 2
 
3 3
 from django.db import models
4 4
 from django.utils.translation import ugettext_lazy as _
5
+from shortuuidfield import ShortUUIDField
5 6
 
6 7
 from manual.basemodels import CreateUpdateMixin
7 8
 
@@ -75,6 +76,7 @@ class MachineSupportPrebookInfo(CreateUpdateMixin):
75 76
         (HAS_HANDLED, u'已处理'),
76 77
     )
77 78
 
79
+    prebook_id = ShortUUIDField(_(u'prebook_id'), max_length=255, help_text=u'支持唯一标识', db_index=True, unique=True)
78 80
     user_id = models.CharField(_(u'user_id'), max_length=255, blank=True, null=True, help_text=u'用户唯一标识', db_index=True)
79 81
     name = models.CharField(_(u'name'), max_length=255, blank=True, null=True, help_text=u'用户姓名')
80 82
     sex = models.IntegerField(_(u'sex'), choices=SEX_TYPE, default=MALE, help_text=u'用户性别')