Django Rest Framework 3 no longer supports the widget attribute in the serializer field. But to get an accessible API for viewing, try changing the style attribute to use 'base_template': 'input.html' , as shown in the following example:
class CustomerAddressSerializer(serializers.ModelSerializer): customer = serializers.IntegerField(source='customer_id' style={'base_template': 'input.html', 'placeholder': "Customer ID"}) class Meta: model = models.CustomerAddress fields = ('id', 'customer', 'street', 'zip', 'city')
Thus, your huge select tag with thousands of options foreign keys will change to plain text input . For more information, check out the docs at http://www.django-rest-framework.org/topics/browsable-api/#handling-choicefield-with-large-numbers-of-items
source share