aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBobby <[email protected]>2022-09-09 02:11:03 -0400
committerBobby <[email protected]>2022-09-09 02:11:03 -0400
commitbeeddba7738d63844fc9dd2beaf4994daa6f6fb9 (patch)
treebf6cb1213810416ae0705f3eb086cc652c1aa8e4
parenta936749708df2b0d6ea200f31992bb61df8442ef (diff)
downloadthatcomputerscientist-beeddba7738d63844fc9dd2beaf4994daa6f6fb9.tar.xz
thatcomputerscientist-beeddba7738d63844fc9dd2beaf4994daa6f6fb9.zip
Added Blog Admin Module
-rw-r--r--blog_admin/__init__.py0
-rw-r--r--blog_admin/admin.py3
-rw-r--r--blog_admin/apps.py6
-rw-r--r--blog_admin/migrations/__init__.py0
-rw-r--r--blog_admin/models.py3
-rw-r--r--blog_admin/tests.py3
-rw-r--r--blog_admin/urls.py12
-rw-r--r--blog_admin/views.py20
-rw-r--r--templates/blog/partials/sidebar.html31
-rw-r--r--thatcomputerscientist/settings.py1
-rw-r--r--thatcomputerscientist/urls.py1
11 files changed, 71 insertions, 9 deletions
diff --git a/blog_admin/__init__.py b/blog_admin/__init__.py
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/blog_admin/__init__.py
diff --git a/blog_admin/admin.py b/blog_admin/admin.py
new file mode 100644
index 00000000..8c38f3f3
--- /dev/null
+++ b/blog_admin/admin.py
@@ -0,0 +1,3 @@
+from django.contrib import admin
+
+# Register your models here.
diff --git a/blog_admin/apps.py b/blog_admin/apps.py
new file mode 100644
index 00000000..805ca8f8
--- /dev/null
+++ b/blog_admin/apps.py
@@ -0,0 +1,6 @@
+from django.apps import AppConfig
+
+
+class BlogAdminConfig(AppConfig):
+ default_auto_field = 'django.db.models.BigAutoField'
+ name = 'blog_admin'
diff --git a/blog_admin/migrations/__init__.py b/blog_admin/migrations/__init__.py
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/blog_admin/migrations/__init__.py
diff --git a/blog_admin/models.py b/blog_admin/models.py
new file mode 100644
index 00000000..71a83623
--- /dev/null
+++ b/blog_admin/models.py
@@ -0,0 +1,3 @@
+from django.db import models
+
+# Create your models here.
diff --git a/blog_admin/tests.py b/blog_admin/tests.py
new file mode 100644
index 00000000..7ce503c2
--- /dev/null
+++ b/blog_admin/tests.py
@@ -0,0 +1,3 @@
+from django.test import TestCase
+
+# Create your tests here.
diff --git a/blog_admin/urls.py b/blog_admin/urls.py
new file mode 100644
index 00000000..63459ba9
--- /dev/null
+++ b/blog_admin/urls.py
@@ -0,0 +1,12 @@
+from django.urls import path
+from . import views
+
+app_name = 'blog-admin'
+urlpatterns = [
+ path('users', views.users, name='users'),
+ path('posts', views.posts, name='posts'),
+ path('comments', views.comments, name='comments'),
+ path('categories', views.categories, name='categories'),
+ path('tags', views.tags, name='tags'),
+ path('new', views.new, name='new'),
+] \ No newline at end of file
diff --git a/blog_admin/views.py b/blog_admin/views.py
new file mode 100644
index 00000000..6196c7ab
--- /dev/null
+++ b/blog_admin/views.py
@@ -0,0 +1,20 @@
+from django.shortcuts import render
+
+# Create your views here.
+def users(request):
+ pass
+
+def posts(request):
+ pass
+
+def comments(request):
+ pass
+
+def categories(request):
+ pass
+
+def tags(request):
+ pass
+
+def new(request):
+ pass \ No newline at end of file
diff --git a/templates/blog/partials/sidebar.html b/templates/blog/partials/sidebar.html
index faa846bf..cd0a8cda 100644
--- a/templates/blog/partials/sidebar.html
+++ b/templates/blog/partials/sidebar.html
@@ -9,10 +9,6 @@
</a>
<div class="lgn-area">
{% if user.is_authenticated %}
- <div class="login-box">
- <p>Welcome, {{ user.username }}!</p>
- <button type="submit" onclick="location.href='{% url 'users:logout' %}'">Logout</button>
- </div>
{% else %}
<fieldset>
<legend>Login Area</legend>
@@ -42,7 +38,11 @@
{% endif %}
<br>
<fieldset>
- <legend>Navigation</legend>
+ {% if user.is_authenticated %}
+ <legend>Hello, {{ user.username }}!</legend>
+ {% else %}
+ <legend>Navigation</legend>
+ {% endif %}
<nav>
<ul>
<li><a href="/">Home</a></li>
@@ -51,16 +51,29 @@
<li><a href="/blog">Blog</a></li>
{% if user.is_authenticated %}
<li><a href="{% url 'account' %}">My Account</a></li>
- {% comment %} <li><a href="{% url 'homepage' %}">My Homepage<a></li> {% endcomment %}
+ <li><a href="{% url 'users:logout' %}">Logout</a></li>
{% else %}
<li><a href="/register">Register</a></li>
{% endif %}
- {% if user.is_superuser %}
- <li><a href="/admin">Administration</a></li>
- {% endif %}
</ul>
</nav>
</fieldset>
+ <br>
+ {% if user.is_superuser %}
+ <fieldset>
+ <legend>Admin</legend>
+ <nav>
+ <ul>
+ <li><a href="{% url 'admin:index' %}">Admin Area</a></li>
+ <li><a href="{% url 'blog-admin:users' %}">Manage Users</a></li>
+ <li><a href="{% url 'blog-admin:posts' %}">Manage Posts</a></li>
+ <li><a href="{% url 'blog-admin:comments' %}">Manage Comments</a></li>
+ <li><a href="{% url 'blog-admin:categories' %}">Manage Categories</a></li>
+ <li><a href="{% url 'blog-admin:tags' %}">Manage Tags</a></li>
+ <li><a href="{% url 'blog-admin:new' %}">Create New Post</a></li>
+ </ul>
+ </nav>
+ {% endif %}
</div>
</div>
diff --git a/thatcomputerscientist/settings.py b/thatcomputerscientist/settings.py
index 41d12c82..5b9a7b05 100644
--- a/thatcomputerscientist/settings.py
+++ b/thatcomputerscientist/settings.py
@@ -48,6 +48,7 @@ INSTALLED_APPS = [
'blog',
'users',
'userpages',
+ 'blog_admin',
]
MIDDLEWARE = [
diff --git a/thatcomputerscientist/urls.py b/thatcomputerscientist/urls.py
index ccebe812..8b27446e 100644
--- a/thatcomputerscientist/urls.py
+++ b/thatcomputerscientist/urls.py
@@ -22,6 +22,7 @@ urlpatterns = [
path('admin/', admin.site.urls),
path('', include('blog.urls')),
path('users/', include('users.urls', namespace='users')),
+ path('blog-admin/', include('blog_admin.urls', namespace='blog-admin')),
path('', include(('userpages.urls', 'userpages'), namespace='userpages')),
]