Remove the strings at the start of each urlpatterns, e.g.
'matricula.views.Auth'. That's obsolete from when you were using
patterns(). urlpatterns should be a list of url()s.
On Tuesday, August 9, 2016 at 11:57:09 AM UTC-4, ludovic coues wrote:
>
> What you are writing is not valid python syntax.
> Here is the problematic code:
>
> urlpatterns += urlpatterns['matricula.views.Courses',
> url('^courses$', list_courses, name='courses'),
> url('^course/(?P<pk>\d+)$', view_course,
> name='course'),
> ]
>
> You can rewrite it like that and it will mean exactly the same:
>
> index = ('matricula.views.Courses',
> url('^courses$', list_courses, name='courses'),
> url('^course/(?P<pk>\d+)$', view_course,
> name='course'),
> )
> urlpatterns += urlpatterns[index]
>
> I assume you want something like this:
>
> urlpatterns += ['matricula.views.Courses',
> url('^courses$', list_courses,
> name='courses'),
> url('^course/(?P<pk>\d+)$',
> view_course, name='course'),
> ]
>
> I also recommend that you read this section of the documentation:
>
> https://docs.djangoproject.com/en/1.10/topics/http/urls/#including-other-urlconfs
>
>
> 2016-08-09 17:46 GMT+02:00 <[email protected] <javascript:>>:
> > Hello I need to know what is my error gretting
> >
> > this is my urls.py
> >
> > from django.conf.urls import url, include
> > from matricula.views.Auth import *
> > from matricula.views.Courses import *
> > from .admin import admin_site
> > from matricula.views.Pages import PageDetail
> > from matricula.views.Enrollments import *
> > urlpatterns = urlpatterns=['matricula.views.Auth',
> > url('^create_user$', create_user,
> > name="create_user"),
> > url('^confirm_email$', confirm_email,
> > name="confirm_email"),
> > url('^authenticate$', authenticate,
> > name="authenticate"),
> > url('^logout$', logout, name="logout"),
> > url('^recover_password$', recover_password,
> > name="recover_password"),
> > url('^mail_recover_pass$', mail_recover_pass,
> > name='mail_recover_pass'),
> > url('^user/profile/(?P<pk>[0-9]+)/$',
> > StudentEdit.as_view(), name='myprofile'),
> > ]
> >
> > urlpatterns += urlpatterns['matricula.views.Courses',
> > url('^courses$', list_courses, name='courses'),
> > url('^course/(?P<pk>\d+)$', view_course,
> > name='course'),
> > ]
> >
> > urlpatterns += urlpatterns['matricula.views.Enrollments',
> > url('^enrollme/(?P<pk>\d+)$', enrollme,
> > name="enrollme"),
> > url('^enrollment$', list_enroll,
> name="enrollment"),
> > url('^finish_enroll/(?P<pk>\d+)$',
> 'finish_enroll',
> > name="finish_enroll"),
> > ]
> >
> > urlpatterns += urlpatterns['',
> > url(r'^admin/', include(admin_site.urls)),
> > url(r'^pages/(?P<pk>\d+)$',
> PageDetail.as_view(),
> > name="academica_pages"),
> > ]
> >
> >
> > and the error is:
> >
> > File "C:\Users\Administrador\academica\matricula\urls.py", line 26, in
> > <module>
> > url('^course/(?P<pk>\d+)$', view_course, name='course'),
> > TypeError: list indices must be integers, not tuple
> >
> > ----------------------------------------------------------------
> > This message was sent using IMP, the Internet Messaging Program.
> >
> >
> >
> > --
> > Este mensaje le ha llegado mediante el servicio de correo electronico
> que
> > ofrece Infomed para respaldar el cumplimiento de las misiones del
> Sistema
> > Nacional de Salud. La persona que envia este correo asume el compromiso
> de
> > usar el servicio a tales fines y cumplir con las regulaciones
> establecidas
> >
> > Infomed: http://www.sld.cu/
> >
> > --
> > 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 [email protected] <javascript:>.
> > To post to this group, send email to [email protected]
> <javascript:>.
> > 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/20160809114608.59461sqs3z19achs%40webmail.sld.cu.
>
>
> > For more options, visit https://groups.google.com/d/optout.
>
>
>
> --
>
> Cordialement, Coues Ludovic
> +336 148 743 42
>
--
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 [email protected].
To post to this group, send email to [email protected].
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/46168add-25e5-480f-98a4-efba9e3ee997%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.