Commit c1b179a7 authored by Eldon Dagdag's avatar Eldon Dagdag

Created html files, updated README, views and urls

parent 7f37c0b3
Eldon Dagdag, 211764, CS40-E
Lab 03: My Favorite Books and Authors
March 28, 2023
Lab 04: My Favorite Books and Authors v2
April 25, 2023
This lab was truthfully completed by me
<sgd> Eldon Dagdag, March 28, 2023
\ No newline at end of file
<sgd> Eldon Dagdag, April 25, 2023
\ No newline at end of file
{% extends 'base.html' %}
{% load static %}
{% block title %} {{ object.first_name }} {{ object.last_name }}{% endblock %}
{% block content %}
\ No newline at end of file
{% extends 'base.html' %}
{% load static %}
{% block title %} {{ object.first_name }} {{ object.last_name }}{% endblock %}
{% block content %}
\ No newline at end of file
{% extends 'base.html' %}
{% load static %}
{% block title %} {{ object.first_name }} {{ object.last_name }}{% endblock %}
{% block content %}
\ No newline at end of file
{% extends 'base.html' %}
{% load static %}
{% block title %} {{ object.first_name }} {{ object.last_name }}{% endblock %}
{% block content %}
\ No newline at end of file
......@@ -8,5 +8,8 @@
<div class="container space-evenly">
<a href="/bookshelf/books/">Books</a>
<a href="/bookshelf/authors/">Authors</a>
<br>
<a href="/bookshelf/books/add/">Add Book</a>
<a href="/bookshelf/authors/add/">Add Author</a>
</div>
{% endblock %}
\ No newline at end of file
from django.urls import path
from .views import index_view, home, BookListView, BookDetailView, AuthorListView, AuthorDetailView
from .views import index_view, home, BookListView, BookDetailView, BookAddView, BookUpdateView, AuthorListView, AuthorDetailView, AuthorAddView, AuthorUpdateView
urlpatterns = [
path('home/', home, name='home'),
path('books/', BookListView.as_view(), name='books'),
path('books/add/', BookAddView.as_view(), name='add-book'),
path('books/<int:pk>/edit/', BookUpdateView.as_view(), name='edit-book'),
path('books/<int:pk>/details/', BookDetailView.as_view(), name='book-details'),
path('authors/', AuthorListView.as_view(), name='authors'),
path('authors/add/', AuthorAddView.as_view(), name='add-author'),
path('authors/<int:pk>/edit/', AuthorUpdateView.as_view(), name='edit-book'),
path('authors/<int:pk>/details/', AuthorDetailView.as_view(), name='author-details'),
path('', index_view, name='index'),
]
......
from django.shortcuts import render
from django.http import HttpResponse
from django.views import View
from django.views.generic import ListView, DetailView
from django.views.generic import ListView, DetailView, CreateView, UpdateView
from .models import Author, Book
......@@ -19,10 +19,30 @@ class BookDetailView(DetailView):
model = Book
template_name = 'bookshelf/book_details.html'
class BookAddView(CreateView):
model = Book
fields = '__all__'
template_name = 'bookshelf/add-book.html'
class BookUpdateView(UpdateView):
model = Book
fields = '__all__'
template_name = 'bookshelf/edit-book.html'
class AuthorListView(ListView):
model = Author
template_name = 'bookshelf/authors.html'
class AuthorDetailView(DetailView):
model = Author
template_name = 'bookshelf/author_details.html'
\ No newline at end of file
template_name = 'bookshelf/author_details.html'
class AuthorAddView(CreateView):
model = Author
fields = '__all__'
template_name = 'bookshelf/add-author.html'
class AuthorUpdateView(UpdateView):
model = Author
fields = '__all__'
template_name = 'bookshelf/edit-author.html'
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