Compare commits

...

2 Commits

10 changed files with 101 additions and 2 deletions

View File

@ -43,6 +43,7 @@ INSTALLED_APPS = [
"django.contrib.sessions",
"django.contrib.messages",
"django.contrib.staticfiles",
"core",
]
MIDDLEWARE = [
@ -130,6 +131,7 @@ STATIC_ROOT = BASE_DIR / "static"
# User model and authentication
AUTH_USER_MODEL = "accounts.User"
LOGOUT_REDIRECT_URL = "core:homepage"
# Default primary key field type

View File

@ -20,5 +20,6 @@ from django.urls import include, path
urlpatterns = [
path("admin/", admin.site.urls),
path("", include("core.urls", namespace="core")),
path("accounts/", include("accounts.urls")),
]

27
core/templates/base.html Normal file
View File

@ -0,0 +1,27 @@
{% load static %}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>
{% block title %}Astronomy Base - The Dazed Gerbil{% endblock %}
</title>
{% block styles %}{% endblock %}
</head>
<body>
{% block page %}
{% block usernav %}
{% include 'usernav.html' %}
{% endblock %}
{% block header %}
{% include 'header.html' %}
{% endblock %}
{% block sitenav %}{% endblock %}
{% block content %}{% endblock %}
{% block footer %}
{% include 'footer.html' %}
{% endblock %}
{% endblock %}
</body>
</html>

View File

@ -0,0 +1,4 @@
{% extends 'base.html' %}
{% block content %}
{% endblock %}

View File

@ -0,0 +1,4 @@
<footer>
<p>&copy; The Dazed Gerbil 2025 to {% now "Y" %}</p>
</footer>

View File

@ -0,0 +1,4 @@
<header>
<h1><a href="{% url 'core:homepage' %}">Astronomy Base by The Dazed Gerbil</a></h1>
</header>

View File

@ -0,0 +1,15 @@
<nav>
<hr />
<ul>
{% if page_obj.has_previous %}
<li><a href="?page=1">&laquo; first</a></li>
<li><a href="?page={{ page_obj.previous_page_number }}">previous</a></li>
{% endif %} {% for page in page_obj.paginator.page_range %}
<li><a href="?page={{ page }}">{{ page }}</a></li>
{% endfor %} {% if page_obj.has_next %}
<li><a href="?page={{ page_obj.next_page_number }}">next</a></li>
<li><a href="?page={{ page_obj.paginator.num_pages }}">last &raquo;</a></li>
{% endif %}
</ul>
</nav>

View File

@ -0,0 +1,31 @@
<div>
<ul>
{% if request.user.is_authenticated %}
<span>Nice to see you again {{ request.user }}!</span>
<li>
<a href="{% url 'dashboard:dashboard' %}">Dashboard</a>
</li>
{# <li><a href="{% url 'display_profile' %}">Account profile</a></li> #}
<li>
<form method="post" action="{% url 'logout' %}" style="display: inline;">
{% csrf_token %}
<button type="submit"
style="background: none;
border: none;
cursor: pointer;
padding: 0;
text-decoration: underline">Logout</button>
</form>
</li>
{% else %}
{# <li><a href="{% url 'django_registration_register' %}">Sign up</a></li> #}
<li>
<a href="{% url 'login' %}">Login</a>
</li>
<li>
<a href="{% url 'password_reset' %}">Forgotten password?</a>
</li>
{% endif %}
</ul>
</div>

9
core/urls.py Normal file
View File

@ -0,0 +1,9 @@
from django.urls import path
from .views import Homepage
app_name = "core"
urlpatterns = [
path("", Homepage.as_view(), name="homepage"),
]

View File

@ -1,3 +1,5 @@
from django.shortcuts import render
from django.views.generic import TemplateView
# Create your views here.
class Homepage(TemplateView):
template_name = "core/homepage.html"