Skip to content

Commit 9832572

Browse files
authored
Merge pull request #19 from biojs/develop
Develop
2 parents 0a3dd3a + 6102bdf commit 9832572

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
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/urls.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from django.conf.urls import url
22
from . import views
33

4-
app_name = 'datatest'
4+
app_name = 'main'
55

66
urlpatterns = [
77
url(r'^$', views.index, name="index"),

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: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
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
89
pytz==2018.4
10+
redis==2.10.6
911
requests==2.18.4
1012
urllib3==1.22

0 commit comments

Comments
 (0)