Skip to content

Commit 3ff0154

Browse files
feat: include tickets in RegistrationResource (#10223)
1 parent 4aeb36e commit 3ff0154

File tree

1 file changed

+19
-4
lines changed

1 file changed

+19
-4
lines changed

ietf/meeting/resources.py

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,13 @@
2121
Attended,
2222
Registration, RegistrationTicket)
2323

24-
from ietf.name.resources import MeetingTypeNameResource
24+
from ietf.name.resources import (
25+
AttendanceTypeNameResource,
26+
MeetingTypeNameResource,
27+
RegistrationTicketTypeNameResource,
28+
)
29+
30+
2531
class MeetingResource(ModelResource):
2632
type = ToOneField(MeetingTypeNameResource, 'type')
2733
schedule = ToOneField('ietf.meeting.resources.ScheduleResource', 'schedule', null=True)
@@ -437,11 +443,16 @@ class Meta:
437443
}
438444
api.meeting.register(AttendedResource())
439445

440-
from ietf.meeting.resources import MeetingResource
441446
from ietf.person.resources import PersonResource
442447
class RegistrationResource(ModelResource):
443448
meeting = ToOneField(MeetingResource, 'meeting')
444449
person = ToOneField(PersonResource, 'person', null=True)
450+
tickets = ToManyField(
451+
'ietf.meeting.resources.RegistrationTicketResource',
452+
'tickets',
453+
full=True,
454+
)
455+
445456
class Meta:
446457
queryset = Registration.objects.all()
447458
serializer = api.Serializer()
@@ -456,13 +467,17 @@ class Meta:
456467
"country_code": ALL,
457468
"email": ALL,
458469
"attended": ALL,
470+
"checkedin": ALL,
459471
"meeting": ALL_WITH_RELATIONS,
460472
"person": ALL_WITH_RELATIONS,
473+
"tickets": ALL_WITH_RELATIONS,
461474
}
462475
api.meeting.register(RegistrationResource())
463476

464477
class RegistrationTicketResource(ModelResource):
465478
registration = ToOneField(RegistrationResource, 'registration')
479+
attendance_type = ToOneField(AttendanceTypeNameResource, 'attendance_type')
480+
ticket_type = ToOneField(RegistrationTicketTypeNameResource, 'ticket_type')
466481
class Meta:
467482
queryset = RegistrationTicket.objects.all()
468483
serializer = api.Serializer()
@@ -471,8 +486,8 @@ class Meta:
471486
ordering = ['id', ]
472487
filtering = {
473488
"id": ALL,
474-
"ticket_type": ALL,
475-
"attendance_type": ALL,
489+
"ticket_type": ALL_WITH_RELATIONS,
490+
"attendance_type": ALL_WITH_RELATIONS,
476491
"registration": ALL_WITH_RELATIONS,
477492
}
478493
api.meeting.register(RegistrationTicketResource())

0 commit comments

Comments
 (0)