55 LocalNotification ,
66 Onboarding ,
77 Reminder ,
8- UserInfo ,
98)
109
1110
@@ -26,7 +25,7 @@ class Meta:
2625
2726 def get_userinfo (self , obj ):
2827 serializer = UserInfoSerializer (
29- UserInfo . objects . filter ( lapsed = obj . id ), many = True , context = self .context
28+ obj . userinfo . all ( ), many = True , context = self .context
3029 )
3130
3231 # Flaten the list of dictionaries
@@ -46,7 +45,7 @@ class Meta:
4645
4746 def get_userinfo (self , obj ):
4847 serializer = UserInfoSerializer (
49- UserInfo . objects . filter ( onboarding = obj . id ), many = True , context = self .context
48+ obj . userinfo . all ( ), many = True , context = self .context
5049 )
5150
5251 # Flaten the list of dictionaries
@@ -75,10 +74,10 @@ def __init__(self, instance=None, data=dict(), **kwargs): # noqa: B006
7574
7675 def to_representation (self , instance ):
7776 serialized_onboarding = OnboardingSerializer (
78- Onboarding .objects .all (), many = True , context = self .context
77+ Onboarding .objects .prefetch_related ( 'userinfo' ). all (), many = True , context = self .context
7978 )
8079
81- serialized_lapsed = LapsedSerializer (Lapsed .objects .all (), many = True , context = self .context )
80+ serialized_lapsed = LapsedSerializer (Lapsed .objects .prefetch_related ( 'userinfo' ). all (), many = True , context = self .context )
8281
8382 serialized_reminder = ReminderSerializer (
8483 Reminder .objects .all (),
0 commit comments