From a34e64e10389c80631a9c0170568869a08316cad Mon Sep 17 00:00:00 2001
From: James2Tulloch <146088090+James2Tulloch@users.noreply.github.com>
Date: Tue, 25 Feb 2025 18:41:28 +0000
Subject: [PATCH] Minor changes to templates

---
 .../myapp/templates/myapp/base.html           |  2 ++
 .../myapp/templates/myapp/group_list.html     | 25 ++++++-------------
 django_project/myapp/views.py                 |  7 +++---
 3 files changed, 14 insertions(+), 20 deletions(-)

diff --git a/django_project/myapp/templates/myapp/base.html b/django_project/myapp/templates/myapp/base.html
index eb5f228..13acf3d 100644
--- a/django_project/myapp/templates/myapp/base.html
+++ b/django_project/myapp/templates/myapp/base.html
@@ -35,6 +35,8 @@
     <!-- Menu Bar -->
     <nav>
         <ul>
+            <li><a href="{% url 'feed' %}">Home</a></li>
+            <li><a href="{% url 'create_post' %}">Post</a></li>
             <li><a href="{% url 'account' %}">Account</a></li>
             <li><a href="{% url 'group_list' %}">Groups</a></li>
             <li><a href="{% url 'logout' %}">Logout</a></li>
diff --git a/django_project/myapp/templates/myapp/group_list.html b/django_project/myapp/templates/myapp/group_list.html
index d98d051..9f1d94d 100644
--- a/django_project/myapp/templates/myapp/group_list.html
+++ b/django_project/myapp/templates/myapp/group_list.html
@@ -1,18 +1,9 @@
-<!DOCTYPE html>
-<html lang="en">
-<head>
-    <meta charset="UTF-8">
-    <title>Group List</title>
-    <style>
-        body { font-family: Arial, sans-serif; margin: 2em; }
-        ul { list-style-type: none; padding: 0; }
-        li { margin-bottom: 0.5em; }
-        a { text-decoration: none; color: #2a5d9f; }
-        a:hover { text-decoration: underline; }
-    </style>
-</head>
-<body>
-    <h1>Groups</h1>
+{% extends 'myapp/base.html' %}
+
+{% block title %}Groups{% endblock %}
+
+{% block content %}
+  <h1>Groups</h1>
     {% if error %}
         <p style="color: red;">{{ error }}</p>
     {% endif %}
@@ -25,5 +16,5 @@
             <li>No groups available.</li>
         {% endfor %}
     </ul>
-</body>
-</html>
+
+{% endblock %}
diff --git a/django_project/myapp/views.py b/django_project/myapp/views.py
index f77ee73..5fdb30c 100644
--- a/django_project/myapp/views.py
+++ b/django_project/myapp/views.py
@@ -3,8 +3,9 @@ from django.http import JsonResponse
 from django.conf import settings
 import time
 import os
-import rust_crud_api  # This is the module we built
+import rust_crud_api  # Custom Rust Pyo3 Library 🦀
 
+# Dont delete this 
 db_url = settings.DATABASE_URL
 
 def init_db_view(request):
@@ -58,7 +59,7 @@ def register_view(request):
         try:
             rust_crud_api.create_user(db_url, name, email, password, username, studentid, startyear, endyear)
             # 4. Redirect on success
-            return redirect('login')
+            return redirect('')
         except Exception as e:
             context['error'] = f"An error occurred: {str(e)}"
             return render(request, 'myapp/register.html', context)
@@ -307,7 +308,7 @@ def create_post_view(request):
         
         try:
             rust_crud_api.create_post(db_url, user_id, group_id, content)
-            return redirect('account')
+            return redirect('feed')
         except Exception as e:
             context['error'] = f"Error creating post: {str(e)}"
     
-- 
GitLab