Django 1.7 tutorial: Use generic views

85 views
Skip to first unread message

Pitchblack

unread,
Aug 30, 2014, 12:41:36 PM8/30/14
to django...@googlegroups.com

I need to use Jython instead of Python, I found that jython2.7b2 works with DJango 1.7. So, I am stuck using the beta version. I am trying to follow the current Django tutorial and I have ran into a problem. I am not sure if I am using generic views properly. When I try to change the urls.py (polls) file. I see that pydev complains that views.IndexView, views.DetailView, and ResultsView don't exist. Am I doing something wrong? Or did they change the way generics work in version 1.7?

My System:

  • Windows 7
  • jython2.7b2
  • Django-1.7c3
  • postgresql-9.3.5-1-windows-x64
  • postgresql-9.3-1102.jdbc41.jar

Here is the url for the tutorial, go to the section "Use generic views: Less code is better"
https://docs.djangoproject.com/en/dev/intro/tutorial04/


Sithembewena Lloyd Dube

unread,
Aug 30, 2014, 7:01:38 PM8/30/14
to django...@googlegroups.com
I suggest typing:
- manage.py shell
- from polls import views
- dir(views)

What output do you get? i.e, nspect views like the regular python module that it is.


--
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...@googlegroups.com.
To post to this group, send email to django...@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/5be54cfd-ed53-40ca-b7e1-297814c1727d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Regards,
Sithu Lloyd Dube

Michael Martin

unread,
Sep 1, 2014, 8:48:34 PM9/1/14
to django...@googlegroups.com
Here are the results that I recieved

>>> from polls import views
>>> dir(views)
['Choice', 'HttpResponse', 'HttpResponseRedirect', 'Question', '__doc__', '__fil
e__', '__name__', '__package__', 'detail', 'get_object_or_404', 'index', 'render
', 'results', 'reverse', 'vote']
>>>


James Schneider

unread,
Sep 1, 2014, 9:12:28 PM9/1/14
to django...@googlegroups.com
Did you finish out the 'Amend Views' section of the tutorial? 


Based on the dir() output below, you didn't. You won't be able to reference those view classes from your urls.py until you create them in views.py.

Personal note: I think the ordering in the tutorial sections is wrong. The views should be created first and then referenced by an updated urls.py. I may file a bug/patch on this.

-James

Michael Martin

unread,
Sep 2, 2014, 12:07:50 AM9/2/14
to django...@googlegroups.com
James,

Yes, you are correct.  It would have made more sense if they placed the "Amend Views" section first.







Reply all
Reply to author
Forward
0 new messages