Django - Class Based Generic View - "No URL to redirect to"
Add in views:
def form_valid(self, form):
return self.render_to_response(self.get_context_data(form=form))
Have you tried passing in success_url
? e.g.
CreateView.as_view(model=myModel, success_url="/success/")
or if you want to redirect to a named view:
CreateView.as_view(model=myModel, success_url=reverse('success-url'))
you can also try to define get_absolute_url in your models. For example
class Something(models.Model):
name = models.CharField(max_length=50, verbose_name='name')
class Meta:
pass
def get_absolute_url(self):
return u'/some_url/%d' % self.id