Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add icon to TechGroup #80

Merged
merged 4 commits into from
Apr 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions src/web/migrations/0007_techgroup_icon.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 5.0.1 on 2024-03-28 19:15

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('web', '0006_alter_event_duration'),
]

operations = [
migrations.AddField(
model_name='techgroup',
name='icon',
field=models.CharField(blank=True, help_text='Emojji or Font Awesome CSS icon class(es) to represent the group.', max_length=256),
),
]
6 changes: 5 additions & 1 deletion src/web/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

from django.db import models
from django.urls import reverse

from handyhelpers.models import HandyHelperBaseModel


Expand All @@ -14,6 +13,11 @@ class TechGroup(HandyHelperBaseModel):
enabled = models.BooleanField(default=True)
# platform = models.ForeignKey("EventPlatform", blank=True, null=True, on_delete=models.SET_NULL)
homepage = models.URLField(blank=True, null=True)
icon = models.CharField(
joeriddles marked this conversation as resolved.
Show resolved Hide resolved
max_length=256,
blank=True,
help_text="Emojji or Font Awesome CSS icon class(es) to represent the group.",
)

def __str__(self) -> str:
return self.name
Expand Down
18 changes: 8 additions & 10 deletions src/web/views.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
from typing import Any

from django.http import HttpRequest, HttpResponse
from django.shortcuts import render
from django.utils import timezone
from django.template import loader

from django.utils import timezone
from django.views.generic import DetailView
from handyhelpers.views.gui import HandyHelperListView, HandyHelperIndexView
from handyhelpers.views.calendar import CalendarView
from handyhelpers.mixins.view_mixins import HtmxViewMixin
from handyhelpers.views.htmx import BuildModelSidebarNav, BuildBootstrapModalView

from handyhelpers.views.calendar import CalendarView
from handyhelpers.views.gui import HandyHelperIndexView, HandyHelperListView
from handyhelpers.views.htmx import BuildBootstrapModalView, BuildModelSidebarNav

from web.models import Event, TechGroup

Expand All @@ -23,9 +22,8 @@ def __init__(self, **kwargs: Any) -> None:
self.item_list = [
{
"url": tech_group.get_absolute_url(),
"icon": "fa-brands fa-python", # TODO: add this to the TechGroup model
"icon": tech_group.icon,
"title": str(tech_group),
"description": (tech_group.description or "")[:100],
}
for tech_group in TechGroup.objects.all()
]
Expand Down Expand Up @@ -72,11 +70,11 @@ class BuildSidebar(BuildModelSidebarNav):

menu_item_list = [
{
"queryset": Event.objects.filter(date_time__gte=timezone.now()),
"queryset": Event.objects.filter(date_time__gte=timezone.now()).order_by("date_time"),
"icon": """<i class="fa-solid fa-calendar-day"></i>""",
},
{
"queryset": TechGroup.objects.filter(enabled=True),
"queryset": TechGroup.objects.filter(enabled=True).order_by("name"),
"icon": """<i class="fa-solid fa-people-group"></i>""",
},
]
Expand Down