Commit b26b8fa9 authored by Alvin Joshua Andrada's avatar Alvin Joshua Andrada

modified buttons

parent 56720e64
# forms bookshelf
from django import forms
from .models import Author, Books
class BookForm(forms.ModelForm):
class Meta:
model = Book
fields = ['title', 'author', 'publisher','year_published','ISBN','blurb']
class AuthorForm(forms.ModelForm):
class Meta:
model = Author
fields = ['first_name', 'last_name', 'age','nationality','bio']
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
<h4>{{ author.nationality }}</h4> <h4>{{ author.nationality }}</h4>
<h4>{{ author.bio }}</h4> <h4>{{ author.bio }}</h4>
<button href="{% url 'bookshelf:edit-author' object.id %}">Edit Author</button> <br> <button><a href="{% url 'bookshelf:edit-author' author.id %}">Edit Author</a></button> <br>
<h4>Books by {{ author.first_name }} {{ author.last_name }} I love:</h4> <h4>Books by {{ author.first_name }} {{ author.last_name }} I love:</h4>
<ul> <ul>
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
<h3>{{ object.year_published }}</h3> <h3>{{ object.year_published }}</h3>
<h3>{{ object.ISBN }}</h3> <h3>{{ object.ISBN }}</h3>
<h3>{{ object.blurb }}</h3> <h3>{{ object.blurb }}</h3>
<button href="{% url 'bookshelf:edit-book' object.id %}">Edit Book</button> <br> <button><a href="{% url 'bookshelf:edit-book' object.id %}">Edit Book</a></button> <br>
<a href="/home/">Home</a> <a href="/home/">Home</a>
<a href="/home/books/">Books</a> <a href="/home/books/">Books</a>
<a href="/home/authors/">Authors</a> <a href="/home/authors/">Authors</a>
......
<!-- edit-author html --> <!-- edit-author html -->
{% extends 'base.html' %} {% extends 'base.html' %}
{% load static %} {% load static %}
{% block title %}Add New Book{% endblock %} {% block title %}Add New Author{% endblock %}
{% block content %} {% block content %}
{{ form.non_field_errors }} {{ form.non_field_errors }}
......
...@@ -53,7 +53,7 @@ class AuthorCreateView(CreateView): ...@@ -53,7 +53,7 @@ class AuthorCreateView(CreateView):
return reverse('bookshelf:author-detail', kwargs={'author_id': self.object.pk}) return reverse('bookshelf:author-detail', kwargs={'author_id': self.object.pk})
class AuthorUpdateView(UpdateView): class AuthorUpdateView(UpdateView):
model = Books model = Author
fields = '__all__' fields = '__all__'
template_name = 'bookshelf/edit-author.html' template_name = 'bookshelf/edit-author.html'
def get_success_url(self): def get_success_url(self):
......
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