You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to django-res...@googlegroups.com
Hi,
I am a .NET developer trying to develop my first REST API using Python, Django, and django-rest-framework and producing JSON output. I am using ModelResources mapped directly to Models and I successfully created the API and it returns correctly serialized output. I am able to limit what fields are exposed on the ModelResource by setting the "fields" property, however all nested (related) resources are showing all fields. What would be the best way to limit what fields I show once the Resource is serialized? Do I need to create a Custom Serializer? Thanks in advance.
--Amit Masaun
Tom Christie
unread,
Aug 17, 2012, 12:01:29 PM8/17/12
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to django-res...@googlegroups.com, am...@masaun.com
Something like this...
class UserResource(ModelResource):
model = Detail
fields = ('foo', 'bar', 'baz')
class RootResource(ModelResource):
model = Root
fields = (
'field_1',
'field_2'
('field_3': DetailResource'),
)
Amit Masaun
unread,
Aug 19, 2012, 4:10:00 AM8/19/12
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to django-res...@googlegroups.com, am...@masaun.com
Hi Tom. Thanks very much for some direction. Using the technique you laid out (with the minor tweak of a "," instead ":" ) I was easily able to accomplish what I needed. Kudos on a great REST framework. I am really liking it coming from a WCF world.
banxi
unread,
Aug 27, 2012, 3:13:22 AM8/27/12
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to django-res...@googlegroups.com, am...@masaun.com
Thanks ,this post is useful to me!
在 2012年8月19日星期日UTC+8下午4时10分00秒,Amit Masaun写道:
Cherie Pun
unread,
Jul 1, 2015, 6:19:06 AM7/1/15
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to django-res...@googlegroups.com, am...@masaun.com
Hi,
I can't seem to find ModelResource in the framework, do I have to import it from somewhere else? Also, does this work if the field is a list?