Different behavior in ListVIew Vs CreateView (class based views )

Previous Topic Next Topic
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Different behavior in ListVIew Vs CreateView (class based views )

kanishk tanwar
class SchoolListView(ListView):
template_name = 'app/List.html'
context_object_name = 'schools'
model = models.School

# i have this first class here i don't need to define attribute like

# ListView.model and ListView.template_name etc

# But-------> in CreateView its a totally different story

class SchoolCreateView(CreateView):
model = models.School
fields = ['name', 'principal', 'location']
template_name = 'app/Form.html'

# here if i omit CreateView.model or CreateView.fiels or createView.template_name
# i got an exception which states Imporperly configured CreateView missing query set
# i am learning class base views from a tutorial and he is using django version 1.10.5
# and his code works fine without using CreateView is that the issue??
# or i am doing some bad stuff kindly help

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 [hidden email].
To post to this group, send email to [hidden email].
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/2200d3a6-4dae-4e55-b8b1-6fde1423412a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.