This commit is contained in:
Tom Christie 2015-01-21 13:03:49 +00:00
commit 9d24809a4d
2 changed files with 4 additions and 4 deletions

View File

@ -60,7 +60,7 @@ For example, you can append `router.urls` to a list of existing views…
router.register(r'accounts', AccountViewSet)
urlpatterns = [
url(r'^forgot-password/$, ForgotPasswordFormView.as_view(),
url(r'^forgot-password/$', ForgotPasswordFormView.as_view(),
]
urlpatterns += router.urls
@ -68,14 +68,14 @@ For example, you can append `router.urls` to a list of existing views…
Alternatively you can use Django's `include` function, like so…
urlpatterns = [
url(r'^forgot-password/$, ForgotPasswordFormView.as_view(),
url(r'^forgot-password/$', ForgotPasswordFormView.as_view(),
url(r'^', include(router.urls))
]
Router URL patterns can also be namespaces.
urlpatterns = [
url(r'^forgot-password/$, ForgotPasswordFormView.as_view(),
url(r'^forgot-password/$', ForgotPasswordFormView.as_view(),
url(r'^api/', include(router.urls, namespace='api'))
]

View File

@ -198,7 +198,7 @@ Open the file `snippets/serializers.py` again, and replace the `SnippetSerialize
model = Snippet
fields = ('id', 'title', 'code', 'linenos', 'language', 'style')
One nice property that serializers have is that you can inspect all the fields in a serializer instance, by printing it's representation. Open the Django shell with `python manage.py shell`, then try the following:
One nice property that serializers have is that you can inspect all the fields in a serializer instance, by printing its representation. Open the Django shell with `python manage.py shell`, then try the following:
>>> from snippets.serializers import SnippetSerializer
>>> serializer = SnippetSerializer()