Commit 6b0f96d2 authored by Washington99's avatar Washington99

Save changes button working

Functionality of the button has been added. Button now redirects to the details of the edited model entry.
parent 06f368a5
......@@ -30,7 +30,7 @@ class BookView(DetailView):
class BooksCreateView(CreateView):
model = Books
form = BookForm
form = BookForm # Can be removed?
fields = '__all__'
template_name = 'bookshelf/add-book.html'
......@@ -47,6 +47,12 @@ class BooksCreateView(CreateView):
class BooksCreateView(UpdateView):
model = Books
fields = '__all__'
# template to be used by default is called <model>_form.html
template_name = 'bookshelf/edit-book.html'
success_url = "../details/"
# def update(self, request, *args, **kwargs):
# form = BookForm(request.POST)
# if form.is_valid():
# self.model.get_absolute_url()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment