Created
October 10, 2011 12:37
-
-
Save flavianmissi/1275204 to your computer and use it in GitHub Desktop.
Django UpdateView sample
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#views.py | |
from django.views.generic import UpdateView | |
class UpdateBook(UpdateView): | |
model = Book | |
form_class = BookForm | |
template_name = 'create_form.html' | |
success_url = '/books/' | |
#urls.py | |
from django.conf.urls import * | |
from library.views import UpdateBook | |
urlpatterns = patterns('', | |
url('^update_book/(?P<pk>[\w-]+)$', UpdateBook.as_view(), name='update_book'), | |
) | |
# you MUST pass a pk or slug param to this view |
Thank you! You are the best!
Thank..
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
how to send context in success url?