Skip to content

Commit 2dfa1fc

Browse files
committed
feat(event): add description
1 parent 70f9a50 commit 2dfa1fc

File tree

5 files changed

+45
-2
lines changed

5 files changed

+45
-2
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Generated by Django 4.2.20 on 2025-06-02 09:30
2+
3+
from django.db import migrations, models
4+
5+
6+
class Migration(migrations.Migration):
7+
8+
dependencies = [
9+
('common', '0002_event_google_calendar_event_id_and_more'),
10+
]
11+
12+
operations = [
13+
migrations.AddField(
14+
model_name='event',
15+
name='description',
16+
field=models.TextField(blank=True),
17+
),
18+
]

apps/common/models.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ class GoogleCalendarSyncStatus(models.IntegerChoices):
6363
FAILURE = 3, "Failure"
6464

6565
name = models.CharField(max_length=225)
66+
description = models.TextField(blank=True)
6667
type = models.PositiveSmallIntegerField(choices=Type.choices, default=Type.HOLIDAY)
6768

6869
# Google calendar

apps/common/utils/google_calendar.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,12 +174,17 @@ def _generate_google_calendar_event_data(event: Event | Deadline) -> "CalendarEv
174174
name = f"{emoji_icon} {event.display_name}"
175175
start_date = event.end_date # NOTE: Range creates noise in the calendar
176176

177-
description = f"Timur admin panel: {reverse_admin_panel(event, _type='change', absolute=True)}"
177+
description = ""
178+
if event.description:
179+
description += event.description + "\n\n"
180+
181+
admin_panel_edit_url = reverse_admin_panel(event, _type="change", absolute=True)
182+
description += f'Need to make changes to this event? <a href="{admin_panel_edit_url}">Click here to update it</a>'
178183

179184
payload: CalendarEvent = {
180185
"summary": name,
181186
"colorId": color_id,
182-
"description": "",
187+
"description": description,
183188
"start": {
184189
"date": start_date.isoformat(),
185190
},
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Generated by Django 4.2.20 on 2025-06-02 09:30
2+
3+
from django.db import migrations, models
4+
5+
6+
class Migration(migrations.Migration):
7+
8+
dependencies = [
9+
('project', '0013_project_short_name'),
10+
]
11+
12+
operations = [
13+
migrations.AddField(
14+
model_name='deadline',
15+
name='description',
16+
field=models.TextField(blank=True),
17+
),
18+
]

apps/project/models.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ class GoogleCalendarSyncStatus(models.IntegerChoices):
7171
FAILURE = 3, "Failure"
7272

7373
name = models.CharField(max_length=225)
74+
description = models.TextField(blank=True)
7475
project = models.ForeignKey(Project, on_delete=models.PROTECT, related_name="deadlines")
7576
contract = models.ForeignKey(
7677
"track.Contract",

0 commit comments

Comments
 (0)