Skip to content

Commit b65cb2f

Browse files
committed
Add grants_waiting_list_update deadline type
Replace the awkward filtering by custom type with name matching for grants waiting list update deadlines with a proper dedicated deadline type. - Add `grants_waiting_list_update` to Deadline.TYPES enum - Update `_send_grant_waiting_list_email` to filter by new type - Add migration to convert existing custom deadlines with name "Update Grants in Waiting List" to the new type - Update CLAUDE.md to specify Docker-based development commands
1 parent efadf5a commit b65cb2f

File tree

5 files changed

+78
-11
lines changed

5 files changed

+78
-11
lines changed

CLAUDE.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,3 +79,21 @@ The project uses Docker Compose for local development with services:
7979
- Test configuration uses separate settings (`pycon.settings.test`)
8080
- Ruff handles both linting and formatting for Python code
8181
- Biome handles linting and formatting for JavaScript/TypeScript
82+
83+
## Local Development
84+
85+
**IMPORTANT**: When running locally, all Python/Django commands must run inside Docker. The local virtual environment will not work.
86+
87+
Use `docker exec pycon-backend-1` (without `-t` flag for non-interactive/script usage, with `-it` for interactive terminal).
88+
89+
- **Start services**: `docker-compose up` (starts all services)
90+
- **Run tests**: `docker exec pycon-backend-1 uv run pytest -l -s -vvv`
91+
- **Single test**: `docker exec pycon-backend-1 uv run pytest path/to/test_file.py::test_function -l -s -vvv`
92+
- **Lint/format**: `docker exec pycon-backend-1 uv run ruff check` and `docker exec pycon-backend-1 uv run ruff format`
93+
- **Type checking**: `docker exec pycon-backend-1 uv run mypy .`
94+
- **Django management**: `docker exec pycon-backend-1 uv run python manage.py <command>`
95+
- **Migrations**: `docker exec pycon-backend-1 uv run python manage.py makemigrations` and `docker exec pycon-backend-1 uv run python manage.py migrate`
96+
97+
**Troubleshooting**: If the backend container is not working:
98+
1. Restart container: `docker restart pycon-backend-1`
99+
2. If dependencies changed: Remove `backend/.venv` and rebuild with `docker-compose build --no-cache && docker-compose up`
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# Generated by Django 5.1.4 on 2026-01-28
2+
3+
from django.db import migrations, models
4+
5+
6+
def convert_custom_deadlines_to_grants_waiting_list_update(apps, schema_editor):
7+
"""
8+
Convert existing custom deadlines with name containing
9+
'Update Grants in Waiting List' to the new grants_waiting_list_update type.
10+
"""
11+
Deadline = apps.get_model("conferences", "Deadline")
12+
13+
# Update custom deadlines that have "Update Grants in Waiting List" in their name
14+
Deadline.objects.filter(
15+
type="custom", name__contains={"en": "Update Grants in Waiting List"}
16+
).update(type="grants_waiting_list_update")
17+
18+
19+
def revert_grants_waiting_list_update_to_custom(apps, schema_editor):
20+
"""
21+
Revert grants_waiting_list_update deadlines back to custom type.
22+
"""
23+
Deadline = apps.get_model("conferences", "Deadline")
24+
Deadline.objects.filter(type="grants_waiting_list_update").update(type="custom")
25+
26+
27+
class Migration(migrations.Migration):
28+
29+
dependencies = [
30+
("conferences", "0056_conference_max_proposals"),
31+
]
32+
33+
operations = [
34+
migrations.AlterField(
35+
model_name="deadline",
36+
name="type",
37+
field=models.CharField(
38+
choices=[
39+
("cfp", "Call for proposal"),
40+
("voting", "Voting"),
41+
("refund", "Ticket refund"),
42+
("grants", "Grants"),
43+
("badge_preview", "Badge preview"),
44+
("invitation_letter_request", "Invitation letter request"),
45+
("grants_waiting_list_update", "Grants waiting list update"),
46+
("custom", "Custom deadline"),
47+
],
48+
max_length=256,
49+
verbose_name="type",
50+
),
51+
),
52+
migrations.RunPython(
53+
convert_custom_deadlines_to_grants_waiting_list_update,
54+
revert_grants_waiting_list_update_to_custom,
55+
),
56+
]

backend/conferences/models/deadline.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ class Deadline(TimeFramedModel):
2323
("grants", _("Grants")),
2424
("badge_preview", _("Badge preview")),
2525
("invitation_letter_request", _("Invitation letter request")),
26+
("grants_waiting_list_update", _("Grants waiting list update")),
2627
("custom", _("Custom deadline")),
2728
)
2829

backend/grants/tasks.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ def _send_grant_waiting_list_email(grant_id, template_identifier):
137137
reply_url = urljoin(settings.FRONTEND_URL, "/grants/reply/")
138138

139139
deadline = grant.conference.deadlines.filter(
140-
type="custom", name__contains={"en": "Update Grants in Waiting List"}
140+
type="grants_waiting_list_update"
141141
).first()
142142

143143
_new_send_grant_email(

backend/grants/tests/test_tasks.py

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,7 @@ def test_send_grant_reply_waiting_list_email(settings, sent_emails):
7070
DeadlineFactory(
7171
start=datetime(2023, 3, 1, 23, 59, tzinfo=timezone.utc),
7272
conference=conference,
73-
type="custom",
74-
name={
75-
"en": "Update Grants in Waiting List",
76-
"it": "Update Grants in Waiting List",
77-
},
73+
type="grants_waiting_list_update",
7874
)
7975
grant = GrantFactory(conference=conference, user=user)
8076

@@ -432,11 +428,7 @@ def test_send_grant_reply_waiting_list_update_email(settings, sent_emails):
432428
DeadlineFactory(
433429
conference=grant.conference,
434430
start=datetime(2023, 3, 1, 23, 59, tzinfo=timezone.utc),
435-
type="custom",
436-
name={
437-
"en": "Update Grants in Waiting List",
438-
"it": "Update Grants in Waiting List",
439-
},
431+
type="grants_waiting_list_update",
440432
)
441433
conference_name = grant.conference.name.localize("en")
442434

0 commit comments

Comments
 (0)