Hello,
I've run into a problem when making an external POST request (request
through web interface works). With all fields filled I still get 400 "This
field is required." error. Has anyone encountered similar problems?
My structure is:
models.py
class Zone(models.Model):
vanity = models.CharField(max_length=200, help_text='vanity name')
serializers.py
class ZoneSerializer(serializers.ModelSerializer):
class Meta:
model = Zone
fields = '__all__'
views.py
class ZoneViewSet(viewsets.ModelViewSet):
queryset = Zone.objects.all().order_by('vanity')
serializer_class = ZoneSerializer
permission_classes = (permissions.IsAuthenticatedOrReadOnly,)
urls.py
from rest_framework.routers import DefaultRouter
from django.conf.urls import url, include
from . import views
router = DefaultRouter()
router.register(r'zone', views.ZoneViewSet)
urlpatterns = [
url(r'^', include(router.urls)),
]
My request is:
http://192.168.19.84:8000/circadian/zone/?vanity=test
Using Postman and basic authorization with username and password.
--
You received this message because you are subscribed to the Google Groups
"Django REST framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.