From 3ef0a1a27ffcc264b57b997c1c9040324e9988b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?O=CC=81scar=20M=2E=20Lage?= Date: Thu, 14 Nov 2024 18:47:39 +0100 Subject: [PATCH] Added some kind of "base" template --- src/core/templates/core/base.html | 64 ++++++++++++++++++++++ src/core/templates/core/user_timeline.html | 28 ++++++++-- src/core/views.py | 4 +- 3 files changed, 91 insertions(+), 5 deletions(-) create mode 100644 src/core/templates/core/base.html diff --git a/src/core/templates/core/base.html b/src/core/templates/core/base.html new file mode 100644 index 0000000..1107551 --- /dev/null +++ b/src/core/templates/core/base.html @@ -0,0 +1,64 @@ + + + + + + + + bskydj - {% block title %}home{% endblock %} + + + + + + +
+
+ + bskydj +
+ +
+ + Profile +
+
+ +
+ + + + +
+
+ {% block content %} + {% endblock %} +
+
+ + + +
+ + + + + diff --git a/src/core/templates/core/user_timeline.html b/src/core/templates/core/user_timeline.html index c9adc10..c570f3a 100644 --- a/src/core/templates/core/user_timeline.html +++ b/src/core/templates/core/user_timeline.html @@ -1,7 +1,27 @@ +{% extends "core/base.html" %} + +{% block title %}{{ user }} timeline{% endblock %} + +{% block content %} + {% for publication in publications %} -
-

{{ publication.author_name }} ({{ publication.author_handle }}) {{ publication.published_at }}

-

{{ publication.content }}

- View post +
+
+ Avatar +
+

{{ publication.author_name }}

+

{{ publication.published_at }}

+
+
+

{{ publication.content }}

+
+ + + +
+{% empty %} +

No hay publicaciones para mostrar.

{% endfor %} + +{% endblock %} diff --git a/src/core/views.py b/src/core/views.py index 4574267..66ebf4d 100644 --- a/src/core/views.py +++ b/src/core/views.py @@ -52,7 +52,9 @@ def user_timeline(request, user_id): publication.save() publications = PublicationCache.objects.filter(user=user).order_by('-published_at') - return render(request, 'core/user_timeline.html', {'publications': publications}) + return render(request, 'core/user_timeline.html', + {'publications':publications, + 'user':user}) except User.DoesNotExist: return JsonResponse({"error": "User not found"}, status=404)