@@ -11,7 +11,7 @@ class UserInfoAdmin(ChangeOnlyModelAdmin, admin.ModelAdmin): |
||
| 11 | 11 |
list_display = ('user_id', 'unionid', 'openid', 'nickname', 'phone', 'location', 'balance', 'user_status', 'test_user', 'status', 'created_at', 'updated_at')
|
| 12 | 12 |
list_filter = ('test_user', 'sex', 'user_status', 'status')
|
| 13 | 13 |
readonly_fields = ('user_id', )
|
| 14 |
- search_fields = ('user_id', 'username', 'unionid', 'openid', 'openid_miniapp', 'name', 'phone', 'location')
|
|
| 14 |
+ search_fields = ('user_id', 'username', 'unionid', 'openid', 'openid_miniapp', 'nickname', 'name', 'phone', 'location')
|
|
| 15 | 15 |
|
| 16 | 16 |
def save_model(self, request, obj, form, change): |
| 17 | 17 |
obj.save() |
@@ -1,14 +1,26 @@ |
||
| 1 | 1 |
# -*- coding: utf-8 -*- |
| 2 | 2 |
|
| 3 | 3 |
from django.contrib import admin |
| 4 |
+from pysnippets.strsnippets import strip |
|
| 4 | 5 |
|
| 5 | 6 |
from guideline.models import ScreenAdminInfo |
| 7 |
+from mch.models import BrandInfo |
|
| 6 | 8 |
|
| 7 | 9 |
|
| 8 | 10 |
class ScreenAdminInfoAdmin(admin.ModelAdmin): |
| 9 |
- list_display = ('admin_id', 'unionid', 'openid', 'name', 'sex', 'nickname', 'phone', 'location', 'status', 'created_at', 'updated_at')
|
|
| 10 |
- readonly_fields = ('admin_id',)
|
|
| 11 |
- search_fields = ('admin_id', 'unionid', 'openid', 'name', 'phone', 'location')
|
|
| 11 |
+ list_display = ('admin_id', 'nickname', 'brand_id', 'brand_name', 'user_status', 'status', 'created_at', 'updated_at')
|
|
| 12 |
+ list_filter = ('brand_name', 'user_status', 'status')
|
|
| 13 |
+ readonly_fields = ('admin_id', )
|
|
| 14 |
+ search_fields = ('admin_id', 'unionid', 'openid', 'name', 'phone', 'location', 'brand_id', 'brand_name')
|
|
| 15 |
+ |
|
| 16 |
+ def save_model(self, request, obj, form, change): |
|
| 17 |
+ obj.brand_id = strip(obj.brand_id) |
|
| 18 |
+ try: |
|
| 19 |
+ obj.brand_name = BrandInfo.objects.get(brand_id=obj.brand_id).brand_name |
|
| 20 |
+ except BrandInfo.DoesNotExist: |
|
| 21 |
+ obj.brand_name = '' |
|
| 22 |
+ |
|
| 23 |
+ obj.save() |
|
| 12 | 24 |
|
| 13 | 25 |
|
| 14 | 26 |
admin.site.register(ScreenAdminInfo, ScreenAdminInfoAdmin) |
@@ -14,7 +14,7 @@ from mch.models import (ActivityInfo, AdministratorInfo, BrandInfo, ConsumeInfoS |
||
| 14 | 14 |
|
| 15 | 15 |
class AdministratorInfoAdmin(admin.ModelAdmin): |
| 16 | 16 |
list_display = ('admin_id', 'phone', 'name', 'brand_id', 'brand_name', 'user_status', 'status', 'created_at', 'updated_at')
|
| 17 |
- list_filter = ('user_status', 'status', 'brand_name')
|
|
| 17 |
+ list_filter = ('brand_name', 'user_status', 'status')
|
|
| 18 | 18 |
readonly_fields = ('encryption', 'brand_name')
|
| 19 | 19 |
|
| 20 | 20 |
def save_model(self, request, obj, form, change): |
@@ -35,7 +35,7 @@ class AdministratorInfoAdmin(admin.ModelAdmin): |
||
| 35 | 35 |
|
| 36 | 36 |
class OperatorInfoAdmin(admin.ModelAdmin): |
| 37 | 37 |
list_display = ('operator_id', 'phone', 'name', 'brand_id', 'brand_name', 'brand_domain', 'user_status', 'status', 'created_at', 'updated_at')
|
| 38 |
- list_filter = ('user_status', 'status', 'brand_name')
|
|
| 38 |
+ list_filter = ('brand_name', 'user_status', 'status')
|
|
| 39 | 39 |
readonly_fields = ('encryption', 'brand_name')
|
| 40 | 40 |
|
| 41 | 41 |
def save_model(self, request, obj, form, change): |