Django for Designers/Whats next: Difference between revisions

Content added Content deleted
imported>Paulproteus
imported>Paulproteus
Line 375: Line 375:
</source>
</source>


==== Filter by user ====
==== Filtering, and further directions ====


Our API lets us filter by any of the fields it returns. So, for example, you can filter the results by user by visiting:
Our API lets us filter by any of the fields it returns. So, for example, you can filter the results by user by visiting:


http://localhost:8000/api/bookmark/?user__username=yourself
http://localhost:8000/api/bookmark/?user__username=yourself&format=json


Doing this requires no changes to your code. Cool, huh?
Doing this requires no changes to your code. Cool, huh?

One further direction would be to summarize the tags as a list of strings, rather than as a list of tag URIs. You could look into the [http://django-tastypie.readthedocs.org/en/latest/cookbook.html#adding-custom-values dehydrate] method that Tastypie lets you override.


==== Further directions ====
==== Further directions ====