From f100dbe7a60887a70b7efd65907209b3a9f84903 Mon Sep 17 00:00:00 2001 From: Kubaryt <88268063+Kubaryt@users.noreply.github.com> Date: Mon, 22 Apr 2024 13:19:02 +0000 Subject: [PATCH] fix: Fixed conflicts --- core/templates/core/index.html | 1 - .../0003_rename_nextmeeting_meeting.py | 1 - ...rename_date_of_meeting_nextmeeting_date.py | 17 +++++++ gwardia/models.py | 6 ++- gwardia/templates/gwardia/index.html | 39 +++++++++------ gwardia/templates/gwardia/list_events.html | 23 +++++++++ gwardia/templatetags/__init__.py | 0 gwardia/templatetags/list_events.py | 8 ++++ gwardia/views.py | 12 ++++- poetry.lock | 47 +++++++++---------- static/GwardiaHub/tailwind_custom_styles.js | 11 +++++ 11 files changed, 122 insertions(+), 43 deletions(-) create mode 100644 gwardia/migrations/0004_rename_date_of_meeting_nextmeeting_date.py create mode 100644 gwardia/templates/gwardia/list_events.html create mode 100644 gwardia/templatetags/__init__.py create mode 100644 gwardia/templatetags/list_events.py create mode 100644 static/GwardiaHub/tailwind_custom_styles.js diff --git a/core/templates/core/index.html b/core/templates/core/index.html index 1f4ab92..9e19dac 100644 --- a/core/templates/core/index.html +++ b/core/templates/core/index.html @@ -42,5 +42,4 @@

Gwardia Hub

- {% endblock %} \ No newline at end of file diff --git a/gwardia/migrations/0003_rename_nextmeeting_meeting.py b/gwardia/migrations/0003_rename_nextmeeting_meeting.py index 06d8a17..73ae8f8 100644 --- a/gwardia/migrations/0003_rename_nextmeeting_meeting.py +++ b/gwardia/migrations/0003_rename_nextmeeting_meeting.py @@ -4,7 +4,6 @@ class Migration(migrations.Migration): - dependencies = [ ('gwardia', '0002_alter_nextmeeting_date_of_meeting'), ] diff --git a/gwardia/migrations/0004_rename_date_of_meeting_nextmeeting_date.py b/gwardia/migrations/0004_rename_date_of_meeting_nextmeeting_date.py new file mode 100644 index 0000000..ce3fc1a --- /dev/null +++ b/gwardia/migrations/0004_rename_date_of_meeting_nextmeeting_date.py @@ -0,0 +1,17 @@ +# Generated by Django 5.0.4 on 2024-04-19 12:33 + +from django.db import migrations + + +class Migration(migrations.Migration): + dependencies = [ + ("gwardia", "0003_rename_nextmeeting_meeting"), + ] + + operations = [ + migrations.RenameField( + model_name="meeting", + old_name="date_of_meeting", + new_name="date", + ), + ] diff --git a/gwardia/models.py b/gwardia/models.py index 2187453..7e43228 100644 --- a/gwardia/models.py +++ b/gwardia/models.py @@ -1,10 +1,14 @@ from django.db import models +from django.utils import timezone class Meeting(models.Model): title = models.CharField(max_length=150) description = models.TextField() - date_of_meeting = models.DateTimeField("Date of meeting") + date = models.DateTimeField("Date of meeting") + + def is_archival(self): + return self.date < timezone.now() def __str__(self): return f"{self.title} - {self.description:<50}" diff --git a/gwardia/templates/gwardia/index.html b/gwardia/templates/gwardia/index.html index 01882d3..e6ce493 100644 --- a/gwardia/templates/gwardia/index.html +++ b/gwardia/templates/gwardia/index.html @@ -2,27 +2,30 @@ {% block title %}Panel Gwardii{% endblock %} +{% load list_events %} + {% block content %}

Panel Gwardii! WIP!

Kliknij w dane spotkanie, by wyświetlić jego opis

- +
+ {% list_events upcoming_meetings "Nadchodzące" %} +
+ +
{% endblock %} diff --git a/gwardia/templates/gwardia/list_events.html b/gwardia/templates/gwardia/list_events.html new file mode 100644 index 0000000..4ed4944 --- /dev/null +++ b/gwardia/templates/gwardia/list_events.html @@ -0,0 +1,23 @@ +

{{ title }} spotkania

+ \ No newline at end of file diff --git a/gwardia/templatetags/__init__.py b/gwardia/templatetags/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/gwardia/templatetags/list_events.py b/gwardia/templatetags/list_events.py new file mode 100644 index 0000000..ef7dbbe --- /dev/null +++ b/gwardia/templatetags/list_events.py @@ -0,0 +1,8 @@ +from django import template + +register = template.Library() + + +@register.inclusion_tag("gwardia/list_events.html") +def list_events(events, title): + return {"events": events, "title": title} diff --git a/gwardia/views.py b/gwardia/views.py index 6bb6906..0ba33f1 100644 --- a/gwardia/views.py +++ b/gwardia/views.py @@ -5,6 +5,14 @@ def index(request): - upcoming_meetings = Meeting.objects.filter(date_of_meeting__gte=timezone.now()).order_by("date_of_meeting") - context = {"upcoming_five_meetings": upcoming_meetings[:5]} + upcoming_meetings = Meeting.objects.filter(date__gte=timezone.now()).order_by( + "-date" + ) + archival_meetings = Meeting.objects.filter(date__lt=timezone.now()).order_by( + "-date" + ) + context = { + "upcoming_meetings": upcoming_meetings, + "archival_meetings": archival_meetings, + } return render(request, "gwardia/index.html", context) diff --git a/poetry.lock b/poetry.lock index f32d4cc..ad704aa 100644 --- a/poetry.lock +++ b/poetry.lock @@ -225,45 +225,44 @@ files = [ [[package]] name = "ruff" -version = "0.3.6" +version = "0.3.7" description = "An extremely fast Python linter and code formatter, written in Rust." optional = false python-versions = ">=3.7" files = [ - {file = "ruff-0.3.6-py3-none-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl", hash = "sha256:732ef99984275534f9466fbc01121523caf72aa8c2bdeb36fd2edf2bc294a992"}, - {file = "ruff-0.3.6-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:93699d61116807edc5ca1cdf9d2d22cf8d93335d59e3ff0ca7aee62c1818a736"}, - {file = "ruff-0.3.6-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:fc4006cbc6c11fefc25f122d2eb4731d7a3d815dc74d67c54991cc3f99c90177"}, - {file = "ruff-0.3.6-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:878ef1a55ce931f3ca23b690b159cd0659f495a4c231a847b00ca55e4c688baf"}, - {file = "ruff-0.3.6-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:ecb87788284af96725643eae9ab3ac746d8cc09aad140268523b019f7ac3cd98"}, - {file = "ruff-0.3.6-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:b2e79f8e1b6bd5411d7ddad3f2abff3f9d371beda29daef86400d416dedb7e02"}, - {file = "ruff-0.3.6-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:cf48ec2c4bfae7837dc325c431a2932dc23a1485e71c59591c1df471ba234e0e"}, - {file = "ruff-0.3.6-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:c466a52c522e6a08df0af018f550902f154f5649ad09e7f0d43da766e7399ebc"}, - {file = "ruff-0.3.6-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:28ccf3fb6d1162a73cd286c63a5e4d885f46a1f99f0b392924bc95ccbd18ea8f"}, - {file = "ruff-0.3.6-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:b11e09439d9df6cc12d9f622065834654417c40216d271f639512d80e80e3e53"}, - {file = "ruff-0.3.6-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:647f1fb5128a3e24ce68878b8050bb55044c45bb3f3ae4710d4da9ca96ede5cb"}, - {file = "ruff-0.3.6-py3-none-musllinux_1_2_i686.whl", hash = "sha256:2b0c4c70578ef1871a9ac5c85ed7a8c33470e976c73ba9211a111d2771b5f787"}, - {file = "ruff-0.3.6-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:e3da499ded004d0b956ab04248b2ae17e54a67ffc81353514ac583af5959a255"}, - {file = "ruff-0.3.6-py3-none-win32.whl", hash = "sha256:4056480f5cf38ad278667c31b0ef334c29acdfcea617cb89c4ccbc7d96f1637f"}, - {file = "ruff-0.3.6-py3-none-win_amd64.whl", hash = "sha256:f1aa621beed533f46e9c7d6fe00e7f6e4570155b61d8f020387b72ace2b42e04"}, - {file = "ruff-0.3.6-py3-none-win_arm64.whl", hash = "sha256:7c8a2a0e0cab077a07465259ffe3b3c090e747ca8097c5dc4c36ca0fdaaac90d"}, - {file = "ruff-0.3.6.tar.gz", hash = "sha256:26071fb530038602b984e3bbe1443ef82a38450c4dcb1344a9caf67234ff9756"}, + {file = "ruff-0.3.7-py3-none-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl", hash = "sha256:0e8377cccb2f07abd25e84fc5b2cbe48eeb0fea9f1719cad7caedb061d70e5ce"}, + {file = "ruff-0.3.7-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:15a4d1cc1e64e556fa0d67bfd388fed416b7f3b26d5d1c3e7d192c897e39ba4b"}, + {file = "ruff-0.3.7-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d28bdf3d7dc71dd46929fafeec98ba89b7c3550c3f0978e36389b5631b793663"}, + {file = "ruff-0.3.7-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:379b67d4f49774ba679593b232dcd90d9e10f04d96e3c8ce4a28037ae473f7bb"}, + {file = "ruff-0.3.7-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:c060aea8ad5ef21cdfbbe05475ab5104ce7827b639a78dd55383a6e9895b7c51"}, + {file = "ruff-0.3.7-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:ebf8f615dde968272d70502c083ebf963b6781aacd3079081e03b32adfe4d58a"}, + {file = "ruff-0.3.7-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:d48098bd8f5c38897b03604f5428901b65e3c97d40b3952e38637b5404b739a2"}, + {file = "ruff-0.3.7-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:da8a4fda219bf9024692b1bc68c9cff4b80507879ada8769dc7e985755d662ea"}, + {file = "ruff-0.3.7-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6c44e0149f1d8b48c4d5c33d88c677a4aa22fd09b1683d6a7ff55b816b5d074f"}, + {file = "ruff-0.3.7-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:3050ec0af72b709a62ecc2aca941b9cd479a7bf2b36cc4562f0033d688e44fa1"}, + {file = "ruff-0.3.7-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:a29cc38e4c1ab00da18a3f6777f8b50099d73326981bb7d182e54a9a21bb4ff7"}, + {file = "ruff-0.3.7-py3-none-musllinux_1_2_i686.whl", hash = "sha256:5b15cc59c19edca917f51b1956637db47e200b0fc5e6e1878233d3a938384b0b"}, + {file = "ruff-0.3.7-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:e491045781b1e38b72c91247cf4634f040f8d0cb3e6d3d64d38dcf43616650b4"}, + {file = "ruff-0.3.7-py3-none-win32.whl", hash = "sha256:bc931de87593d64fad3a22e201e55ad76271f1d5bfc44e1a1887edd0903c7d9f"}, + {file = "ruff-0.3.7-py3-none-win_amd64.whl", hash = "sha256:5ef0e501e1e39f35e03c2acb1d1238c595b8bb36cf7a170e7c1df1b73da00e74"}, + {file = "ruff-0.3.7-py3-none-win_arm64.whl", hash = "sha256:789e144f6dc7019d1f92a812891c645274ed08af6037d11fc65fcbc183b7d59f"}, + {file = "ruff-0.3.7.tar.gz", hash = "sha256:d5c1aebee5162c2226784800ae031f660c350e7a3402c4d1f8ea4e97e232e3ba"}, ] [[package]] name = "sqlparse" -version = "0.4.4" +version = "0.5.0" description = "A non-validating SQL parser." optional = false -python-versions = ">=3.5" +python-versions = ">=3.8" files = [ - {file = "sqlparse-0.4.4-py3-none-any.whl", hash = "sha256:5430a4fe2ac7d0f93e66f1efc6e1338a41884b7ddf2a350cedd20ccc4d9d28f3"}, - {file = "sqlparse-0.4.4.tar.gz", hash = "sha256:d446183e84b8349fa3061f0fe7f06ca94ba65b426946ffebe6e3e8295332420c"}, + {file = "sqlparse-0.5.0-py3-none-any.whl", hash = "sha256:c204494cd97479d0e39f28c93d46c0b2d5959c7b9ab904762ea6c7af211c8663"}, + {file = "sqlparse-0.5.0.tar.gz", hash = "sha256:714d0a4932c059d16189f58ef5411ec2287a4360f17cdd0edd2d09d4c5087c93"}, ] [package.extras] -dev = ["build", "flake8"] +dev = ["build", "hatch"] doc = ["sphinx"] -test = ["pytest", "pytest-cov"] [[package]] name = "typing-extensions" diff --git a/static/GwardiaHub/tailwind_custom_styles.js b/static/GwardiaHub/tailwind_custom_styles.js new file mode 100644 index 0000000..8a80199 --- /dev/null +++ b/static/GwardiaHub/tailwind_custom_styles.js @@ -0,0 +1,11 @@ +// Used for custom styles in templates + +tailwind.config = { + theme: { + extend: { + borderWidth: { + '12': '12px', + }, + }, + }, +} \ No newline at end of file