Skip to content

Instantly share code, notes, and snippets.

@rvlb
Last active December 23, 2017 03:05
Show Gist options
  • Save rvlb/b44f923ed86e500f5629179d43c54a31 to your computer and use it in GitHub Desktop.
Save rvlb/b44f923ed86e500f5629179d43c54a31 to your computer and use it in GitHub Desktop.
DRF Routing

DefaultRouter Routing

Basic methods

  • {route}/

    • GET => list()
    • POST => create()
  • {route}/{lookup}/

    • GET => retrieve()
    • PUT => update()
    • DELETE => destroy()

Custom methods

  • {route}/{method_name}/

    • methods => @list_route(methods=['get']) method_name()
  • {route}/{lookup}/{method_name}/

    • methods => @detail_route(methods=['get') method_name()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment