File tree Expand file tree Collapse file tree 3 files changed +7
-6
lines changed Expand file tree Collapse file tree 3 files changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -33,7 +33,6 @@ class Meta:
33
33
34
34
class TopComponentSerializer (serializers .ModelSerializer ): # Data fields when viewing the overall top components
35
35
tags = serializers .SerializerMethodField ()
36
- icon_url = serializers .SerializerMethodField ()
37
36
def get_tags (self , obj ):
38
37
tags = []
39
38
for t in obj .tags .all ():
Original file line number Diff line number Diff line change 4
4
from django .contrib .admin .views .decorators import staff_member_required
5
5
from django .http import HttpResponse
6
6
import urllib , json
7
+ from django .core .management import call_command
7
8
8
9
def index (request ):
9
10
top_dl_components = Component .objects .all ().order_by ('-downloads' )[:3 ]
@@ -26,7 +27,7 @@ def all_components(request): # requested on_load() for querying
26
27
})
27
28
28
29
def top_components (request ):
29
- top_components = TopComponentSerializer (Component .objects .all ().order_by ('-downloads' )[:10 ], many = True , context = { 'request' : request } )
30
+ top_components = TopComponentSerializer (Component .objects .all ().order_by ('-downloads' )[:10 ], many = True )
30
31
print top_components
31
32
return JsonResponse ({
32
33
'top_components' :top_components .data ,
@@ -43,7 +44,5 @@ def component_details(request, url_name):
43
44
44
45
@staff_member_required
45
46
def update_data (request ):
46
- response = urllib .urlopen ("https://api.npms.io/v2/search?q=keywords:biojs" )
47
- print response .read ()
48
- data = json .load (response )
47
+ call_command ('updatecomponents' )
49
48
return HttpResponse ("Database Successfully Updated." )
Original file line number Diff line number Diff line change 1
1
certifi == 2018.4.16
2
2
chardet == 3.0.4
3
- Django == 1.10
3
+ Django == 1.11.13
4
+ django-redis == 4.9.0
4
5
django-rest-framework == 0.1.0
5
6
djangorestframework == 3.8.2
6
7
idna == 2.6
7
8
Pillow == 5.1.0
9
+ pkg-resources == 0.0.0
8
10
pytz == 2018.4
11
+ redis == 2.10.6
9
12
requests == 2.18.4
10
13
urllib3 == 1.22
You can’t perform that action at this time.
0 commit comments