Skip to content

Commit

Permalink
WIP.
Browse files Browse the repository at this point in the history
  • Loading branch information
nessita committed Oct 18, 2024
1 parent 3fad712 commit 6b77f27
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 7 deletions.
20 changes: 20 additions & 0 deletions django/contrib/auth/templates/registration/login.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Login</title>
</head>
<body>
<main>
<h1>Login</h1>
<form method="POST" action="{% url 'login' %}">
{% csrf_token %}
{{ form }}
{% if next %}
<input type="hidden" name="next" value="{{ next }}">
{% endif %}
<button type="submit">Login</button>
</form>
</main>
</body>
</html>
18 changes: 11 additions & 7 deletions django/views/debug.py
Original file line number Diff line number Diff line change
Expand Up @@ -654,12 +654,16 @@ def technical_404_response(request, exception):

def default_urlconf(request):
"""Create an empty URLconf 404 error response."""
with builtin_template_path("default_urlconf.html").open(encoding="utf-8") as fh:
t = DEBUG_ENGINE.from_string(fh.read())
c = Context(
{
"version": get_docs_version(),
}
)
context = {"version": get_docs_version()}
template_name = "default_urlconf.html"
try:
from django.shortcuts import render

return render(request, template_name, context)
except Exception:
pass

with builtin_template_path(template_name).open(encoding="utf-8") as fh:
t = DEBUG_ENGINE.from_string(fh.read())
c = Context(context)
return HttpResponse(t.render(c))
19 changes: 19 additions & 0 deletions django/views/templates/default_urlconf.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@
main {
text-align: center;
}
nav {
text-align: right;
height: 50px;
display: flex;
justify-content: space-between;
}
h1, h2, h3, h4, h5, p, ul {
padding: 0;
margin: 0;
Expand Down Expand Up @@ -190,6 +196,19 @@
</style>
</head>
<body>
<nav>
{% if user.is_authenticated %}
<p>Welcome, {{ user.username }}!</p> <!-- Needs to handle USERNAME_FIELD -->
<form method="POST" action="{% url 'logout' %}">
{% csrf_token %}
<input type="hidden" name="next" value="/">
<button type="submit" name="Logout">Logout</button>
</form>
{% else %}
<p>Django version: {{ version }}</p>
<a href="{% url 'login' %}?next=/">Login</a>
{% endif %}
</nav>
<main>
<svg class="figure" viewBox="0 0 508 268" aria-hidden="true">
<path d="M305.2 156.6c0 4.6-.5 9-1.6 13.2-2.5-4.4-5.6-8.4-9.2-12-4.6-4.6-10-8.4-16-11.2 2.8-11.2 4.5-22.9 5-34.6 1.8 1.4 3.5 2.9 5 4.5 10.5 10.3 16.8 24.5 16.8 40.1zm-75-10c-6 2.8-11.4 6.6-16 11.2-3.5 3.6-6.6 7.6-9.1 12-1-4.3-1.6-8.7-1.6-13.2 0-15.7 6.3-29.9 16.6-40.1 1.6-1.6 3.3-3.1 5.1-4.5.6 11.8 2.2 23.4 5 34.6z" fill="#2E3B39" fill-rule="nonzero"/>
Expand Down

0 comments on commit 6b77f27

Please sign in to comment.