1
Vote

Incorrect django template intellisense

description

In the django/azure tutorial, we use the following code:
urlpatterns = patterns('',
    url(r'^(?P<pk>\d+)/results/$',
        DetailView.as_view(
            model=Poll,
            template_name='polls/results.html'),
        name='results'),
    url(r'^(?P<poll_id>\d+)/vote/$', 'polls.views.vote', name='vote'),
)
In results.html, if I type:
{% if poll.
I will get 2 completions: 'not', 'poll'. Which are both incorrect.

Image

file attachments

comments

Zooba wrote Apr 28 at 8:08 PM

I don't see where poll is passed in. Is that the wrong code snippet above?

huguesv wrote Apr 28 at 9:03 PM

It's the correct snippet.

It's from the tutorial project which you can get from http://download-codeplex.sec.s-msft.com/Download?ProjectName=pytools&DownloadId=783376

In this case, DetailView.as_view looks at Poll.objects (Poll is passed as the model) and gets the item from that collection whose primary key matches the one passed to the url.