-
Notifications
You must be signed in to change notification settings - Fork 301
include usage #318
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hello, there is nothing special about views, it's the serialiser that you must customise: To allow querying with class UserSerialiser(serializers.ModelSerializer):
included_serializers = {
'profile': 'Gienah.administration.serialisers.FacultySerialiser',
}
class Meta:
model = User
fields = ('name', 'profile') To include class UserSerialiser(serializers.ModelSerializer):
included_serializers = {
'profile': 'Gienah.administration.serialisers.FacultySerialiser',
}
class Meta:
model = User
fields = ('name', 'profile')
class JSONAPIMeta:
included_resources = ['profile'] |
okay. Say I have a viewset and a serializer. The viewset has a method # views.py
class ResourceViewSet():
def activity():
return rest_framework.response.Response(...) # serializers.py
class ResourceHyperlinkedSerializer():
included_serializers = {
'foo': '...'
}
class Meta:
model = Resource
fields = ('foo') However if I do |
I think to be able to assist you better could you expand on how your Maybe create a gist with the full implementation of the view if possible. Most likely the problem is hidden there somewhere... |
I've lost the context I had when I asked this and no longer have access to that codebase. Closing. |
I'm having difficulty understanding how to use
?include=...
. Say I have drfja properly installed, do you simply write your viewset code andinclude
query params are available?Or do you have to manually call http://django-rest-framework-json-api.readthedocs.io/en/stable/api.html?highlight=include#extract-included I'm confused.
The text was updated successfully, but these errors were encountered: