Dasa
Django allauth with cookie cutter
Dasa
cj
cj
cj
there are thousands of templates made with cookiecutter 🤷🏻♂️
None
Hello. Did anybody work with wagtail?
Akash
Hello. Did anybody work with wagtail?
Many people probably did.
Ask direct questions that will be answered...
People will usually avoid replying to these any such user, anyone used this questions.
Raghava
Hi, I need to detect a persons exact location and store it in models can anyone suggest how should i proceed. Like should i use google maps api or django easy maps or......
Rajjix
Raghava
Rajjix
but i’s not as accurate as google maps, for that i think u’ll need to pay to use their geolocation api and might require some more coding on ur side
gamer_boy
http://dpaste.com/2PP09V9
gamer_boy
detail.html👆
gamer_boy
plz help me to solve this error
gamer_boy
http://dpaste.com/3BCV18A
gamer_boy
app/urls.py
cj
change question.id for question_id
gamer_boy
i tried but still it gives me error
cj
question_id=object.id 🤦🏻♂️
Rajjix
are u passing the question id to ur vote view?
cj
you just have to change a . for a _ 🙄
Rajjix
gamer_boy
gamer_boy
k
gamer_boy
thank you ☺️
Shubham
Hello do anybody has working knowledge about vagrant? I have one query
Shubham
Whenever I hit the command vagrant up and the vagrant ssh , server start , then each time I need to install virtual env
Shubham
I meant everytime its not dynamic
Shubham
https://docs.google.com/document/d/1Wpgh_Mpa1ko8zuvJmkU7bwtzUIL2h9iQZ-13V1ODik4/edit?usp=drivesdk
Shubham
Please have a look
Rajjix
i think for ur use-case docker can be a lot less of a headache, haven’t use vargant before, just an open suggestion as they almost serve the same purpose
Shubham
Ya I heard that too
Shubham
Thnx
Shubham
I will use it
Rajjix
good luck 🍀
Rammanoj
hey, is there any way to send a file along with json data in postman
Rammanoj
?
Rajjix
Google said yes 😁
Rajjix
Googles’ answer not mine 🤷♂️
send+file+postman
Rajjix
or post would be better
Rammanoj
yep , I did and in stackoverflow I got an answer that we need to send it using the form data.
Rammanoj
it successfully sends the data
Rajjix
If this is the same error i had some time ago here’s how i fixed it
Rajjix
In ur api view add an attribute like so,
renderer_classes = (JSONRenderer, )
Rajjix
from rest_framework.renderers import JSONRenderer
Rajjix
btw code=‘blank’ is not json data
Rajjix
“Code”:”blank” is
Rammanoj
thanks @Rajjix but its not working, for all the other api viewsI am giving json data as input and it worked. But for this I gave form data even specifying renderer_classes giving same html response
Rammanoj
Rajjix
ur model is sending an error string=‘something’ that’s not json format
Rajjix
I think that’s ur problem
Rammanoj
maybe but I am not able to find the exact error, I will paste the codes in dpaste one sec
Rajjix
Ur examduraion field
Rajjix
Assign those 2 fields a default vaule and u won’t see this error but that won’t fix the problem
Rajjix
Exam_duration and code
Rammanoj
these are my code snippets:
1. https://dpaste.de/bGB1 -- models.py
2. https://dpaste.de/gSiz -- serializers.py
3. https://dpaste.de/Behy -- views.py
Rajjix
Exactly what i’m saying xd
Rajjix
because that’s not what django model does out of the box 📦
Rajjix
but what i would have done in this case is use serializers to validate ur data instead of the model
Rajjix
It’s much easier
Rammanoj
but I have to consider each and every case right ??
Rajjix
what do you mean each an every case ?
Rammanoj
such as if the user has given input or not to a field and if it is given is the input given by him is valid or not etc
Rammanoj
eg: in case of publication_date it can't be less that today, and it has to be valid publication date in specified format
Rajjix
two things u need to know
Rajjix
validate_<field_name> is same as django clean_<field_name>, only difference is you raise serializers.ValidationError in case data is not right
Rajjix
and u can check for model data in ur serializers as well and raise validation error accordingly, if something is not right
Rammanoj
Rammanoj
thanks @Rajjix will do that
Rajjix
no probs, good luck 🍀
Rammanoj
no probs, good luck 🍀
@Rajjix got the exact error now. I am calling the super class (i.e super.post(request, *args, *kwargs) from try block). So whenever the error comes, it is being handled by the try block. Hence django is raising the exception instead of returning the json response.