@@ -30,7 +30,7 @@ class DistributorSaleStatisticInfoAdmin(admin.ModelAdmin): |
||
30 | 30 |
|
31 | 31 |
|
32 | 32 |
class ProvinceSaleStatisticInfoAdmin(admin.ModelAdmin): |
33 |
- list_display = ('province_code', 'province_name', 'ymd', 'num', 'status', 'created_at', 'updated_at') |
|
33 |
+ list_display = ('province_code', 'province_name', 'ymd', 'num', 'position', 'status', 'created_at', 'updated_at') |
|
34 | 34 |
list_filter = ('province_code', 'province_name', 'status') |
35 | 35 |
search_fields = ('province_code', 'province_name', 'ymd') |
36 | 36 |
|
@@ -0,0 +1,20 @@ |
||
1 |
+# -*- coding: utf-8 -*- |
|
2 |
+# Generated by Django 1.11.11 on 2018-04-25 13:25 |
|
3 |
+from __future__ import unicode_literals |
|
4 |
+ |
|
5 |
+from django.db import migrations, models |
|
6 |
+ |
|
7 |
+ |
|
8 |
+class Migration(migrations.Migration): |
|
9 |
+ |
|
10 |
+ dependencies = [ |
|
11 |
+ ('statistic', '0002_provincesalestatisticinfo'), |
|
12 |
+ ] |
|
13 |
+ |
|
14 |
+ operations = [ |
|
15 |
+ migrations.AddField( |
|
16 |
+ model_name='provincesalestatisticinfo', |
|
17 |
+ name='position', |
|
18 |
+ field=models.IntegerField(default=1, help_text='\u6392\u5e8f', verbose_name='position'), |
|
19 |
+ ), |
|
20 |
+ ] |
@@ -98,6 +98,8 @@ class ProvinceSaleStatisticInfo(BaseModelMixin): |
||
98 | 98 |
ymd = models.CharField(_(u'ymd'), max_length=8, blank=True, null=True, help_text=u'年月日', db_index=True) # 例:20171208, tc.local_string(format='%Y%m%d'), 0 为全部 |
99 | 99 |
num = models.IntegerField(_(u'num'), default=0, help_text=u'数量') |
100 | 100 |
|
101 |
+ position = models.IntegerField(_(u'position'), default=1, help_text=u'排序') |
|
102 |
+ |
|
101 | 103 |
class Meta: |
102 | 104 |
verbose_name = _(u'省份销量统计') |
103 | 105 |
verbose_name_plural = _(u'省份销量统计') |
@@ -43,7 +43,7 @@ def tj_data(request): |
||
43 | 43 |
distributor_sales = [d.data for d in distributor_sales] |
44 | 44 |
|
45 | 45 |
# 各地区实时销量 |
46 |
- province_sales = ProvinceSaleStatisticInfo.objects.filter(ymd='0', status=True).order_by('-num')[:3] |
|
46 |
+ province_sales = ProvinceSaleStatisticInfo.objects.filter(ymd='0', status=True).order_by('position') |
|
47 | 47 |
province_sales = [p.data for p in province_sales] |
48 | 48 |
|
49 | 49 |
return response(200, 'Get TJ Data Success', u'获取统计数据成功', { |