Sir
How to add request.FILES in CreateView?
αмiʀ
I think you should create a mixin
Sir
Really? Just, a man said me i should make init and add there request.FILES, but i don't know how to make it...
Sir
Do you know how to make it?
Strauss21
Sir
Help me(((
Sir
It isn't the best idea...(for me)
Morteza
Sai Kumar
https://stackoverflow.com/questions/71275309/how-to-install-pillow-on-namecheap-server
Raul
What's ur mean?
for example, I have several models that correspond to lab techniques, if my users decide to add a new technique, give them that possibility, generating a new model in my database
Raul
A model builder
Hossein.A
Raul
Yes
Jerome
Strauss21
Jerome
Enes
It isn't the best idea...(for me)
I don't know then bro. You can take a look to the github repositories about that. But if you ask me there is no any problem to use function based views. At the end you will use a function in your class based view to solve your problem.
Anonymous
I need help
Anonymous
now l am building news blog
news post are shown at article list
I am going to show at home page also
give some advice to show one view at two templates
Dmitriy
Hi, if I want to create for example a parser, where should i put all the code.
It seems that Views were not made for this.
I've tried using management/command but cannot return results from call_command into Views, it only prints into console. stdout doesn't work for me.
What is the best practice for this?
Doragonsureiyā
Rule 5️⃣: To share code or error tracebacks, use an online pasting service like:
- https://dpaste.org
- https://linkode.org
- https://hastebin.com
- https://bin.kv2.dev
If you posted a wall of text, go back and delete it.
Sir
Sir
I looked request.POST, but there weren't my images fields((
Enes
Enes
i remember now you need to use request.FILES to get the image and other files
Enes
def upload(request):
if request.method == 'POST':
form = UploadForm(request.POST, request.FILES)
if form.is_valid():
upload = Upload()
upload.timestamp = datetime.datetime.now()
save_instance(form, upload)
Sir
Enes
if you didn't add please add this
<form action="" method="POST" enctype="multipart/form-data">
Sir
Enes
look at to the first answer
Fredy
Xeno
Help me!
It's a dict now, so just do sum(dict.values())
Xeno
Should work
Fredy
hm
can't display images after uploading from admin
Doragonsureiyā
can't display images after uploading from admin
Please provide a full explanation including all the details that you consider relevant. Your statement is too broad and there is no clear way to answer you, you have to explain:
- what you're doing
- what you're expecting
- what you're using
- where you're running the script
- what Python version you're using
- what packages and their versions you're using
- and the most important thing: show the code YOU wrote (read rule 5️⃣ for that)
and more details, that way your chances to get help will increase
hm
Fredy
Enes
Enes
add this to your urls.py
urlpatterns = [
path()
]+static (static(settings.static_url))
Thorka
Anyone familiar with dataclasses and could help me on this problem? https://dpaste.org/BSQi
Ehsan
Hello . I have a question . Must I learn js for programming django ?
Ehsan
Fredy
It's a dict now, so just do sum(dict.values())
It worked thanks... I need to add 10 columns, is there an optimal way to add columns?
I am currently doing.
Load.objects.filter(title='Python').aggregate(Sum('hours__hour_1'), Sum('hours__hour_2'), ... , Sum('hours__hour_10'))
What is the best way to add rows.
Shazeb
can someone help me with this? i'm getting error
Shazeb
RuntimeError: Model class gumroadclone.products.models.Product doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS.
Dev__master
@Shazebh Add your created app name in installed apps section in settings.py
Shazeb
I'm getting duplicate error
Shazeb
@Dev_120399
Shazeb
django.core.exceptions.ImproperlyConfigured: Application labels aren't unique, duplicates: products
Dev__master
Please check this once @Shazebh
https://stackoverflow.com/questions/24319558/how-to-resolve-django-core-exceptions-improperlyconfigured-application-labels
Zdravo
Hello all!
I am making a django rest API for a platform app where multiple services can be availed by its users like plumber, electrician, mechanic, etc. And these services will be provided by different vendors who will get registered to that app as a service provider
My question is, what is the best approach?
Should i use separate django apps for every service? (one for plumbing, ome for electrician,...)
Or a single app named service with multiple models named plumber, electrician, etc.
Naseem
Xeno
Xeno
*Apply
Jamil
Hey guys, do you guys know any swift and django tutorials? There seem to be so few..
Charly
Jamil
I am asking if anyone knows any tutorials where the frontend is built with swift and the backend is built with DRF.. so it does have to do with django..
Jamil
Because I can only find very few
Charly
Jamil
That’s my point, I am asking about django, but this guy seems to strictly only want every little word in the text to be about django
Fredy
If you don't know, skip the question and you're done... I'm tired of seeing that answer from you...
Charly
Charly
Д
The whole question is random. It's like asking "Where can I find a tutorial that teaches Spanish but also has pancake recipes??"
Neo
Morteza
Because I can only find very few
you should learn them seperately
first you should learn how to make rest api endpoints using DRF
then how to make call to the endpoints using swift and show the data on the frontend.
so yes your question is not related to django
if you have issue using DRF we are here to help eachother
Neeraj
Neeraj
Like this
add this to your urls.py
urlpatterns = [
path()
]+static (static(settings.static_url))