Use _id suffix for all object reference in REST APIs
Activity
-
Newest first Oldest first
-
Show all activity Show comments only Show history only
- Ernesto Rico Schmidt changed milestone to %1.0-alpha2 —
Precise Pheasantchanged milestone to %1.0-alpha2 —
Precise Pheasant - Ernesto Rico Schmidt added 1 deleted label
added 1 deleted label
- Ernesto Rico Schmidt assigned to @eigenwijsje
assigned to @eigenwijsje
- Ernesto Rico Schmidt mentioned in issue aura#166 (closed)
mentioned in issue aura#166 (closed)
- Ernesto Rico Schmidt added P2 label
added P2 label
- Ernesto Rico Schmidt added To Do label
added To Do label
- Ernesto Rico Schmidt added Doing label and removed To Do label
- Ernesto Rico Schmidt mentioned in commit bb9218c3
mentioned in commit bb9218c3
- Author Owner
Every field that refers to an object has now the suffix
Id
orIds
in the REST API. - Ernesto Rico Schmidt closed
closed
- Ernesto Rico Schmidt removed Doing label
removed Doing label
- Owner
I’ve noticed an issue, and will post any additional findings here:
-
Note still has
contributors
field -
Profile still has
user
field -
Collision still has
repetitionOf
field -
Host still has
image
field -
make_conflicts
schedule object still hasrrule
andshow
fields. Possible fix:diff --git a/program/services.py b/program/services.py index 005192d..186c0e5 100644 --- a/program/services.py +++ b/program/services.py @@ -29,6 +29,7 @@ from django.forms.models import model_to_dict from django.utils import timezone from django.utils.translation import gettext_lazy as _ from program.models import Note, RRule, Schedule, ScheduleConflictError, Show, TimeSlot +from program.serializers import ScheduleSerializer from program.utils import parse_date, parse_datetime, parse_time from steering.settings import ( AUTO_SET_LAST_DATE_TO_DAYS_IN_FUTURE, @@ -440,7 +441,7 @@ def make_conflicts(data: ScheduleData, schedule_pk: int | None, show_pk: int) -> conflicts = generate_conflicts(timeslots) # create a new dictionary by adding "schedule" to conflicts - return dict(conflicts, schedule=model_to_dict(new_schedule)) + return dict(conflicts, schedule=ScheduleSerializer().to_representation(new_schedule))
-
There are other uses of
model_to_dict
in the conflict resolution module that might need to be replaced.
Edited by Ernesto Rico Schmidt -
Note still has
- Konrad Mohrfeldt reopened
reopened
- Ernesto Rico Schmidt mentioned in commit c2c3a9cc
mentioned in commit c2c3a9cc
- Author Owner
I have also replaced the use of
model_to_dict
in five places. - Ernesto Rico Schmidt closed
closed
Please register or sign in to reply