Make it look good

This commit is contained in:
Maximilian Friedersdorff 2022-07-10 11:15:48 +01:00
parent aca86e2e04
commit 75cae77a59
10 changed files with 126 additions and 48 deletions

View file

@ -6,5 +6,5 @@ app_name = "circles"
urlpatterns = [ urlpatterns = [
path("", views.CircleListView.as_view(), name="circle_list"), path("", views.CircleListView.as_view(), name="circle_list"),
path("circle/<int:pk>", views.CircleUpdateView.as_view(), name="circle_update"), path("circle/<int:pk>", views.CircleUpdateView.as_view(), name="circle_update"),
path("add", views.CircleCreateView.as_view(), name="circle_create"), path("circle/new", views.CircleCreateView.as_view(), name="circle_create"),
] ]

View file

@ -5,6 +5,11 @@ from . import views
app_name = "posts" app_name = "posts"
urlpatterns = [ urlpatterns = [
path("post/<int:pk>", views.PostDetailView.as_view(), name="post_detail"), path("post/<int:pk>", views.PostDetailView.as_view(), name="post_detail"),
path(
"post/<int:pk>/fullscreen",
views.PostDetailView.as_view(template_name_suffix="_fullscreen"),
name="post_fullscreen",
),
path("post/new", views.PostCreateView.as_view(), name="post_create"), path("post/new", views.PostCreateView.as_view(), name="post_create"),
path("posts", views.PostListView.as_view(), name="post_list"), path("posts", views.PostListView.as_view(), name="post_list"),
] ]

View file

@ -1,9 +1,17 @@
{% extends "base.html" %} {% extends "base.html" %}
{% load django_bootstrap5 %}
{% block content %} {% block content %}
<h1>Circle {{ object.name }}</h1> <div class="container">
<form action="#" method="post"> <div class="row">
{% csrf_token %} <div class="col">
{{ form }} <h1>Create a new circle</h1>
<input type="submit" value="Post"> <form action="" method="post">
</form> {% csrf_token %}
{% bootstrap_form form %}
{% bootstrap_button button_type="submit" content="OK" %}
</form>
</div>
</div>
</div>
{% endblock content %} {% endblock content %}

View file

@ -1,9 +1,22 @@
{% extends "base.html" %} {% extends "base.html" %}
{% block content %} {% block content %}
<h1>Your Circles</h1> <div class="container">
<ul> <div class="row">
{% for circle in object_list %} <div class="col">
<li><a href="{% url "circles:circle_update" circle.pk %}">{{ circle.name }}</a></li> <h1>Your Circles</h1>
{% endfor %} <table class="table">
</ul> <tr>
<th>Name</th>
<th>Members</th>
</tr>
{% for circle in object_list %}
<tr>
<td><a href="{% url "circles:circle_update" circle.pk %}">{{ circle.name }}</a></td>
<td>{{ circle.members.all }}</td>
</tr>
{% endfor %}
</table>
</div>
</div>
</div>
{% endblock content %} {% endblock content %}

View file

@ -1,20 +1,30 @@
{% extends "base.html" %} {% extends "base.html" %}
{% load django_bootstrap5 %}
{% block content %} {% block content %}
{% if object.title %} <div class="container">
<h1>{{ object.title }}</h1> <div class="row">
{% else %} <div class="col-md-8">
<h1>{{ object.user.username }}</h1> {% if object.title %}
{% endif %} <h1>{{ object.title }}</h1>
<img width=400 src={{ object.img.url }}/> {% else %}
<h2> Comments</h2> <h1>{{ object.user.username }}</h1>
<ul> {% endif %}
{% for comment in object.comments.all %} <a href="{% url 'posts:post_fullscreen' object.pk %}"><img class="img-fluid" src={{ object.img.url }}/></a>
<li>{{ comment.user }} - {{ comment.comment }}</li> </div>
{% endfor %} <div class="col-md-4">
</ul> <h2> Comments</h2>
<form action="" method="post"> <ul>
{% csrf_token %} {% for comment in object.comments.all %}
{{ form }} <li>{{ comment.user }} - {{ comment.comment }}</li>
<input type="submit", value="Post"> {% endfor %}
</form> </ul>
<form action="" method="post">
{% csrf_token %}
{% bootstrap_form form %}
{% bootstrap_button button_type="submit" content="OK" %}
</form>
</div>
</div>
</div>
{% endblock content %} {% endblock content %}

View file

@ -1,10 +1,19 @@
{% extends "base.html" %} {% extends "base.html" %}
{% load django_bootstrap5 %}
{% block content %} {% block content %}
<h1>Upload a new picture</h1> <div class="container">
<form enctype="multipart/form-data" action="" method="post"> <div class="row">
{% csrf_token %} <div class="col">
{{ form }} <h1>Upload a new picture</h1>
<input type="submit" value="Post"> <form enctype="multipart/form-data" action="" method="post">
</form> {% csrf_token %}
{% bootstrap_form form %}
{% bootstrap_button button_type="submit" content="OK" %}
<input type="submit" value="Post">
</form>
</div>
</div>
</div>
{% endblock content %} {% endblock content %}

View file

@ -0,0 +1,16 @@
{% extends "base.html" %}
{% load django_bootstrap5 %}
{% block nav %}{% endblock nav %}
{% block content %}
<div class="vh-100 bg-dark d-flex flex-column">
<div class="d-flex flex-row m-2 justify-content-between align-items-center">
<h3 class="text-light">{{ object.title }}</h1>
<a class="btn btn-dark" href="{% url 'posts:post_detail' object.pk %}">X</a>
</div>
<div class="flex-fill flex-shrink-1">
<img class="img-full w-100 h-100" src={{ object.img.url }}/>
</div>
</div>
{% endblock content %}

View file

@ -1,9 +1,15 @@
{% extends "base.html" %} {% extends "base.html" %}
{% block content %} {% block content %}
<h1>Posts Shared with you</h1> <div class="container">
<ul> <div class="row">
{% for post in object_list %} <div class="col">
<li><a href="{% url "posts:post_detail" post.pk %}">{{ post.title }}</a></li> <h1>Posts Shared with you</h1>
{% endfor %} <ul>
</ul> {% for post in object_list %}
<li><a href="{% url "posts:post_detail" post.pk %}">{{ post.title }}</a></li>
{% endfor %}
</ul>
</div>
</div>
</div>
{% endblock content %} {% endblock content %}

View file

@ -1,10 +1,19 @@
{% extends "base.html" %} {% extends "base.html" %}
{% load django_bootstrap5 %}
{% block content %} {% block content %}
<h1>Login</h1> <div class="container">
<form action="" method="post"> <div class="row">
{% csrf_token %} <div class="col">
{{ form }} <h1>Login</h1>
<input type="submit", value="Post"> <form action="" method="post">
</form> {% csrf_token %}
{% bootstrap_form form %}
{% bootstrap_button button_type="submit" content="OK" %}
</form>
</div>
</div>
</div>
{% endblock content %} {% endblock content %}

View file

@ -16,6 +16,7 @@ Including another URLconf
from django.conf import settings from django.conf import settings
from django.conf.urls.static import static from django.conf.urls.static import static
from django.contrib import admin from django.contrib import admin
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
from django.urls import include from django.urls import include
from django.urls import path from django.urls import path
@ -31,3 +32,4 @@ urlpatterns = [
if settings.DEBUG: if settings.DEBUG:
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
urlpatterns += staticfiles_urlpatterns()