diff --git a/django_project/myapp/templates/myapp/base.html b/django_project/myapp/templates/myapp/base.html index eb5f228c51ad17fc0a11d15815ac25d85c8c5f9d..13acf3d718fbd5534050952c66bd78dfe2f73eac 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 d98d05149c284cea3feaeeb1a67befcdd48e8e87..9f1d94d3c8f95945d111cfa4b310c58b735ff31a 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 f77ee730cf0e780c681c77fcd20f34cd9d2ebab0..5fdb30c990431c898d37ff381c9f02db5024429a 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)}"