Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
Pointer32377y@AlexDeLarge I'm not sure right now.
I have this setup:
Django + REST Framework + JWT for backend
NuxtJS + Axios for Frontend
I have an endpoint '/buildings', If I POST, it succeeds, no probs.
But, if I first make a GET /cities, then POST /buildings, Django stops recognizing the fields "state" and "city" of my request.
In other words,
First request, the data looks like this:
{ name, address, state, city, ...}
Then, after doing the two steps I mentioned earlier, all that Django sees is:
{name, address, ...} (yeah, no state nor city field, wtf)
I've been debugging and all I can see is that whenever that happens, the _writable_fields of the serializer does not contain the entries for both the state and city objects. BUT, as soon as I do a GET to /buildings AND POST thereafter, it works, wtf. -
Pointer32377yOh yeah, by now I've ruled out Axios as the issue, I just thought It'd be, but I tested again with both Postman and PyCharm's integrated REST tool and the issue remains (or fluctuates, it's driving me nuts)
-
Pointer32377yOh yeah, I forgot to mention, I've debugged and the request always contains the fields, it's just that django-rest serializator it's not loading them
Related Rants
-
Keepertje50Stop f*cking calling me minority or part of a underrepresented group. Yeah I noticed I am one of the only wome...
-
byoigres17A friend needed to test an API so, I told him to download Postman to start testing POST request and he ask if ...
-
pretzlerich22I've taken my Dev rant over to Linked in. Fuck you recruiters!
FUCKING SHIT, I HATE THIS
Does anyone have problems with axios?
I've been trying to make this work for at least 1 hour. If I use Postman, it works alright, but using axios messes it up.
Practically what happens it's that Django does not picks the foreign keys, it loads all the fields except those two.
I've been like fucking crazy trying to understand what's going on but to no avail... I want to die, it's friday and this stupid thing is delaying me more than it should
undefined
axios
django-rest
fuck you
postman