Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion djangotest/djangotest/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'DIRS': [os.path.join(BASE_DIR, 'templates')],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
Expand Down Expand Up @@ -118,3 +118,5 @@
# https://docs.djangoproject.com/en/2.1/howto/static-files/

STATIC_URL = '/static/'

LOGIN_REDIRECT_URL = '/'
5 changes: 4 additions & 1 deletion djangotest/djangotest/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,11 @@
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path
from django.urls import include, path
from django.views.generic import TemplateView

urlpatterns = [
path('', TemplateView.as_view(template_name = 'home.html')),
path('admin/', admin.site.urls),
path('users/', include('django.contrib.auth.urls')),
]
30 changes: 30 additions & 0 deletions djangotest/templates/base.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>{% block title %}My Wishlist{% endblock %}</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/semantic.min.css">
<script src="https://code.jquery.com/jquery-3.1.1.min.js"
integrity="sha256-hVVnYaiADRTO2PzUGmuLJr8BLUSjGIZsDYGmIJLv2b8=" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/semantic.min.js"></script>
</head>

<body>
<div class="ui container">
<div class="ui large secondary menu">
<div class="menu">
<div class="item">
<h3>My Wishlist</h3>
</div>
</div>
<div class="right menu">
{% if user.is_authenticated %}
<a class="item" href="/users/logout">Sign-out</a>
{% else %}
<a class="item" href="/users/login">Sign-in</a>
{% endif %}
</div>
</div>
{% block content %}{% endblock %}
</div>
</body>
</html>
5 changes: 5 additions & 0 deletions djangotest/templates/home.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{% extends "base.html" %}

{% block content %}

{% endblock %}
42 changes: 42 additions & 0 deletions djangotest/templates/registration/login.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{% extends "base.html" %}

{% block content %}

{% if form.errors %}
<div class="ui error message">
<p>Your username and password didn't match. Please try again.</p>
</div>
{% endif %}

{% if next %}
{% if user.is_authenticated %}
<p>Your account doesn't have access to this page. To proceed,
please login with an account that has access.</p>
{% else %}
<p>Please login to see this page.</p>
{% endif %}
{% endif %}

<form method="post" action="{% url 'login' %}">
{% csrf_token %}
<table>

<tr>
<td>{{ form.username.label_tag }}</td>
<td>{{ form.username }}</td>
</tr>

<tr>
<td>{{ form.password.label_tag }}</td>
<td>{{ form.password }}</td>
</tr>
</table>

<input class="ui button" type="submit" value="login" />
<input type="hidden" name="next" value="{{ next }}" />
</form>

{# Assumes you setup the password_reset view in your URLconf #}
<p><a href="{% url 'password_reset' %}">Lost password?</a></p>

{% endblock %}