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
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
⚘
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 :(
George
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 ??
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?
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?
Anonymous
inchidi
Mirco
George
Anonymous
How do you know for sure, that the second user was the real one?
inchidi
Anonymous
But he has 24 hours to confirm
Anonymous
It*
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
inchidi
inchidi
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
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
Anonymous
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
cj
Anonymous
cj
Anjani
How to save nested model? How to avoid saving any one if there errors occured?
Anonymous
inchidi
inchidi
Anonymous
Let me make you understand
Anonymous
User1(fake) comes and signup