@@ -2,6 +2,7 @@ |
||
2 | 2 |
|
3 | 3 |
from __future__ import division |
4 | 4 |
|
5 |
+from django.conf import settings |
|
5 | 6 |
from django_logit import logit |
6 | 7 |
from django_models_ext import ProvinceShortModelMixin |
7 | 8 |
from django_response import response |
@@ -111,7 +112,7 @@ def distributor_list(request): |
||
111 | 112 |
except AdministratorInfo.DoesNotExist: |
112 | 113 |
return response(AdministratorStatusCode.ADMINISTRATOR_NOT_FOUND) |
113 | 114 |
|
114 |
- distributors = DistributorInfo.objects.filter(brand_id=administrator.brand_id, status=True).order_by('-pk') |
|
115 |
+ distributors = DistributorInfo.objects.filter(brand_id=administrator.brand_id, status=True).order_by('position', '-pk') |
|
115 | 116 |
count = distributors.count() |
116 | 117 |
distributors, left = pagination(distributors, page, num) |
117 | 118 |
distributors = [distributor.admindata for distributor in distributors] |
@@ -121,3 +122,14 @@ def distributor_list(request): |
||
121 | 122 |
'count': count, |
122 | 123 |
'left': left, |
123 | 124 |
}) |
125 |
+ |
|
126 |
+ |
|
127 |
+def distributor_all(request): |
|
128 |
+ brand_id = request.POST.get('brand_id', settings.KODO_DEFAULT_BRAND_ID) |
|
129 |
+ |
|
130 |
+ distributors = DistributorInfo.objects.filter(brand_id=brand_id, status=True).order_by('position', '-pk') |
|
131 |
+ distributors = [distributor.admindata for distributor in distributors] |
|
132 |
+ |
|
133 |
+ return response(200, 'Get Distributor List Success', u'获取经销商列表成功', { |
|
134 |
+ 'distributors': distributors, |
|
135 |
+ }) |
@@ -269,6 +269,7 @@ urlpatterns += [ |
||
269 | 269 |
url(r'^distributor/delete$', distributor_views.distributor_delete, name='distributor_delete'), |
270 | 270 |
url(r'^distributor/update$', distributor_views.distributor_update, name='distributor_update'), |
271 | 271 |
url(r'^distributor/list$', distributor_views.distributor_list, name='distributor_list'), |
272 |
+ url(r'^distributor/all$', distributor_views.distributor_all, name='distributor_all'), |
|
272 | 273 |
] |
273 | 274 |
|
274 | 275 |
urlpatterns += [ |