Did you complete the following section after changing the urls.conf? The
URL changes won't work until you modify the views.py file in the next
section.

https://docs.djangoproject.com/en/1.8/intro/tutorial04/#amend-views

-James
On Aug 8, 2015 6:31 AM, "Doaa Hassan" <hsd...@gmail.com> wrote:

> Hi all,
>
> I am trying to convert poll app introduced on:
>
> https://docs.djangoproject.com/en/1.8/intro/tutorial01/
>
>  to use the generic views system as described on:
>
> https://docs.djangoproject.com/en/1.8/intro/tutorial04/
>
>  However, when I  convert the URLconf  by opening  the polls/urls.py and
> change it like so:
>
> from django.conf.urls import url
> from . import views
> urlpatterns = [
>     url(r'^$', views.IndexView.as_view(), name='index'),
>     url(r'^(?P<pk>[0-9]+)/$', views.DetailView.as_view(), name='detail'),
>     url(r'^(?P<pk>[0-9]+)/results/$', views.ResultsView.as_view(), 
> name='results'),
>     url(r'^(?P<question_id>[0-9]+)/vote/$', views.vote, name='vote'),]
>
> then reload the polls app (http://localhost:8000/polls/), I got the following 
> error:
>
>
> 'module' object has no attribute 'IndexView'
>
>
> Traceback:
>
> File 
> "C:\Users\nti\Desktop\test_env\lib\site-packages\django\core\handlers\base.py"
>  in get_response
>   119.                 resolver_match = resolver.resolve(request.path_info)
> File 
> "C:\Users\nti\Desktop\test_env\lib\site-packages\django\core\urlresolvers.py" 
> in resolve
>   366.             for pattern in self.url_patterns:
> File 
> "C:\Users\nti\Desktop\test_env\lib\site-packages\django\core\urlresolvers.py" 
> in url_patterns
>   402.         patterns = getattr(self.urlconf_module, "urlpatterns", 
> self.urlconf_module)
> File 
> "C:\Users\nti\Desktop\test_env\lib\site-packages\django\core\urlresolvers.py" 
> in urlconf_module
>   396.             self._urlconf_module = import_module(self.urlconf_name)
> File "C:\Python27\Lib\importlib\__init__.py" in import_module
>   37.     __import__(name)
> File "C:\Users\nti\Desktop\test_env\myapp\myapp\urls.py" in <module>
>   21.         url(r'^polls/', include('polls.urls', namespace="polls")),
> File 
> "C:\Users\nti\Desktop\test_env\lib\site-packages\django\conf\urls\__init__.py"
>  in include
>   33.         urlconf_module = import_module(urlconf_module)
> File "C:\Python27\Lib\importlib\__init__.py" in import_module
>   37.     __import__(name)
> File "C:\Users\nti\Desktop\test_env\myapp\polls\urls.py" in <module>
>   25.     url(r'^$', views.IndexView.as_view(), name='index'),
>
> Exception Type: AttributeError at /polls/
> Exception Value: 'module' object has no attribute 'IndexView'
>
> --------------------------------
>
> Do you have any clue to fix the problem?
>
> Thanks.
>
> Best regards,
> Doaa
>
> --
> 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+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/6f61448d-d30c-4d22-a198-75e33ceeefac%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/6f61448d-d30c-4d22-a198-75e33ceeefac%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2Be%2BciWGBQeXnXeBixS%2B862pZGBgyvvGy7nL5-e5bDho9fy%2BWQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to