Reputation: 505
I can't figure out why my UserResource is always displaying null for every object even though verified_by_id is correctly in the database for Observation model.
Relevant code:
class Observation(ProjModel):
verified_by = models.ForeignKey(User, null=True)
class Meta():
app_label = 'observation'
class ObservationResource(ProjResource):
verified_by = fields.ForeignKey(UserResource, 'user', full=True, null=True)
class Meta:
queryset = Observation.objects.all()
authentication = SessionAuthentication()
authorization = DjangoAuthorization()
resource_name = 'observation'
class UserResource(ProjResource):
class Meta:
queryset = User.objects.all()
authentication = SessionAuthentication()
authorization = DjangoAuthorization()
resource_name = 'user'
"objects": [{"verified_by": null}]
Upvotes: 1
Views: 83
Reputation: 9346
You need to ensure that all referenced Resources
are in your URL structure in order for them to appear.
Upvotes: 1