1đ
â
urlpatterns = patterns('SI.views',
url(regex=r'^',
view='myModel_asJson',
name='url'),
)
There are a few issues in your code: the JSON call is on the root (I think thatâs one of the issues) ! The view mixes up camel case and an underscore. The JSON call URL name is url
. Apparently, you return user logins so better make your code explicit:
urlpatterns = patterns('SI.views',
url(regex=r'^api/logins/', view='login_list', name='api-login-list'),
)
Change the view name as well of course. Then test it directly, go to http://localhost/api/logins/
to see if you get the proper list. Ideally, you want a functional test for that.
Finally, just change this in your template:
âurlâ: â{% url âapi_login_listâ %}â,
Also in your view:
object_list = list(Utilisateur.objects.values_list("Login"))
Shouldnât it be login
? No uppercase.
Source:stackexchange.com