Additionally it replaces the hack (django < 1.7) of double foreign key
on intermediate table (n2m relation) with trully foreign key (django 1.7
now supports it) adding corresponding migrations for conseve all previous
data.
For some reason validation of fields in partial updates wasn't
triggered. Investigating I found that in the case of partial updates
every field is marked as not-required when constructing the serializer:
rest_framework/fields.py:173
if self.partial:
self.required = False
but I couldn't a find where the place (if such a place exists) where the
fields that came in the PATCH request are marked as required again in
order to trigger their validation.
Basically this hotfix does that, mark as required every field present in
the PATCH request so their validation is performed.
The stars application has been removed in favor of a more generic voting
application that works with any model. Starring a project is just a
special case of voting a project.
Usage.
Add a vote:
votes.add_vote(<model instance>, user)
Remove a vote:
votes.remove_vote(<model instance>, user)
Get the queryset of users that voted an object:
votes.get_voters(<model instance>)
Get the number of votes an object has:
votes.get_votes(<model instance>)
Get the objects of type <model> voted by an user:
votes.get_voted(user, <model>)
The issues application is already making use of the votes application
through the following urls:
/api/v1/issues/<id>/upvote <- url name is "issues-upvote"
/api/v1/issues/<id>/downvote <- url name is "issues-downvote"
List project fans:
/projects/<project id>/fans
/projects/<project id>/fans/<user id>
List user starred projects:
/users/<user id>/starred
/users/<user id>/starred/<project id>
Also a "star" field with the stars count of a project is included in the
project detail and list responses.