Skip to content
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
11 changes: 11 additions & 0 deletions src/django_project/tests/unit/web/test_model_crud.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,17 @@ def test_update_location_address(self):
self.assertEqual(getattr(row, "location_address"), updated_value)
self.assertNotEqual(getattr(row, "location_address"), original_value)

def test_create_without_location(self):
"""verify event can be created without location fields"""
row = self.model.objects.create(
name="Locationless event",
start_datetime="2026-06-24T00:00:00Z",
location_name=None,
location_address=None,
)
self.assertIsNone(row.location_name)
self.assertIsNone(row.location_address)

def test_update_location_name(self):
"""verify location_name (CharField) can be updated"""
row = self.bake()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("web", "0004_alter_event_end_datetime"),
]

operations = [
migrations.AlterField(
model_name="event",
name="location_name",
field=models.CharField(
blank=True,
help_text="name of location where this event is being hosted",
max_length=64,
null=True,
),
),
migrations.AlterField(
model_name="event",
name="location_address",
field=models.CharField(
blank=True,
help_text="address of location where this event is being hosted",
max_length=256,
null=True,
),
),
]
2 changes: 2 additions & 0 deletions src/django_project/web/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,13 @@ class Event(HandyHelperBaseModel):
location_name = models.CharField(
max_length=64,
blank=True,
null=True,
help_text="name of location where this event is being hosted",
)
location_address = models.CharField(
max_length=256,
blank=True,
null=True,
help_text="address of location where this event is being hosted",
)
map_link = models.URLField(
Expand Down
3 changes: 3 additions & 0 deletions src/django_project/web/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,9 @@ def ingest_future_meetup_events(group_pk) -> str:
event_info = get_event_information(event_link)
event_info["group"] = group
if event_info:
event_info.setdefault("location_name", "")
event_info.setdefault("location_address", "")
event_info.setdefault("map_link", "")
if not event_info.get("name", None):
logging.error(f"error parsing name for event hosted by {group.name}; data = {event_info}")
continue
Expand Down
6 changes: 4 additions & 2 deletions src/django_project/web/templates/web/partials/li/events.htm
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@
<span class="text-secondary" style="font-size: 75%;">{{ row.group.name }}</span>
</div>
<div class="col-12 col-sm-4 mb-1 text-secondary text-start text-sm-end">
{{ row.location_name }}<br/>
<span class="text-muted" style="font-size: 75%;">{{ row.location_address }}</span>
{% if row.location_name or row.location_address %}
{{ row.location_name }}{% if row.location_address %}<br/>
<span class="text-muted" style="font-size: 75%;">{{ row.location_address }}</span>{% endif %}
{% endif %}
</div>
</div>
</li>
Expand Down
Loading