Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

views.py DetailView #10

Closed
pilks7 opened this issue Mar 20, 2018 · 3 comments
Closed

views.py DetailView #10

pilks7 opened this issue Mar 20, 2018 · 3 comments

Comments

@pilks7
Copy link

pilks7 commented Mar 20, 2018

Spent the longest time on this, I had to specifically import Detail View like so
from django.views.generic.detail import DetailView

from django.views import generic

doesn't seem to work, throwing this:

 class BookDetailView(DetailView):
NameError: name 'DetailView' is not defined

I'm using python 3.6 and django 2.02 (on ubuntu 16.04)

@hamishwillee
Copy link
Collaborator

Are you saying that you imported the requirements.txt into your environment and built this project as-is from github and it didn't work?

@pilks7
Copy link
Author

pilks7 commented Mar 20, 2018 via email

@hamishwillee
Copy link
Collaborator

Many apologies. I completely forgot about this.

The documentation does correctly show how to do this:

from django.views import generic

class BookDetailView(generic.DetailView):
    model = Book

As you see, the Detail view is in django.views.generic, not in django.views.generic.detail

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants