Commit 6fd02a381856c3ab419ac6e30af80553f066f8c5
1 parent
bcf2559a
Exists in
master
and in
2 other branches
remove incorrect view and url from topics app
Showing
2 changed files
with
0 additions
and
25 deletions
Show diff stats
topics/urls.py
| ... | ... | @@ -10,5 +10,4 @@ urlpatterns = [ |
| 10 | 10 | url(r'^view_log/(?P<topic>[\w_-]+)/$', views.topic_view_log, name = 'view_log'), |
| 11 | 11 | url(r'^update_order/$', views.update_order, name = 'update_order'), |
| 12 | 12 | url(r'^update_resource_order/$', views.update_resource_order, name = 'update_resource_order'), |
| 13 | - url(r'^count_resources/$', views.getResourceCount, name='resource_count'), | |
| 14 | 13 | ] | ... | ... |
topics/views.py
| ... | ... | @@ -276,27 +276,3 @@ def update_resource_order(request): |
| 276 | 276 | return JsonResponse({'message': 'No data received'}) |
| 277 | 277 | |
| 278 | 278 | |
| 279 | -def getResourceCount(request): | |
| 280 | - resources = Resource.objects.distinct() | |
| 281 | - | |
| 282 | - data = {} | |
| 283 | - for resource in resources: | |
| 284 | - key = resource.__dict__['_my_subclass'] | |
| 285 | - if key in data.keys(): | |
| 286 | - data[key] = data[key] + 1 | |
| 287 | - else: | |
| 288 | - data[key] = 1 | |
| 289 | - | |
| 290 | - data = [(key,value) for key,value in sorted(data.items(), key=operator.itemgetter(1), reverse=True)] | |
| 291 | - | |
| 292 | - others = data[4:] | |
| 293 | - total_others = 0 | |
| 294 | - for key,value in others: | |
| 295 | - total_others += value | |
| 296 | - | |
| 297 | - del data[4:] #remove from the 5th element | |
| 298 | - data.append(("others", total_others)) #so I have the sum of all other resources added up | |
| 299 | - real_data = [] | |
| 300 | - for key,value in data: | |
| 301 | - real_data.append((key,value)) | |
| 302 | - return JsonResponse(real_data, safe=False) | ... | ... |