inchidi
which one?
Allen
Hey, I created forms for users to input information about themselves, but now I need a template to display the data input
Allen
I need help creating a template to display content of the forms
inchidi
inchidi
Anders (izzno / gooood) π³π΄
models FileField upload_to?
imagefield, i want ti slugify the name (as there will potensially be 1000s)
inchidi
inchidi
models.ImageField inherit models.FileField btw
Anders (izzno / gooood) π³π΄
lets see
Anders (izzno / gooood) π³π΄
upload_to=lamda i, f: f"products/{join(slugify(i.part_number)/", f)}
Anders (izzno / gooood) π³π΄
something in that matter
Anders (izzno / gooood) π³π΄
i am considering putting them in folders bacouse of the unpredictable file names.
Anders (izzno / gooood) π³π΄
splitting and getting the .jpg .gif .png right could be hard...
Anders (izzno / gooood) π³π΄
was some mistakes in the code.. No linter ;). But my question is really if its fround uppon using lambdas
inchidi
inchidi
i think thing you should check is the migration file
Anders (izzno / gooood) π³π΄
Any advice as to make the filestructure more "readable", would you try and change the filename or put them in folders? Would be a hell of alot of folders.... (Good advice, ill check the sql output)
inchidi
Anders (izzno / gooood) π³π΄
These folders will only conatin one file though. Maybe better to append the slug pre-filename...
inchidi
inchidi
because there, your image field will be parsed to something more verbose
Anders (izzno / gooood) π³π΄
ahh
inchidi
Anders (izzno / gooood) π³π΄
mhm...
Anders (izzno / gooood) π³π΄
agreed :), thanks
inchidi
you're welcome
cj
Rajab
Hello guys!! How to read or extract .arj files (archive files)??? by example pls
οΈ
Hello everyone, I'm learning django and going to build a project which includes django-cms for public blog, and an API that interacts with a mobile app.
So is it good idea to separate the cms from the api considering future scalability?
cj
cj
you just could share the DB/Models to get the posts and/or comments
οΈ
cj
οΈ
they can
sorry for bothering, but i can't understand how to implement that.. If i'm going to initialise two django projects, how the handle urls like:
mysite.com/blog/
and mysite.com/api/
Mirco
Mirco
As you wrote, same domain, different paths
οΈ
Mirco
cj
Anders (izzno / gooood) π³π΄
you're welcome
for the record
upload_to=lambda instance, filename: f'product_items/{slugify(instance.part_number)}/{filename}'
Works just fine ;)
Krishna Praneeth
Hi,
I am getting MultipleObjectsReturned at tweet/1
Krishna Praneeth
Can anyone tell how I can resolve it
Mirco
You have more tweets with that id and your .get() returns more than 1 , using a filter() should help u on finding the bad one
Krishna Praneeth
Thank you lt helped me
Mirco
yw :)
Abdulboriy Alimov (Abdulboriy Ibn Abdulxay Ibn Sharif Al-Uzbek)
Hi!
Abdulboriy Alimov (Abdulboriy Ibn Abdulxay Ibn Sharif Al-Uzbek)
I had a question(sorry if it was asked bunch of times)
Abdulboriy Alimov (Abdulboriy Ibn Abdulxay Ibn Sharif Al-Uzbek)
I know python and is it compulsary to learn HTML CSS in order to learn Django??
Anonymous
No
inchidi
Abdulboriy Alimov (Abdulboriy Ibn Abdulxay Ibn Sharif Al-Uzbek)
inchidi
then you can just start with the official docs tutorial
Abdulboriy Alimov (Abdulboriy Ibn Abdulxay Ibn Sharif Al-Uzbek)
Thanks)
Abdulboriy Alimov (Abdulboriy Ibn Abdulxay Ibn Sharif Al-Uzbek)
I got kinda book but it was little bit boring)
Abdulboriy Alimov (Abdulboriy Ibn Abdulxay Ibn Sharif Al-Uzbek)
Hope these materials will help me)
Patrick
Hi everyone, does anyone here know/can confirm if we can always trust that Model.objects.bulk_create will always return objs in the same order they were passed? I took a look at the Django code for it, and it looks like it does. But in case someone else here already needed something similar and could provide a feedback
Anders (izzno / gooood) π³π΄
Django cant use Lambdas...
Anders (izzno / gooood) π³π΄
I was wrong.
Mirco
Anders (izzno / gooood) π³π΄
upload_to= cant be lambdas
Anders (izzno / gooood) π³π΄
Cant be serialized to sql...
Mirco
😭😭
Anders (izzno / gooood) π³π΄
hm, does anyone know if it reads the code ? I was going down another route now to make one function "to rule them all" and make switches based on instance.class.name ... This wont work if it "reads" the code and does not initialize the classes on serializion
Anders (izzno / gooood) π³π΄
solution for anyone interested:
https://pastebin.com/ZHb54413
cj
Anders (izzno / gooood) π³π΄
👍
Anonymous
How to create cookies and sessions in django
Sampreeth
How we can implement dependency drop-down lists
Patrick
Anonymous
So I am new
Anonymous
How could I setup Django in windows
Anonymous
Windows 10
Rohan
....
Rohan
Just put some effort and you're good to go :)
Anonymous
Mm
Nithin
I have a datetime column, and i want to show the data grouped month wise, date wise, wwek wise etc.
I can either use db itself to do it (using annotate and Trunc) or can load all data in to a pandas dataframe and resample it.
So which of these approaches is faster? Should i do processing in db or pandas?
Mirco
Nithin
My question is should try to all the operations in db itself or should i do them in python? Caz i read somewhere processing in db is always faster