Skip to content
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

Add RW support to the REST API #75

Merged
merged 49 commits into from
Jun 21, 2014
Merged

Add RW support to the REST API #75

merged 49 commits into from
Jun 21, 2014

Conversation

rolandgeider
Copy link
Member

This pull requests adds full RW support for the REST API. Tastypie is being replaced by Django REST Framework, as this seems more actively developed, the documentation is better and it seems easier to extend and configure the endpoints and behaviour. The /api/v1 will be deprecated and removed in the future (1 year perhaps?)

@rolandgeider
Copy link
Member Author

TODOS:

  • Use the API instead of all the custom api_foobar functions in JS code
  • Special endpoints
    • Add 'special' logic endpoint such as exercise and ingredient search
    • Add 'special' info endpoints (e.g. the canonical representation)
    • Fix access to special points
  • Other considerations
    • Exercises can only be POSTed but not updated
    • Exercise images can only be POSTed but not updated
    • The userprofile can only be updated, but not DELETEd
  • Update the tests
  • Update the API documentation

This is basically the form used by the Django REST Framework, with some
things tweaked to fit into the application design.
For this to work, it is necessary that the ViewSets have either a
'ordering_fields' or a 'serializer_class' attribute
This needed an external django app, 'django-filter'
Since the API now supports write operations, the testcases test
performing DELETE, POST, PATCH and PUT operations

--HG--
rename : wger/config/tests/test_language.py => wger/core/tests/test_language.py
This change makes the fields that control ownership optional. This is
the case when not all fields are present in the request, e.g. when
PATCHing the resource.
- Tests that PATCH actually allows to change each individual field
- Test some results from the API testcase by looking into the DB
- Some more tests when PUTting to a detail resource
For some reason, having a max_length was causing an exception
"object of type 'int' has no len()" when updating anything via the API
--HG--
extra : amend_source : a5e3dc39de561fbc8682002a82c5f698507606a0
- New abstract class with simplified status (accepted, pending, declined)
- New manager with custom filters (.accepted(), etc.)

--HG--
extra : amend_source : e8a8c9a252537e03dbe235c056645b1c29f42cb4
--HG--
rename : wger/exercises/tests/test_submitted_exercise.py => wger/exercises/tests/test_submitted_image.py
@rolandgeider rolandgeider added this to the 1.5 milestone Jun 17, 2014
rolandgeider added a commit that referenced this pull request Jun 21, 2014
@rolandgeider rolandgeider merged commit 2146709 into master Jun 21, 2014
@rolandgeider rolandgeider deleted the user-api-auth branch June 21, 2014 09:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocker Hard block of a release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants