Commit ce6e779b authored by RJC's avatar RJC

added book update view

parent 91047623
...@@ -34,6 +34,16 @@ class BookDetailView(generic.DetailView): ...@@ -34,6 +34,16 @@ class BookDetailView(generic.DetailView):
context_object_name = 'books' context_object_name = 'books'
class BookUpdateView(generic.UpdateView):
model = Books
fields = '__all__'
template_name = 'bookshelf/edit-book.html'
def get_success_url(self):
return reverse('bookshelf:bookdetailview', kwargs={'pk': self.object.id},
current_app=self.request.resolver_match.namespace)
class AuthorListView(generic.ListView): class AuthorListView(generic.ListView):
model = Author model = Author
template_name = 'bookshelf/authors.html' template_name = 'bookshelf/authors.html'
...@@ -47,7 +57,7 @@ class AuthorCreateView(generic.CreateView): ...@@ -47,7 +57,7 @@ class AuthorCreateView(generic.CreateView):
template_name = 'bookshelf/add-author.html' template_name = 'bookshelf/add-author.html'
def get_success_url(self): def get_success_url(self):
return reverse('bookshelf:authordetailview', kwargs={'pk': self.object.id}, return reverse('bookshelf:bookdetailview', kwargs={'pk': self.object.id},
current_app=self.request.resolver_match.namespace) current_app=self.request.resolver_match.namespace)
......
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