Skip to content

Instantly share code, notes, and snippets.

@stuartelimu stuartelimu/ausers-urls.py
Last active Sep 15, 2019

Embed
What would you like to do?
Article
from django.contrib import admin
from django.urls import path, include
urlpatterns = [
path('admin/', admin.site.urls),
path('accounts/', include('accounts.urls')),
]
{% load static %}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Ausers</title>
<!--===============================================================================================-->
<link rel="icon" type="image/png" href="{% static 'accounts/images/icons/favicon.ico' %}"/>
<!--===============================================================================================-->
<link rel="stylesheet" type="text/css" href="{% static 'accounts/vendor/bootstrap/css/bootstrap.min.css' %}">
<!--===============================================================================================-->
<link rel="stylesheet" type="text/css" href="{% static 'accounts/fonts/font-awesome-4.7.0/css/font-awesome.min.css' %}">
<!--===============================================================================================-->
<link rel="stylesheet" type="text/css" href="{% static 'accounts/fonts/Linearicons-Free-v1.0.0/icon-font.min.css' %}">
<!--===============================================================================================-->
<link rel="stylesheet" type="text/css" href="{% static 'accounts/vendor/animate/animate.css' %}">
<!--===============================================================================================-->
<link rel="stylesheet" type="text/css" href="{% static 'accounts/vendor/css-hamburgers/hamburgers.min.css' %}">
<!--===============================================================================================-->
<link rel="stylesheet" type="text/css" href="{% static 'accounts/vendor/animsition/css/animsition.min.css' %}">
<!--===============================================================================================-->
<link rel="stylesheet" type="text/css" href="{% static 'accounts/vendor/select2/select2.min.css' %}">
<!--===============================================================================================-->
<link rel="stylesheet" type="text/css" href="{% static 'accounts/vendor/daterangepicker/daterangepicker.css' %}">
<!--===============================================================================================-->
<link rel="stylesheet" type="text/css" href="{% static 'accounts/css/util.css' %}">
<link rel="stylesheet" type="text/css" href="{% static 'accounts/css/main.css' %}">
<link rel="stylesheet" type="text/css" href="{% static 'accounts/css/style.css' %}">
<!--===============================================================================================-->
</head>
<body style="background-color: #666666;">
{% block content %}
{% endblock content %}
<!--===============================================================================================-->
<script src="{% static 'accounts/vendor/jquery/jquery-3.2.1.min.js' %}"></script>
<!--===============================================================================================-->
<script src="{% static 'accounts/vendor/animsition/js/animsition.min.js' %}"></script>
<!--===============================================================================================-->
<script src="{% static 'accounts/vendor/bootstrap/js/popper.js' %}"></script>
<script src="{% static 'accounts/vendor/bootstrap/js/bootstrap.min.js' %}"></script>
<!--===============================================================================================-->
<script src="{% static 'accounts/vendor/select2/select2.min.js' %}"></script>
<!--===============================================================================================-->
<script src="{% static 'accounts/vendor/daterangepicker/moment.min.js' %}"></script>
<script src="{% static 'accounts/vendor/daterangepicker/daterangepicker.js' %}"></script>
<!--===============================================================================================-->
<script src="{% static 'accounts/vendor/countdowntime/countdowntime.js' %}"></script>
<!--===============================================================================================-->
<script src="{% static 'accounts/js/main.js' %}"></script>
</body>
</html>
{% extends 'accounts/base.html' %}
{% load static %}
{% block content %}
<div class="limiter">
<div class="container-100" style="background-image: linear-gradient(rgba(0,0,0,.4), rgba(0,0,0,.4)), url({% static 'accounts/images/bg-01.jpg' %});">
<div class="col-md-4">
<div class="text-white">
<img src="{% static 'accounts/images/profile.jpg' %}" class="icon" alt="profile-img" srcset="">
</div>
</div>
<div class="text-white">
Hi {{request.user.username }} <br>
<a class="text-white" href="{% url 'logout' %}">logout</a>
</div>
</div>
</div>
{% endblock content %}
{% extends 'accounts/base.html' %}
{% load static %}
{% block content %}
<div class="limiter">
<div class="container-100" style="background-image: linear-gradient(rgba(0,0,0,.4), rgba(0,0,0,.4)), url({% static 'accounts/images/bg-01.jpg' %});">
<div class="text-center">
<h4>Logged out</h4> <br>
<a class="text-white" href="{% url 'login' %}">Log-in again</a>
</div>
</div>
</div>
{% endblock content %}
{% extends 'accounts/base.html' %}
{% load static %}
{% block content %}
<div class="limiter">
<div class="container-login100">
<div class="wrap-login100">
<form class="login100-form validate-form" method="POST" action="{% url 'login' %}">
{% csrf_token %}
{% if form.errors %}
<div class="alert alert-warning alert-dismissible fade show" role="alert">
Your <strong>username</strong> and <strong>password</strong> did not match
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
{% endif %}
<span class="login100-form-title p-b-43">
Login to continue
</span>
<div class="wrap-input100 validate-input" data-validate = "Valid username is required">
<input class="input100" type="text" name="username" id="id_username">
<span class="focus-input100"></span>
<span class="label-input100">Username</span>
</div>
<div class="wrap-input100 validate-input" data-validate="Password is required">
<input class="input100" type="password" name="password" au>
<span class="focus-input100"></span>
<span class="label-input100">Password</span>
</div>
<input type="hidden" name="next" value="{{ next }}">
<div class="flex-sb-m w-full p-t-3 p-b-32">
<div class="contact100-form-checkbox">
<input class="input-checkbox100" id="ckb1" type="checkbox" name="remember-me">
<label class="label-checkbox100" for="ckb1">
Remember me
</label>
</div>
<div>
<a href="#" class="txt1">
Forgot Password?
</a>
</div>
</div>
<div class="container-login100-form-btn">
<button type="submit" class="login100-form-btn">
Login
</button>
</div>
<div class="text-center p-t-46 p-b-20">
<span class="txt2">
or sign up using
</span>
</div>
<div class="login100-form-social flex-c-m">
<a href="#" class="login100-form-social-item flex-c-m bg1 m-r-5">
<i class="fa fa-facebook-f" aria-hidden="true"></i>
</a>
<a href="#" class="login100-form-social-item flex-c-m bg2 m-r-5">
<i class="fa fa-twitter" aria-hidden="true"></i>
</a>
</div>
</form>
<div class="login100-more" style="background-image: url({% static 'accounts/images/bg-01.jpg' %});">
</div>
</div>
</div>
</div>
{% endblock content %}
INSTALLED_APPS = [
'accounts.apps.AccountsConfig',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
]
from django.urls import path
from django.contrib.auth import views as auth_views
from . import views
urlpatterns = [
path('login/', auth_views.LoginView.as_view(), name='login'),
path('logout/', auth_views.LogoutView.as_view(), name='logout'),
]
from django.contrib.auth.mixins import LoginRequiredMixin
from django.views.generic import TemplateView
class DashboardView(LoginRequiredMixin, TemplateView):
template_name = "accounts/dashboard.html"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.