Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7k
Closed
Labels
Milestone
Description
I have an object with foreign keys and when I load aOPTIONS request for that object type, it shows me a truly insane JSON object with every possible value for the foreign key (there are millions!)
So, for example, I have this object:
class OpinionCluster(models.Model): """A class representing a cluster of court opinions.""" docket = models.ForeignKey( Docket, help_text="The docket that the opinion cluster is a part of", related_name="clusters", )Which is serialized with:
classOpinionClusterSerializer(serializers.HyperlinkedModelSerializer):docket=serializers.HyperlinkedRelatedField(many=False,view_name='docket-detail',queryset=Docket.objects.all(),style={'base_template':'input.html'}, )
When I load this withOPTIONS, I get back something that contains:
"docket": {"type":"field","required":true,"read_only":false,"label":"Docket","choices": [ {"display_name":"4: United States v. Goodwin","value":"http://127.0.0.1:8000/api/rest/v3/dockets/4/" }, {"display_name":"5: Quality Cleaning Products v. SCA Tissue of North America","value":"http://127.0.0.1:8000/api/rest/v3/dockets/5/" },....millions more....
I know that there's a way todisable listing these items in the form of the HTML view, but in the OPTIONS request we need better default functionality than displaying millions of records.