Tuesday, April 26, 2016

Re: New to Django (stuck at the end of the tutorial)

maybe giving it a namespace would handle it for you? such as ....
 include('sistema.urls', namespace='sistema')

if not you can try this. the error i get is that you should "pass the callable instead" which means in your imports include the views that you want to import, then call them in you url statements.
for example:

from .views import (
    post_list,
    post_create,
    post_detail,
    post_update,
    post_delete,
    )

urlpatterns = [
    url(r'^$', post_list, name='list'),
    url(r'^create/$', post_create, name='create'),
    url(r'^(?P<id>\d+)/$', post_detail, name='detail'),
    url(r'^(?P<id>\d+)/edit/$', post_update, name='update'),
    url(r'^(?P<id>\d+)/delete/$', post_delete, name='delete'),


]

here you are calling the view, then giving it a name that will show up in the URL.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/9f969947-ced2-4414-9c6f-8a53cf0022a1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment