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>
<!-- Favicon-->
<link rel="icon" type="image/x-icon" href="{% static 'assets/favicon.ico' %}" />
<!-- Bootstrap icons-->
<link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.5.0/font/bootstrap-icons.css" rel="stylesheet" type="text/css" />
<!-- Google fonts-->
<link href="https://fonts.googleapis.com/css?family=Lato:300,400,700,300italic,400italic,700italic" rel="stylesheet" type="text/css" />
<!-- Core theme CSS (includes Bootstrap)-->
<link href="{% static 'css/styles.css' %}" rel="stylesheet" />
</head> </head>
<body> <body>
<!-- Navigation--> <header class="p-3 text-bg-dark">
<nav class="navbar navbar-light bg-light static-top">
<div class="container"> <div class="container">
<a class="navbar-brand" href="#!">Manage My Bills!</a> <div class="d-flex flex-wrap align-items-center justify-content-center justify-content-lg-start">
<a class="btn btn-primary" href="#signup">Sign Up</a> <a href="/" class="d-flex align-items-center mb-2 mb-lg-0 text-white text-decoration-none">
</div> <svg class="bi me-2" width="40" height="32" role="img" aria-label="Bootstrap"><use xlink:href="#bootstrap"></use></svg>
<div><a class="btn btn-secondary" href="{% url 'bills:create' %}">Log In</a> </a>
</div>
</nav> <ul class="nav col-12 col-lg-auto me-lg-auto mb-2 justify-content-center mb-md-0">
<!-- Masthead--> <li><a href="#" class="nav-link px-2 text-secondary">Home</a></li>
<header class="masthead"> <li><a href="#" class="nav-link px-2 text-white">Features</a></li>
<div class="container position-relative"> <li><a href="#" class="nav-link px-2 text-white">Pricing</a></li>
<div class="row justify-content-center"> <li><a href="#" class="nav-link px-2 text-white">FAQs</a></li>
<div class="col-xl-6"> <li><a href="#" class="nav-link px-2 text-white">About</a></li>
<div class="text-center text-white"> </ul>
<!-- Page heading-->
<h1 class="mb-5">Generate more leads with a professional landing page!</h1> <form class="col-12 col-lg-auto mb-3 mb-lg-0 me-lg-3" role="search">
<!-- Signup form--> <input type="search" class="form-control form-control-dark text-bg-dark" placeholder="Search..." aria-label="Search">
<!-- * * * * * * * * * * * * * * *-->
<!-- * * 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="contactForm" data-sb-form-api-token="API_TOKEN">
<!-- Email address input-->
<div class="row">
<div class="col">
<input class="form-control form-control-lg" id="emailAddress" type="email" placeholder="Email Address" data-sb-validations="required,email" />
<div class="invalid-feedback text-white" data-sb-feedback="emailAddress:required">Email Address is required.</div>
<div class="invalid-feedback text-white" data-sb-feedback="emailAddress: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> </form>
</div>
<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> </div>
</div> </div>
</header> </header>
<!-- Icons Grid--> <script src="{% static 'js/bootstrap.bundle.min.js' %}" crossorigin="anonymous"></script>
<section class="features-icons bg-light text-center"> <!-- end header -->
<div class="container"> <div class="col-lg-8 mx-auto p-4 py-md-5">
<div class="row"> <!-- main -->
<div class="col-lg-4"> <main>
<div class="features-icons-item mx-auto mb-5 mb-lg-0 mb-lg-3"> <h1>Bills</h1>
<div class="features-icons-icon d-flex"><i class="bi-window m-auto text-primary"></i></div> <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>
<h3>Fully Responsive</h3>
<p class="lead mb-0">This theme will look great on any device, no matter the size!</p> <div class="mb-5">
<a href="#" class="btn btn-primary btn-lg px-4">Sign-up!</a>
</div> </div>
</div>
<div class="col-lg-4"> <hr class="col-3 col-md-2 mb-5">
<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> <div class="row g-5">
<h3>Bootstrap 5 Ready</h3> <div class="col-md-6">
<p class="lead mb-0">Featuring the latest build of the new Bootstrap 5 framework!</p> <h2>Starter projects</h2>
</div> <p>Ready to beyond the starter template? Check out these open source projects that you can quickly duplicate to a new GitHub repository.</p>
</div> <ul class="icon-list ps-0">
<div class="col-lg-4"> <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>
<div class="features-icons-item mx-auto mb-0 mb-lg-3"> <li class="text-muted d-flex align-items-start mb-1">Bootstrap Parcel starter (coming soon!)</li>
<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> </ul>
<p class="text-muted small mb-4 mb-lg-0">&copy; Your Website 2023. All Rights Reserved.</p>
</div> </div>
<div class="col-lg-6 h-100 text-center text-lg-end my-auto">
<ul class="list-inline mb-0"> <div class="col-md-6">
<li class="list-inline-item me-4"> <h2>Guides</h2>
<a href="#!"><i class="bi-facebook fs-3"></i></a> <p>Read more detailed instructions and documentation on using or contributing to Bootstrap.</p>
</li> <ul class="icon-list ps-0">
<li class="list-inline-item me-4"> <li class="d-flex align-items-start mb-1"><a href="../getting-started/introduction/">Bootstrap quick start guide</a></li>
<a href="#!"><i class="bi-twitter fs-3"></i></a> <li class="d-flex align-items-start mb-1"><a href="../getting-started/webpack/">Bootstrap Webpack guide</a></li>
</li> <li class="d-flex align-items-start mb-1"><a href="../getting-started/parcel/">Bootstrap Parcel guide</a></li>
<li class="list-inline-item"> <li class="d-flex align-items-start mb-1"><a href="../getting-started/vite/">Bootstrap Vite guide</a></li>
<a href="#!"><i class="bi-instagram fs-3"></i></a> <li class="d-flex align-items-start mb-1"><a href="../getting-started/contribute/">Contributing to Bootstrap</a></li>
</li>
</ul> </ul>
</div> </div>
</div> </div>
</main>
<!-- end main -->
</div> </div>
<!-- footer -->
<div class="container">
<footer class="d-flex flex-wrap justify-content-between align-items-center py-3 my-4 border-top">
<p class="col-md-4 mb-0 text-muted">© 2022 Automated Bytes Inc.</p>
<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">
<svg class="bi me-2" width="40" height="32"><use xlink:href="#bootstrap"></use></svg>
</a>
<ul class="nav col-md-4 justify-content-end">
<li class="nav-item"><a href="#" class="nav-link px-2 text-muted">Home</a></li>
<li class="nav-item"><a href="#" class="nav-link px-2 text-muted">Features</a></li>
<li class="nav-item"><a href="#" class="nav-link px-2 text-muted">Pricing</a></li>
<li class="nav-item"><a href="#" class="nav-link px-2 text-muted">FAQs</a></li>
<li class="nav-item"><a href="#" class="nav-link px-2 text-muted">About</a></li>
</ul>
</footer> </footer>
<!-- Bootstrap core JS--> </div>
<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> </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):
if request.user.is_authenticated:
bills_list = Bill.objects.order_by('-due') bills_list = Bill.objects.order_by('-due')
# bills_list = get_list_or_404(Bill) # bills_list = get_list_or_404(Bill)
template = loader.get_template('bills/index.html') template = loader.get_template('bills/index.html')
context = {'bills_list': bills_list, } context = {'bills_list': bills_list, }
print(bills_list) print(bills_list)
return HttpResponse(template.render(context, request)) 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)