1👍
Your URLconf should be like this
urlpatterns = patterns('',
url(r'^create/$', RestaurantCreate.as_view(), name='restaurant_create'),
url(r'^(?P<slug>[-\w]+)/preview/$', RestaurantPreview.as_view(), name='restaurant_preview'),
)
And you can use django.shortcuts.redirect
from django.shortcuts import redirect
def form_valid(self, form):
obj = form.save(commit=False)
obj.slug = unique_slug(obj.name, Restaurant)
obj.created_by = self.request.user
obj.save()
return redirect('restaurant_preview', slug=obj.slug)
Source:stackexchange.com