Skip to content
Snippets Groups Projects
Commit a34e64e1 authored by James2Tulloch's avatar James2Tulloch
Browse files

Minor changes to templates

parent c3ffd3d9
Branches
No related tags found
No related merge requests found
......@@ -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>
......
<!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>
{% extends 'myapp/base.html' %}
{% block title %}Groups{% endblock %}
{% block content %}
<h1>Groups</h1>
{% if error %}
<p style="color: red;">{{ error }}</p>
......@@ -25,5 +16,5 @@
<li>No groups available.</li>
{% endfor %}
</ul>
</body>
</html>
{% endblock %}
......@@ -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)}"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment