Commit c131634b authored by Washington99's avatar Washington99

Final Touch ups

Added More css to the webpages. Removed unnecessary comments in code.
parent 4c57678c
body{ body{
background-color: red background-color: orange
} }
#additional{ a{
padding: 10px; font-color: red;
background-color: whitesmoke;
font-family: Verdana, Geneva, Tahoma, sans-serif;
box-shadow: 0px 2px 10px 0px rgb(80, 37, 21);
margin-left: 10%;
margin-right: 10%;
text-align: center;
border-style: double;
border-radius: 5px;
border-color: rgb(117, 54, 31);
border-width: 10px;
}
div.content{
padding: 10px;
background-color: whitesmoke;
font-family: Verdana, Geneva, Tahoma, sans-serif;
box-shadow: 50px;
margin-left: 20%;
margin-right: 20%;
text-align: center;
border-style: solid;
border-radius: 5px;
border-color: rgb(117, 54, 31);
border-width: 2px;
padding-bottom: 20px;
}
a.navBtn{
padding: 10px;
border-radius: 5px;
border-color: rgb(117, 54, 31);
border-width: 2px;
border-style: groove;
} }
input[type=submit]{ input[type=submit]{
background-color: rgb(58, 24, 2); background-color: yellow;
} }
\ No newline at end of file
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en">
<head> {% extends 'base.html' %}
<meta charset="UTF-8"> {% load static %}
<title>Add New Author</title>
</head> {% block title %}Add New Author{% endblock %}
<body>
{% block content %}
{{ form.non_field_errors }} {{ form.non_field_errors }}
{% for field in form %} {% for field in form %}
{% if field.errors %} {% if field.errors %}
...@@ -18,8 +20,8 @@ ...@@ -18,8 +20,8 @@
{% endfor %} {% endfor %}
<form method="post"> <form method="post">
{% csrf_token %} {% csrf_token %}
{{ form }} {{ form.as_p }}
<input type="submit" value="Add Author"> <input type="submit" value="Add Author">
</form> </form>
</body>
</html> {% endblock %}
\ No newline at end of file
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en">
<head> {% extends 'base.html' %}
<meta charset="UTF-8"> {% load static %}
<title>Add New Book</title>
</head> {% block title %}Add New Book{% endblock %}
<body>
{% block content %}
{{ form.non_field_errors }} {{ form.non_field_errors }}
{% for field in form %} {% for field in form %}
{% if field.errors %} {% if field.errors %}
...@@ -18,8 +19,7 @@ ...@@ -18,8 +19,7 @@
{% endfor %} {% endfor %}
<form method="post"> <form method="post">
{% csrf_token %} {% csrf_token %}
{{ form }} {{ form.as_p }}
<input type="submit" value="Add Book"> <input type="submit" value="Add Book">
</form> </form>
</body> {% endblock %}
</html> \ No newline at end of file
\ No newline at end of file
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en">
<head> {% extends 'base.html' %}
<meta charset="UTF-8"> {% load static %}
<title>Edit Author</title>
</head> {% block title %}Edit Author{% endblock %}
<body>
{% block content %}
{{ form.non_field_errors }} {{ form.non_field_errors }}
{% for field in form %} {% for field in form %}
{% if field.errors %} {% if field.errors %}
...@@ -18,8 +19,7 @@ ...@@ -18,8 +19,7 @@
{% endfor %} {% endfor %}
<form method="post"> <form method="post">
{% csrf_token %} {% csrf_token %}
{{ form }} {{ form.as_p }}
<input type="submit" value="Save Changes"> <input type="submit" value="Save Changes">
</form> </form>
</body> {% endblock %}
</html> \ No newline at end of file
\ No newline at end of file
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en">
<head> {% extends 'base.html' %}
<meta charset="UTF-8"> {% load static %}
<title>Edit Book</title>
</head> {% block title %}Edit Author{% endblock %}
<body>
{% block content %}
{{ form.non_field_errors }} {{ form.non_field_errors }}
{% for field in form %} {% for field in form %}
{% if field.errors %} {% if field.errors %}
...@@ -18,8 +19,17 @@ ...@@ -18,8 +19,17 @@
{% endfor %} {% endfor %}
<form method="post"> <form method="post">
{% csrf_token %} {% csrf_token %}
{{ form }} {{ form.as_p }}
<input type="submit" value="Save Changes"> <input type="submit" value="Save Changes">
</form> </form>
{% endblock %}
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Edit Book</title>
</head>
<body>
</body> </body>
</html> </html>
\ No newline at end of file
...@@ -30,17 +30,16 @@ class BookView(DetailView): ...@@ -30,17 +30,16 @@ class BookView(DetailView):
class AuthorCreateView(CreateView): class AuthorCreateView(CreateView):
model = Author model = Author
form = AuthorForm # Can be removed? form = AuthorForm
fields = '__all__' fields = '__all__'
template_name = 'bookshelf/add-author.html' template_name = 'bookshelf/add-author.html'
def post(self, request, *args, **kwargs): def post(self, request, *args, **kwargs):
form = AuthorForm(request.POST) # Create a Form object from the POST values form = AuthorForm(request.POST)
if form.is_valid(): if form.is_valid():
new_author = form.save() new_author = form.save()
redirect_link = "../" + new_author.get_absolute_url() + "/details/" redirect_link = "../" + new_author.get_absolute_url() + "/details/"
return HttpResponseRedirect(redirect_link) return HttpResponseRedirect(redirect_link)
# return self.get(request, *args, **kwargs)
else: else:
return render(request, self.template_name, {'form': form}) return render(request, self.template_name, {'form': form})
...@@ -53,17 +52,16 @@ class AuthorEditView(UpdateView): ...@@ -53,17 +52,16 @@ class AuthorEditView(UpdateView):
class BooksCreateView(CreateView): class BooksCreateView(CreateView):
model = Books model = Books
form = BookForm # Can be removed? form = BookForm
fields = '__all__' fields = '__all__'
template_name = 'bookshelf/add-book.html' template_name = 'bookshelf/add-book.html'
def post(self, request, *args, **kwargs): def post(self, request, *args, **kwargs):
form = BookForm(request.POST) # Create a Form object from the POST values form = BookForm(request.POST)
if form.is_valid(): if form.is_valid():
new_book = form.save() new_book = form.save()
redirect_link = "../" + new_book.get_absolute_url() + "/details/" redirect_link = "../" + new_book.get_absolute_url() + "/details/"
return HttpResponseRedirect(redirect_link) return HttpResponseRedirect(redirect_link)
# return self.get(request, *args, **kwargs)
else: else:
return render(request, self.template_name, {'form': form}) return render(request, self.template_name, {'form': form})
...@@ -74,8 +72,3 @@ class BooksEditView(UpdateView): ...@@ -74,8 +72,3 @@ class BooksEditView(UpdateView):
success_url = "../details/" 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