Add templates!

This commit is contained in:
ahosking 2023-05-06 11:23:21 -04:00
parent 1edd0892af
commit 24cdebe960
4 changed files with 115 additions and 252 deletions

View File

@ -183,6 +183,5 @@ JET_INDEX_DASHBOARD = 'dashboard.CustomIndexDashboard'
STATICFILES_DIRS = [ STATICFILES_DIRS = [
BASE_DIR / "api/static", BASE_DIR / "api/static",
("assets", BASE_DIR / "assets"), ("assets", BASE_DIR / "api/static/assets"),
"[os.path.join(BASE_DIR, 'static')",
] ]

View File

@ -1,248 +1,100 @@
{% load static %} {% load static %}
<!DOCTYPE html> <!doctype html>
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="utf-8" /> <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" /> <meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="" /> <title>Bootstrap demo</title>
<meta name="author" content="" /> <link href="{% static 'css/bootstrap.min.css' %}" rel="stylesheet" />
<title>Manage My Bills</title> </head>
<!-- Favicon--> <body>
<link rel="icon" type="image/x-icon" href="{% static 'assets/favicon.ico' %}" /> <header class="p-3 text-bg-dark">
<!-- Bootstrap icons--> <div class="container">
<link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.5.0/font/bootstrap-icons.css" rel="stylesheet" type="text/css" /> <div class="d-flex flex-wrap align-items-center justify-content-center justify-content-lg-start">
<!-- Google fonts--> <a href="/" class="d-flex align-items-center mb-2 mb-lg-0 text-white text-decoration-none">
<link href="https://fonts.googleapis.com/css?family=Lato:300,400,700,300italic,400italic,700italic" rel="stylesheet" type="text/css" /> <svg class="bi me-2" width="40" height="32" role="img" aria-label="Bootstrap"><use xlink:href="#bootstrap"></use></svg>
<!-- Core theme CSS (includes Bootstrap)--> </a>
<link href="{% static 'css/styles.css' %}" rel="stylesheet" />
</head> <ul class="nav col-12 col-lg-auto me-lg-auto mb-2 justify-content-center mb-md-0">
<body> <li><a href="#" class="nav-link px-2 text-secondary">Home</a></li>
<!-- Navigation--> <li><a href="#" class="nav-link px-2 text-white">Features</a></li>
<nav class="navbar navbar-light bg-light static-top"> <li><a href="#" class="nav-link px-2 text-white">Pricing</a></li>
<div class="container"> <li><a href="#" class="nav-link px-2 text-white">FAQs</a></li>
<a class="navbar-brand" href="#!">Manage My Bills!</a> <li><a href="#" class="nav-link px-2 text-white">About</a></li>
<a class="btn btn-primary" href="#signup">Sign Up</a> </ul>
<form class="col-12 col-lg-auto mb-3 mb-lg-0 me-lg-3" role="search">
<input type="search" class="form-control form-control-dark text-bg-dark" placeholder="Search..." aria-label="Search">
</form>
<div class="text-end">
<button type="button" class="btn btn-outline-light me-2">Login</button>
<button type="button" class="btn btn-warning">Sign-up</button>
</div> </div>
<div><a class="btn btn-secondary" href="{% url 'bills:create' %}">Log In</a> </div>
</div> </div>
</header>
<script src="{% static 'js/bootstrap.bundle.min.js' %}" crossorigin="anonymous"></script>
<!-- end header -->
<div class="col-lg-8 mx-auto p-4 py-md-5">
<!-- main -->
<main>
<h1>Bills</h1>
<p class="fs-5 col-md-8">Quickly and easily start adding your bills and service costs to get a better understanding of your operational expenses.</p>
</nav> <div class="mb-5">
<!-- Masthead--> <a href="#" class="btn btn-primary btn-lg px-4">Sign-up!</a>
<header class="masthead"> </div>
<div class="container position-relative">
<div class="row justify-content-center"> <hr class="col-3 col-md-2 mb-5">
<div class="col-xl-6">
<div class="text-center text-white"> <div class="row g-5">
<!-- Page heading--> <div class="col-md-6">
<h1 class="mb-5">Generate more leads with a professional landing page!</h1> <h2>Starter projects</h2>
<!-- Signup form--> <p>Ready to beyond the starter template? Check out these open source projects that you can quickly duplicate to a new GitHub repository.</p>
<!-- * * * * * * * * * * * * * * *--> <ul class="icon-list ps-0">
<!-- * * SB Forms Contact Form * *--> <li class="d-flex align-items-start mb-1"><a href="https://github.com/twbs/bootstrap-npm-starter" rel="noopener" target="_blank">Bootstrap npm starter</a></li>
<!-- * * * * * * * * * * * * * * *--> <li class="text-muted d-flex align-items-start mb-1">Bootstrap Parcel starter (coming soon!)</li>
<!-- This form is pre-integrated with SB Forms.--> </ul>
<!-- To make this form functional, sign up at--> </div>
<!-- https://startbootstrap.com/solution/contact-forms-->
<!-- to get an API token!--> <div class="col-md-6">
<form class="form-subscribe" id="contactForm" data-sb-form-api-token="API_TOKEN"> <h2>Guides</h2>
<!-- Email address input--> <p>Read more detailed instructions and documentation on using or contributing to Bootstrap.</p>
<div class="row"> <ul class="icon-list ps-0">
<div class="col"> <li class="d-flex align-items-start mb-1"><a href="../getting-started/introduction/">Bootstrap quick start guide</a></li>
<input class="form-control form-control-lg" id="emailAddress" type="email" placeholder="Email Address" data-sb-validations="required,email" /> <li class="d-flex align-items-start mb-1"><a href="../getting-started/webpack/">Bootstrap Webpack guide</a></li>
<div class="invalid-feedback text-white" data-sb-feedback="emailAddress:required">Email Address is required.</div> <li class="d-flex align-items-start mb-1"><a href="../getting-started/parcel/">Bootstrap Parcel guide</a></li>
<div class="invalid-feedback text-white" data-sb-feedback="emailAddress:email">Email Address Email is not valid.</div> <li class="d-flex align-items-start mb-1"><a href="../getting-started/vite/">Bootstrap Vite guide</a></li>
</div> <li class="d-flex align-items-start mb-1"><a href="../getting-started/contribute/">Contributing to Bootstrap</a></li>
<div class="col-auto"><button class="btn btn-primary btn-lg disabled" id="submitButton" type="submit">Submit</button></div> </ul>
</div> </div>
<!-- Submit success message--> </div>
<!----> </main>
<!-- This is what your users will see when the form--> <!-- end main -->
<!-- has successfully submitted--> </div>
<div class="d-none" id="submitSuccessMessage">
<div class="text-center mb-3">
<div class="fw-bolder">Form submission successful!</div>
<p>To activate this form, sign up at</p> <!-- footer -->
<a class="text-white" href="https://startbootstrap.com/solution/contact-forms">https://startbootstrap.com/solution/contact-forms</a> <div class="container">
</div> <footer class="d-flex flex-wrap justify-content-between align-items-center py-3 my-4 border-top">
</div> <p class="col-md-4 mb-0 text-muted">© 2022 Automated Bytes Inc.</p>
<!-- Submit error message-->
<!----> <a href="/" class="col-md-4 d-flex align-items-center justify-content-center mb-3 mb-md-0 me-md-auto link-dark text-decoration-none">
<!-- This is what your users will see when there is--> <svg class="bi me-2" width="40" height="32"><use xlink:href="#bootstrap"></use></svg>
<!-- an error submitting the form--> </a>
<div class="d-none" id="submitErrorMessage"><div class="text-center text-danger mb-3">Error sending message!</div></div>
</form> <ul class="nav col-md-4 justify-content-end">
</div> <li class="nav-item"><a href="#" class="nav-link px-2 text-muted">Home</a></li>
</div> <li class="nav-item"><a href="#" class="nav-link px-2 text-muted">Features</a></li>
</div> <li class="nav-item"><a href="#" class="nav-link px-2 text-muted">Pricing</a></li>
</div> <li class="nav-item"><a href="#" class="nav-link px-2 text-muted">FAQs</a></li>
</header> <li class="nav-item"><a href="#" class="nav-link px-2 text-muted">About</a></li>
<!-- Icons Grid--> </ul>
<section class="features-icons bg-light text-center"> </footer>
<div class="container"> </div>
<div class="row">
<div class="col-lg-4"> </body>
<div class="features-icons-item mx-auto mb-5 mb-lg-0 mb-lg-3">
<div class="features-icons-icon d-flex"><i class="bi-window m-auto text-primary"></i></div>
<h3>Fully Responsive</h3>
<p class="lead mb-0">This theme will look great on any device, no matter the size!</p>
</div>
</div>
<div class="col-lg-4">
<div class="features-icons-item mx-auto mb-5 mb-lg-0 mb-lg-3">
<div class="features-icons-icon d-flex"><i class="bi-layers m-auto text-primary"></i></div>
<h3>Bootstrap 5 Ready</h3>
<p class="lead mb-0">Featuring the latest build of the new Bootstrap 5 framework!</p>
</div>
</div>
<div class="col-lg-4">
<div class="features-icons-item mx-auto mb-0 mb-lg-3">
<div class="features-icons-icon d-flex"><i class="bi-terminal m-auto text-primary"></i></div>
<h3>Easy to Use</h3>
<p class="lead mb-0">Ready to use with your own content, or customize the source files!</p>
</div>
</div>
</div>
</div>
</section>
<!-- Image Showcases-->
<section class="showcase">
<div class="container-fluid p-0">
<div class="row g-0">
<div class="col-lg-6 order-lg-2 text-white showcase-img" style="background-image: url('{% static "assets/img/bg-showcase-1.jpg" %}')"></div>
<div class="col-lg-6 order-lg-1 my-auto showcase-text">
<h2>Fully Responsive Design</h2>
<p class="lead mb-0">When you use a theme created by Start Bootstrap, you know that the theme will look great on any device, whether it's a phone, tablet, or desktop the page will behave responsively!</p>
</div>
</div>
<div class="row g-0">
<div class="col-lg-6 text-white showcase-img" style="background-image: url('{% static "assets/img/bg-showcase-2.jpg" %}')"></div>
<div class="col-lg-6 my-auto showcase-text">
<h2>Updated For Bootstrap 5</h2>
<p class="lead mb-0">Newly improved, and full of great utility classes, Bootstrap 5 is leading the way in mobile responsive web development! All of the themes on Start Bootstrap are now using Bootstrap 5!</p>
</div>
</div>
<div class="row g-0">
<div class="col-lg-6 order-lg-2 text-white showcase-img" style="background-image: url('{% static "assets/img/bg-showcase-3.jpg" %}')"></div>
<div class="col-lg-6 order-lg-1 my-auto showcase-text">
<h2>Easy to Use & Customize</h2>
<p class="lead mb-0">Landing Page is just HTML and CSS with a splash of SCSS for users who demand some deeper customization options. Out of the box, just add your content and images, and your new landing page will be ready to go!</p>
</div>
</div>
</div>
</section>
<!-- Testimonials-->
<section class="testimonials text-center bg-light">
<div class="container">
<h2 class="mb-5">What people are saying...</h2>
<div class="row">
<div class="col-lg-4">
<div class="testimonial-item mx-auto mb-5 mb-lg-0">
<img class="img-fluid rounded-circle mb-3" src="{% static 'assets/img/testimonials-1.jpg' %}" alt="..." />
<h5>Margaret E.</h5>
<p class="font-weight-light mb-0">"This is fantastic! Thanks so much guys!"</p>
</div>
</div>
<div class="col-lg-4">
<div class="testimonial-item mx-auto mb-5 mb-lg-0">
<img class="img-fluid rounded-circle mb-3" src="{% static 'assets/img/testimonials-2.jpg' %}" alt="..." />
<h5>Fred S.</h5>
<p class="font-weight-light mb-0">"Bootstrap is amazing. I've been using it to create lots of super nice landing pages."</p>
</div>
</div>
<div class="col-lg-4">
<div class="testimonial-item mx-auto mb-5 mb-lg-0">
<img class="img-fluid rounded-circle mb-3" src="{% static 'assets/img/testimonials-3.jpg' %}" alt="..." />
<h5>Sarah W.</h5>
<p class="font-weight-light mb-0">"Thanks so much for making these free resources available to us!"</p>
</div>
</div>
</div>
</div>
</section>
<!-- Call to Action-->
<section class="call-to-action text-white text-center" id="signup">
<div class="container position-relative">
<div class="row justify-content-center">
<div class="col-xl-6">
<h2 class="mb-4">Ready to get started? Sign up now!</h2>
<!-- Signup form-->
<!-- * * * * * * * * * * * * * * *-->
<!-- * * SB Forms Contact Form * *-->
<!-- * * * * * * * * * * * * * * *-->
<!-- This form is pre-integrated with SB Forms.-->
<!-- To make this form functional, sign up at-->
<!-- https://startbootstrap.com/solution/contact-forms-->
<!-- to get an API token!-->
<form class="form-subscribe" id="contactFormFooter" data-sb-form-api-token="API_TOKEN">
<!-- Email address input-->
<div class="row">
<div class="col">
<input class="form-control form-control-lg" id="emailAddressBelow" type="email" placeholder="Email Address" data-sb-validations="required,email" />
<div class="invalid-feedback text-white" data-sb-feedback="emailAddressBelow:required">Email Address is required.</div>
<div class="invalid-feedback text-white" data-sb-feedback="emailAddressBelow:email">Email Address Email is not valid.</div>
</div>
<div class="col-auto"><button class="btn btn-primary btn-lg disabled" id="submitButton" type="submit">Submit</button></div>
</div>
<!-- Submit success message-->
<!---->
<!-- This is what your users will see when the form-->
<!-- has successfully submitted-->
<div class="d-none" id="submitSuccessMessage">
<div class="text-center mb-3">
<div class="fw-bolder">Form submission successful!</div>
<p>To activate this form, sign up at</p>
<a class="text-white" href="https://startbootstrap.com/solution/contact-forms">https://startbootstrap.com/solution/contact-forms</a>
</div>
</div>
<!-- Submit error message-->
<!---->
<!-- This is what your users will see when there is-->
<!-- an error submitting the form-->
<div class="d-none" id="submitErrorMessage"><div class="text-center text-danger mb-3">Error sending message!</div></div>
</form>
</div>
</div>
</div>
</section>
<!-- Footer-->
<footer class="footer bg-light">
<div class="container">
<div class="row">
<div class="col-lg-6 h-100 text-center text-lg-start my-auto">
<ul class="list-inline mb-2">
<li class="list-inline-item"><a href="#!">About</a></li>
<li class="list-inline-item"></li>
<li class="list-inline-item"><a href="#!">Contact</a></li>
<li class="list-inline-item"></li>
<li class="list-inline-item"><a href="#!">Terms of Use</a></li>
<li class="list-inline-item"></li>
<li class="list-inline-item"><a href="#!">Privacy Policy</a></li>
</ul>
<p class="text-muted small mb-4 mb-lg-0">&copy; Your Website 2023. All Rights Reserved.</p>
</div>
<div class="col-lg-6 h-100 text-center text-lg-end my-auto">
<ul class="list-inline mb-0">
<li class="list-inline-item me-4">
<a href="#!"><i class="bi-facebook fs-3"></i></a>
</li>
<li class="list-inline-item me-4">
<a href="#!"><i class="bi-twitter fs-3"></i></a>
</li>
<li class="list-inline-item">
<a href="#!"><i class="bi-instagram fs-3"></i></a>
</li>
</ul>
</div>
</div>
</div>
</footer>
<!-- Bootstrap core JS-->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/js/bootstrap.bundle.min.js"></script>
<!-- Core theme JS-->
<script src="{% static 'js/scripts.js' %}"></script>
<!-- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *-->
<!-- * * SB Forms JS * *-->
<!-- * * Activate your form at https://startbootstrap.com/solution/contact-forms * *-->
<!-- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *-->
<script src="https://cdn.startbootstrap.com/sb-forms-latest.js"></script>
</body>
</html> </html>

View File

@ -1,5 +1,7 @@
from django.contrib.auth import logout
from django.http import HttpResponse from django.http import HttpResponse
from django.template import loader from django.template import loader
from django.shortcuts import redirect
def index(request): def index(request):
@ -7,3 +9,8 @@ def index(request):
template = loader.get_template('index.html') template = loader.get_template('index.html')
context = {} context = {}
return HttpResponse(template.render(context, request)) return HttpResponse(template.render(context, request))
def logout(request):
logout(request)
redirect(index)

View File

@ -1,18 +1,23 @@
# from django.shortcuts import render # from django.shortcuts import render
from django.contrib.auth import authenticate, login
from django.http import HttpResponse, Http404 from django.http import HttpResponse, Http404
from django.template import loader from django.template import loader
from django.shortcuts import render, get_object_or_404, get_list_or_404 from django.shortcuts import render, get_object_or_404, get_list_or_404, redirect
from .models import Bill from .models import Bill
def index(request): def index(request):
bills_list = Bill.objects.order_by('-due') if request.user.is_authenticated:
# bills_list = get_list_or_404(Bill) bills_list = Bill.objects.order_by('-due')
template = loader.get_template('bills/index.html') # bills_list = get_list_or_404(Bill)
context = {'bills_list': bills_list, } template = loader.get_template('bills/index.html')
print(bills_list) context = {'bills_list': bills_list, }
return HttpResponse(template.render(context, request)) print(bills_list)
return HttpResponse(template.render(context, request))
else:
# return redirect(api.index)
return render(request, "index.html")
# return render(request, 'bills/index.html', context) # return render(request, 'bills/index.html', context)