-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Description
Responder does not have a single primary key field but has composite key of incident_id and responder_id, what is best path for representing this as model and as a retrieve endpoint?
Current model, which works for list method:
class Responder(models.Model):
incident_id = models.IntegerField(primary_key=True)
responder_id = models.IntegerField()
responderunit = models.ForeignKey('ResponderUnit', models.DO_NOTHING, blank=True, null=True)
codetosc = models.IntegerField(blank=True, null=True)
class Meta:
managed = False
db_table = 'responder'
unique_together = [
('incident_id', 'responder_id'),
]
This fails though when using a generics.RetrieveAPIView, as an attempt to retrieve a responder instance based on primary key will return many when the get() method is expecting a single instance.
A possible solution is to keep current model and build custom endpoint that will expect multiple responses for the single endpoint.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels