Milan
Maybe download attribute is much easier
Milan
to use
George
I dont need a download atribute
George
also it's for links, not for button objects
George
this is my code https://pastebin.com/yWsmaN8P
George
request is ok, pdf gets generated but download never happens, request gets a 200 response [30/Nov/2018 06:28:33] "GET /render/pdf/?inspection=1&powerplant=Rotasol HTTP/1.1" 200 6471
George
also, the console prints a lot of shit but no emerging download window
George
maybe i have to do something in the ajax call :/
Rohan
What I had to do was send mailers with dynamically generated pdfs from html
Rohan
wkhtmltopdf
Rohan
it uses QT webkit rendering engine
Rohan
https://github.com/wkhtmltopdf/wkhtmltopdf
help please
George
i have to add some working javascript to download
Rohan
Rohan
the pdf?
how can i install through .whl file in linux???
George
i have to add some working javascript to download
success: function(data) { // `data` is the return of the `load_cities` view function // console.log(data); var file = new Blob([data], {type: 'application/pdf'}); var fileURL = URL.createObjectURL(file); var a = document.createElement('a'); a.href = url; a.click(); window.URL.revokeObjectURL(url); }
George
George
good night
George
Well, id doesn't work correctly everywhere :(
Rohan
Well, id doesn't work correctly everywhere :(
You can generate downloaded link with django
George
You can generate downloaded link with django
well, my intent was doing it in javascript
George
its just a temporary file
George
the thing is for example that i get problems in browsers and chrome makes TWO requests POST and GET
George
Ok, now my problem is that i havent implemented a GET because chrome likes to make two requests
cbag
Groupe Django Pour les francophones : https://t.me/joinchat/G1el41CUUBS-YcVJHzjhNA
Anonymous
I am building an API with drf for my mobile client. Which is the better way of authentication to use ?? Session or token ??
Anonymous
I am building an API with drf for my mobile client. Which is the better way of authentication to use ?? Session or token ??
I am currently using token based authentication ( as it doesn't support multiple systems ) tried django-rest-knox is it better way also read about JWT which is the better package to proceed ??
Mirco
Have a look at djoser
Anonymous
Hello everyone
Anonymous
What is the best way to confirm if user is using their own email while registrarion?
cj
What is the best way to confirm if user is using their own email while registrarion?
sending a link to the email he is using, that redirects to a verification URL in your project to verify he is using an email he has access (high probabilities he is the owner) and continue the registration process
Anonymous
Yeah that is how i'm doing it
Anonymous
But when to expire the email token
cj
But when to expire the email token
you have to control it in your backend, you can "expire" it when the user opens the link, or if the users doesn't open it in like 24 hours, remove it from you DB
Anonymous
Yes, i'm expiring it after 24 hours
George
hi, how do you access str in a django template? {% for failure in params.failures %} <p>{{ failure.visible_failure.__str__ }} </p> <p>{{ failure.infrared_failure.__str__}} </p> {% endfor %} not working rn
Anonymous
Feels good that i'm doing it right
Anonymous
Now, if a user comes and register with another user email with wrong first name and last namw
Anonymous
Then after an hour, actual user comes and register what to do then?
inchidi
Then after an hour, actual user comes and register what to do then?
its up to you actually but usually i'll delete unverified user with email x if its exists when user register using email x
Anonymous
How do you know for sure, that the second user was the real one?
inchidi
How do you know for sure, that the second user was the real one?
actual user should able to see confirmation email link
Anonymous
But he has 24 hours to confirm
Anonymous
It*
inchidi
But he has 24 hours to confirm
doesnt mean if its already 24h his email verified tho
Mirco
nice
template filters are very useful, but as a senior django dev told me some time ago, try to make all logic stuff inside models/views as templates should just display your data without need computing
Anonymous
doesnt mean if its already 24h his email verified tho
Yes, i'll be deleting users older than 24 hours
inchidi
Yes, i'll be deleting users older than 24 hours
then you dont have any problem right?
Mirco
this is so true
yeah I think so!
Anonymous
Problem is, what should i do if another user comes and register with same email id as an other user did
Anonymous
Both of them has not verified yet
Anonymous
Should i keep these users data in DB?
Anonymous
Both user data*
cj
Now, if a user comes and register with another user email with wrong first name and last namw
the second user will see the confirmation link in his email, so... he will use that token, but get registered with the wrong name, let him change names freely 🤷🏻‍♂️
cj
Both of them has not verified yet
the first won't be verified because when he is using another people email, he couldn't access is inbox to see the confirmation message
inchidi
Problem is, what should i do if another user comes and register with same email id as an other user did
actually this is not the main problem, coz if its possible then thats mean everyone can spam your registration page
cj
better you can create a new token for the new user and expire the old token generated for the same email
Anonymous
And delete the fake one once actual user verified the email
Anonymous
yes
Okay
Anjani
How to save nested model? How to avoid saving any one if there errors occured?
inchidi
Yes, but should i keep boths user data individualy in the database?
thats why you dont need to keep both (all) user data
Anonymous
thats why you dont need to keep both (all) user data
But i cant show wrong data to the acrual user after login
inchidi
But i cant show wrong data to the acrual user after login
you wont, since the older user data will be deleted
Anonymous
Let me make you understand
Anonymous
User1(fake) comes and signup