Skip to content

Instantly share code, notes, and snippets.

@craigderington
Last active March 8, 2019 19:18
Show Gist options
  • Save craigderington/0820eaba5bd9c97eeb4ef9529ac8b1fd to your computer and use it in GitHub Desktop.
Save craigderington/0820eaba5bd9c97eeb4ef9529ac8b1fd to your computer and use it in GitHub Desktop.
DRF by Example URLs Module
from django.urls import path
from rest_framework.urlpatterns import format_suffix_patterns
from . import views
urlpatterns = [
path('', views.LocationList.as_view(), name='location-list'),
path('<int:pk>/', views.LocationDetail.as_view()),
path('geolocate/<str:ip_addr>', views.get_location, name='geolocate')
]
urlpatterns = format_suffix_patterns(urlpatterns)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment