Skip to content

Commit f444eec

Browse files
committed
Removed saved icon url for top components
1 parent 4e6bed0 commit f444eec

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

main/serializers.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ class Meta:
3333

3434
class TopComponentSerializer(serializers.ModelSerializer): # Data fields when viewing the overall top components
3535
tags = serializers.SerializerMethodField()
36-
icon_url = serializers.SerializerMethodField()
3736
def get_tags(self, obj):
3837
tags = []
3938
for t in obj.tags.all():

main/views.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from django.contrib.admin.views.decorators import staff_member_required
55
from django.http import HttpResponse
66
import urllib, json
7+
from django.core.management import call_command
78

89
def index(request):
910
top_dl_components = Component.objects.all().order_by('-downloads')[:3]
@@ -26,7 +27,7 @@ def all_components(request): # requested on_load() for querying
2627
})
2728

2829
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)
3031
print top_components
3132
return JsonResponse({
3233
'top_components':top_components.data,
@@ -43,7 +44,5 @@ def component_details(request, url_name):
4344

4445
@staff_member_required
4546
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')
4948
return HttpResponse("Database Successfully Updated.")

requirements.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
certifi==2018.4.16
22
chardet==3.0.4
3-
Django==1.10
3+
Django==1.11.13
4+
django-redis==4.9.0
45
django-rest-framework==0.1.0
56
djangorestframework==3.8.2
67
idna==2.6
78
Pillow==5.1.0
9+
pkg-resources==0.0.0
810
pytz==2018.4
11+
redis==2.10.6
912
requests==2.18.4
1013
urllib3==1.22

0 commit comments

Comments
 (0)