-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
69 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
from .models import Reference | ||
from rest_framework import serializers | ||
|
||
|
||
class ReferenceSerializer(serializers.ModelSerializer): | ||
class Meta: | ||
model = Reference | ||
fields = '__all__' | ||
|
||
class ReferenceQuerySerializer(serializers.Serializer): | ||
content_type_id = serializers.IntegerField() | ||
object_id = serializers.IntegerField() |
11 changes: 11 additions & 0 deletions
11
apis_bibsonomy/templates/apis_bibsonomy/reference_list.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{% extends "base.html" %} | ||
|
||
{% block content %} | ||
<ul> | ||
{% for reference in object_list %} | ||
<li>{{ reference }}}</li> | ||
{% empty %} | ||
<li>No references yet.</li> | ||
{% endfor %} | ||
</ul> | ||
{% endblock content %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>Bibsonomy</title> | ||
</head> | ||
<body> | ||
{% block content %}{% endblock content %} | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,12 @@ | ||
from rest_framework.routers import DefaultRouter | ||
from django.urls import path | ||
from . import api_views | ||
from . import api_views, views | ||
from . import autocompletes | ||
|
||
app_name = 'apis_bibsonomy' | ||
|
||
urlpatterns = [ | ||
path('save_get/', api_views.SaveBibsonomyEntry.as_view(), name='savegetbibsonomyentry'), | ||
path('autocomplete/', autocompletes.BibsonomyAutocomplete.as_view(), name='bibsonomyautocomplete') | ||
path('autocomplete/', autocompletes.BibsonomyAutocomplete.as_view(), name='bibsonomyautocomplete'), | ||
path('references/<int:object_id>/<int:content_type_id>', views.ReferenceListView.as_view(), name='referenceslist'), | ||
] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
from django.views.generic.list import ListView | ||
|
||
from .models import Reference | ||
|
||
|
||
class ReferenceListView(ListView): | ||
def get_queryset(self): | ||
object_id = self.kwargs.get('object_id') | ||
content_type_id = self.kwargs.get('content_type_id') | ||
print(object_id, content_type_id) | ||
refs = Reference.objects.filter(object_id=object_id, content_type__id = content_type_id) | ||
print(refs) | ||
return refs |