Top "Django-generic-views" questions

Questions about Django’s built-in generic views, which helps you to avoid repeating common code patterns in every project.

Django class-based view: How do I pass additional parameters to the as_view method?

I have a custom class-based view # myapp/views.py from django.views.generic import * class MyView(DetailView): template_name = 'detail.…

python django django-views django-generic-views
Use get_queryset() method or set queryset variable?

These two pieces of code are identical at the first blush: class IndexView(generic.ListView): template_name = 'polls/index.html' …

django django-views django-generic-views
Curious about get_form_kwargs in FormView

I was having trouble with FormView recently and found that the way to go about doing it was to use …

django django-views formview django-generic-views
Redirecting after AJAX post in Django

I use Django's built-in DeleteView and I've assigned a value to the success_url attribute. Now in my template, I …

jquery ajax django redirect django-generic-views
Accessing request.user in class based generic view CreateView in order to set FK field in Django

So I have a model that includes: class Place(models.Model): .... created_by = models.ForeignKey(User) My view is like …

django django-generic-views django-class-based-views
Django form_valid() and form_invalid() in CreateView not called

I am currently using django's CreateView to post data to the database. Unfortunately, the method where I would like to …

python django django-forms django-generic-views
NoReverseMatch Exception help in Django

I'm fairly new to python and following along with part 4 of the tutorial for the Django framework here. I'm trying …

python django exception syntax django-generic-views
django 'str' object is not callable

I have a problem creating an URL view in django. It gives me this error (ferrol is a Space object): …

django django-views django-generic-views
Expected view to be called with a URL keyword argument named "pk"

I'm writing a test for a Django Rest Framework view following closely the testing documentation Here's my simple test: def …

python django testing django-rest-framework django-generic-views
How can I make a Generic Class Based Create View for a Model?

What I'm trying to do is Django boilerplate for functional views. Any help here is very much appreciated, as the …

django django-generic-views