Compare commits

..

No commits in common. "f9f7f624b1b5e721a3b0375015f6a01c1b94b8c2" and "24cdebe96062150a3a15c5c0afe6d70465f7c3d3" have entirely different histories.

9 changed files with 10 additions and 143 deletions

View File

@ -1,9 +0,0 @@
# accounts/urls.py
from django.urls import path
from .views import SignUpView
urlpatterns = [
path("signup/", SignUpView.as_view(), name="signup"),
]

View File

@ -1,10 +1,3 @@
# accounts/views.py from django.shortcuts import render
from django.contrib.auth.forms import UserCreationForm
from django.urls import reverse_lazy
from django.views import generic
# Create your views here.
class SignUpView(generic.CreateView):
form_class = UserCreationForm
success_url = reverse_lazy("login")
template_name = "registration/signup.html"

View File

@ -11,6 +11,7 @@ https://docs.djangoproject.com/en/3.2/ref/settings/
""" """
from pathlib import Path from pathlib import Path
import environ
import os import os
import environ import environ
@ -50,7 +51,6 @@ INSTALLED_APPS = [
'rest_framework', 'rest_framework',
'rest_framework.authtoken', 'rest_framework.authtoken',
'django_filters', 'django_filters',
'accounts',
] ]
@ -185,7 +185,3 @@ STATICFILES_DIRS = [
BASE_DIR / "api/static", BASE_DIR / "api/static",
("assets", BASE_DIR / "api/static/assets"), ("assets", BASE_DIR / "api/static/assets"),
] ]
LOGIN_REDIRECT_URL = "index"
LOGOUT_REDIRECT_URL = "index"

View File

@ -1,65 +0,0 @@
{% load static %}
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Bootstrap demo</title>
<link href="{% static 'css/bootstrap.min.css' %}" rel="stylesheet" />
</head>
<body>
<header class="p-3 text-bg-dark">
<div class="container">
<div class="d-flex flex-wrap align-items-center justify-content-center justify-content-lg-start">
<a href="/" class="d-flex align-items-center mb-2 mb-lg-0 text-white text-decoration-none">
<svg class="bi me-2" width="40" height="32" role="img" aria-label="Bootstrap"><use xlink:href="#bootstrap"></use></svg>
</a>
<ul class="nav col-12 col-lg-auto me-lg-auto mb-2 justify-content-center mb-md-0">
<li><a href="#" class="nav-link px-2 text-secondary">Home</a></li>
<li><a href="#" class="nav-link px-2 text-white">Features</a></li>
<li><a href="#" class="nav-link px-2 text-white">Pricing</a></li>
<li><a href="#" class="nav-link px-2 text-white">FAQs</a></li>
<li><a href="#" class="nav-link px-2 text-white">About</a></li>
</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">
{% if user.is_authenticated %}
<a href="{% url 'logout' %}" class="btn btn-outline-light me-2">Logout</a>
{% else %}
<a href="{% url 'login' %}" class="btn btn-outline-light me-2">Login</a>
<a href="{% url 'signup' %}" class="btn btn-warning">Sign-up</a>
{% endif %}
<!-- <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>
</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>
{% block content %}
<h1>{{ section.title }}</h1>
{% for story in story_list %}
<h2>
<a href="{{ story.get_absolute_url }}">
{{ story.headline|upper }}
</a>
</h2>
<p>{{ story.tease|truncatewords:"100" }}</p>
{% endfor %}
{% endblock %}
</main>
<!-- end main -->
</div>

View File

@ -1,13 +0,0 @@
<!-- templates/home.html -->
{% extends 'base.html' %}
{% block title %}Home{% endblock %}
{% block content %}
{% if user.is_authenticated %}
Hi {{ user.username }}!
{% else %}
<p>You are not logged in</p>
<a href="{% url 'login' %}">Log In</a>
{% endif %}
{% endblock %}

View File

@ -28,14 +28,8 @@
</form> </form>
<div class="text-end"> <div class="text-end">
{% if user.is_authenticated %} <button type="button" class="btn btn-outline-light me-2">Login</button>
<a href="{% url 'logout' %}" class="btn btn-outline-light me-2">Logout</a> <button type="button" class="btn btn-warning">Sign-up</button>
{% else %}
<a href="{% url 'login' %}" class="btn btn-outline-light me-2">Login</a>
<a href="{% url 'signup' %}" class="btn btn-warning">Sign-up</a>
{% endif %}
<!-- <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>
@ -45,7 +39,6 @@
<div class="col-lg-8 mx-auto p-4 py-md-5"> <div class="col-lg-8 mx-auto p-4 py-md-5">
<!-- main --> <!-- main -->
<main> <main>
<h1>Bills</h1> <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> <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>
@ -81,11 +74,8 @@
<!-- end main --> <!-- end main -->
</div> </div>
{% block base %}
{% endblock %}
<!-- footer --> <!-- footer -->
<div class="container"> <div class="container">
<footer class="d-flex flex-wrap justify-content-between align-items-center py-3 my-4 border-top"> <footer class="d-flex flex-wrap justify-content-between align-items-center py-3 my-4 border-top">

View File

@ -1,13 +0,0 @@
<!-- templates/registration/login.html -->
{% extends 'base.html' %}
{% block title %}Login{% endblock %}
{% block content %}
<h2>Log In</h2>
<form method="post">
{% csrf_token %}
{{ form.as_p }}
<button type="submit">Log In</button>
</form>
{% endblock %}

View File

@ -1,13 +0,0 @@
<!-- templates/registration/signup.html -->
{% extends "base.html" %}
{% block title %}Sign Up{% endblock %}
{% block content %}
<h2>Sign up</h2>
<form method="post">
{% csrf_token %}
{{ form.as_p }}
<button type="submit">Sign Up</button>
</form>
{% endblock %}

View File

@ -13,16 +13,17 @@ Including another URLconf
1. Import the include() function: from django.urls import include, path 1. Import the include() function: from django.urls import include, path
2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) 2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
""" """
from django.urls import include, path from django.urls import path
from django.contrib import admin from django.contrib import admin
from django.views.generic import TemplateView from django.views.generic import TemplateView
from django.urls import include, path
from . import views from . import views
urlpatterns = [ urlpatterns = [
# url(r'^$', view=TemplateView.as_view(template_name='bills/home.html')),
# url(r'^$', view=TemplateView.as_view(template_name='main_api/home.html')),
path('', views.index, name='index'),
path('bills/', include('bills.urls')), path('bills/', include('bills.urls')),
path('admin/', admin.site.urls), path('admin/', admin.site.urls),
path('accounts/', include('accounts.urls')),
path('accounts/', include('django.contrib.auth.urls')),
path('', TemplateView.as_view(template_name='index.html'), name='index'),
] ]