tfhx8
Sorry?
Why not use transactions in method save() ?
tfhx8
In model, instead signal
tfhx8
Can you send example job code transactions where used money?
tfhx8
interesting to see your method
tfhx8
Here not method transation
Cesar
Why not use transactions in method save() ?
i dont know, never saw how to check if its been created or modified
Cesar
guess it could be checking self.id maybe 🧐
tfhx8
Here can collision
tfhx8
Where is with transaction.atomic ?
tfhx8
It no
Cesar
please share your solution to this "problem"
Batman
guess it could be checking self.id maybe 🧐
that's exactly how you do it
Cesar
But whats the problem with using signals?
tfhx8
please share your solution to this "problem"
Need wrapper code with transaction.atomic():
Yash
I am working on excel file uploaded from user form, modifying it using openpyxl lib. After making changes, I want to convert file to pdf and export the file back to user. How can I achieve this?
Eric
I am working on excel file uploaded from user form, modifying it using openpyxl lib. After making changes, I want to convert file to pdf and export the file back to user. How can I achieve this?
You're already halfway there. Use openpyxl.utils.dataframe to organize your data. Then use reportlab library to generate a PDF
Yash
You're already halfway there. Use openpyxl.utils.dataframe to organize your data. Then use reportlab library to generate a PDF
Thanks Eric but I can't understand utils.dataframe. Where do I need to save the file to use it for reportlab conversion?
Rish
My html page show code on chrome browser
Rish
Give me solution
Mirco
Give me solution
Give us the magic ball
Mirco
My html page show code on chrome browser
The best candidate is a not closed tag
Jimmies San
Give me solution
give me 500 dollars
DCT
Pls give me tutorial for django
Cesar
Pls give me tutorial for django
Have you tried google? It's a new tool for search in the internet...
Bunty chhatri wala..
Tutorial on CDuD practice using FBV's without using django forms. Anyone?
Bunty chhatri wala..
CRUD*
Doragonsureiyā
Pls give me tutorial for django
Check out PythonRes, a channel for Python resources (links to help you out).
AJ
Pls give me tutorial for django
https://djangocentral.com/building-a-blog-application-with-django/
Viktor🔮
Viktor🔮
I guess you have studied Python with google, is it hard to find a tutorial for Django?
maroong
I am really confused about images. How do I display an image with img src without storing it or creating a static folder
Mirco
Use something like imgur or you can host images in CDN or Amazon s3
CDN ( Cloudfront ) can be used with S3 too ☺️
AJ
However I have never used a CDN or sperate storage myself 🤔
AJ
I use free cloudlfare cdn
Anonymous
how to open static pdf files in templates
Martín
hello, this may be a very newbie question I have a cookiecutter-django project I want to get the base URL in Python code, so that if the url is http://myweb.domain.com:8000/admin/anything I want to get http://myweb.domain.com:8000 preferably without a trailing slash ('/') at the end as shown I googled and found a get_current_site in django.contribs, but I think it goes to the database Is there any way to retrieve this base URL for saving it in a variable in my settings? Is get_current_site and the database the only way to go to do this (other than hardcoding or environment variables)?
Martín
aham
Martín
I'm going to make my first django/heroku deployment
Mirco
Doesn't care the platform
Martín
so I don't know which is going to be the domain yet
Mirco
Yup u know
Martín
so I think an environment variable should be the way
Martín
ok, I'm trying and asking if any trouble shows up
Martín
thanks
Mirco
!yw
Doragonsureiyā
You're welcome! 😊
Martín
hi again is there some way to get the current scheme being used? so that I know if the web is http or https?
Martín
but I want to write code which works locally and in production
Mirco
For doing what ? Maybe there's an easy way instead of checking protocol
Martín
well, I'm using the base URL of the web to access an chrooted SFTP so if I add /some/directories/ to the URL, after some checks it accesses /some/directories in the SFTP
Martín
until now I had in the base.py a SERVER_URL variable
Martín
hardcoded
Martín
but I'm changing precisely that
Batman
until now I had in the base.py a SERVER_URL variable
is that to allow your app to be run on that particular domain only?
Martín
I could hardcode https in production.py and http in local.py
Mirco
I could hardcode https in production.py and http in local.py
Why do you wanna hardcode it ? Django has lots of settings needed to be set when you go on production and of course even the ones related to https
Mirco
If you run manage.py check --deploy you will see the list of them
Martín
is that to allow your app to be run on that particular domain only?
idk if I understand you the SERVER_URL is the http[s]://myweb.mydomain.com[:port] string I'm using all the time to build the new url to go to
Martín
Why do you wanna hardcode it ? Django has lots of settings needed to be set when you go on production and of course even the ones related to https
no, I want to do the opposite of hardcoding, remember that the question was how could I know the scheme between http and https
Mirco
no, I want to do the opposite of hardcoding, remember that the question was how could I know the scheme between http and https
Yup and I told u there's better way to do that instead of fill code of many if blocks about request scheme
Batman
no, I want to do the opposite of hardcoding, remember that the question was how could I know the scheme between http and https
depends on where do u want to access it? if if it's within the template there's a way to do it
Mirco
Just read Django docs about going on prod
Mirco
Python code
I strongly recommend to read Django docs accurately about deploying stage
Mirco
You will.find lots of answers
Martín
ok, I'm googling
Mirco
ok, I'm googling
Just go to Django docs official site