Uzumaki
Is there any solution for my query guys I cant get my contact details from my website
Arman Rahimi
I am using an ajax login in my recent project and implementing it with a function based view, instead of class based ones many recent tutorials suggest. Is there any downside to using function based views for authentication?
José Jorge
Hi, how i can manage forms in Django with arrays. Example: I have a forms that return the name of some parts, parts = ['part1', 'part2']. The problem is that i use print(request.POST['parts']) returns part2, and i need the array. Please help me with that. Thanks.
José Jorge
Arman Rahimi
Code duplication and boilerplate
not a problem, couldn't find a decent class-based view authentication tutorial for my use case. I'm used to function based views anyway. class-based views are a little harder to customize for special cases, mostly due to lack of tutorials.
Muflone
I always forced myself to use CBV only
Arman Rahimi
I always forced myself to use CBV only
so do I for most of the time, but my project needed a single authentication page, with login and different registeration processes for different user types, all with ajax, spend a day figuring it out, couldn't make it work, wrote it in an hour with FBV. I read all the related docs to see if there's any downside to FBV, just making sure by asking. Thank you my friend.
𝕂𝕒𝕣𝕥𝕙𝕖𝕖𝕖𝕜
Bro i want to store a pdf file next to unique id in a mongodb table using django Can you help me out with instructions
Илья
Bro i want to store a pdf file next to unique id in a mongodb table using django Can you help me out with instructions
Mb 1. Upload your file in Django view and save path 2. After that save path at database. *Also you can wrap this at celery
𝕂𝕒𝕣𝕥𝕙𝕖𝕖𝕖𝕜
Yeah already done bro
𝕂𝕒𝕣𝕥𝕙𝕖𝕖𝕖𝕜
Tq for your response
Supra
so do I for most of the time, but my project needed a single authentication page, with login and different registeration processes for different user types, all with ajax, spend a day figuring it out, couldn't make it work, wrote it in an hour with FBV. I read all the related docs to see if there's any downside to FBV, just making sure by asking. Thank you my friend.
This is my personal view. There are no downsides to using FBV. It is like choosing a red car vs a white car. Both are cars but they just look different because of the color. The only difference between FBV and CBV is that FBV takes a more verbose approach wherin you have to write the entire view logic yourself. CBV tries to achieve the same with fewer lines of code. This is where django's true magic happens as everything is being handled behind the scenes. Troubleshooting errors in FBV is easier as compared to a CBV. It is easier to implement complex logic in an FBV as compared to a CBV.
Anonymous
Hello guys, which is the best way to implement a contact form that sends emails to my account(the sender email is one gotten from the form)
Anonymous
Do youw ant to send emails from an account is not yours?
Yes, the from email should not be mine, I should use mine for receiving them
Anonymous
So how does it work? Any are the mails sent?
Charly
So how does it work? Any are the mails sent?
So its working according to you?
Muflone
So how does it work? Any are the mails sent?
You can send any email with any sender address Decent mail server will refuse them. It depends on many factors
Dairon
Hi everyone, I'm having some troubles with a Django rest framework project, in which I got a post(description,user,) model which has a one to many relationship with an attachment (filefield can be video or images) model, and I want to make an endpoint that allows me to create a post passing a JSON like this { "description":"this is my post, attachments: [{"file":"myImagePath"}, {"file":"myVideoPath"}]} , I will obtain the user through an access token in the viewset, how can I serialize this object using modelSerializer
Dairon
Or how should I tackle this kind of problem?
God.gave
Илья
Mb this can help
hamid
You can use APIVIEW. No need to serialize
Api view need serializer bro
Shrikant
Can you plz everyone provide login, logout , sign up ..page with proper validation using forms.py , models.py ..whole django end to end project
Vishnu
Api view need serializer bro
Yes correct. But he can pass that as a dictionary right?
Vishnu
Yes correct. But he can pass that as a dictionary right?
return Response (request, {'description':data})
hamid
Yes correct. But he can pass that as a dictionary right?
yes query return a querydict that's is a custom django type and he had to make querydict to dict if he want to use rest framework Response
Dairon
Wich frontend are you using ?
I'm using react js
God.gave
I'm using react js
Are you uploading multiple files at the same time ? If yes you need to use a formset
God.gave
And in your Django config you need special form handler , let me show you an example
Denilson
Check pastebin online and past the error code, then share the link here
The problem is, when a call URL 'dados-cliente/<int:pk>/' https://gist.github.com/DenilsonRBatista/709d4a6c8690da6ac64d815893891118
Vishnu
Is the django controller and views are same?
God.gave
from rest_framework.parsers import MultiPartParser,FormParser
God.gave
parser_classes = (MultiPartParser,FormParser)
God.gave
So you have to import the two classes and use it
Charly
Is the django controller and views are same?
There is no controllers on Django
God.gave
I'm using react js
Unfortunately I can share media
Vishnu
There is no controllers on Django
In an interview they asked have you ever edited the controller. So am still little bit confused
God.gave
Can’t
God.gave
Д.....
Thank you so much
Could you tell me which one did you choose and why ?
Dlight
Hey , ya'll. Quick question ( tried all SoF solutions didn't work ) in Admin panel when you want to add new users there is no Emailfield . I tried to add to model ( blank =false, null=false ) but didn't work . As the email is optional how can I make it mandatory in admin panel. Thanks
Dlight
Don't understand you It's contradictory
Which part I will make it clear.? I have a CustomeUser , then when trying to add a user in ADMIN panel it just shows username, password, confirm password. Not Email Field
Dlight
Don't understand you It's contradictory
Also tried this solution didn't work Django email address not showing in admin - Stack Overflow https://stackoverflow.com/questions/68310904/django-email-address-not-showing-in-admin
Dlight
Is there some extra benefit to learn class based views? Or Can I skip them because my work can be done by simple views.
There lots of article about FBV vs CBV. But in the nutshell , Using CBV : make your code cleaner and more scalable Using FBV : u see what is happening in detail , so you might wanna start with this and then move to CBV
Firdaus
Is there some extra benefit to learn class based views? Or Can I skip them because my work can be done by simple views.
https://spookylukey.github.io/django-views-the-right-way/ No harm in sticking with FBV. For me FBV is easier to manage.
Gc3kla
Hello please suggest django hosting server
render.com is a good place to deploy your Django project
Muhammad
I want to create a live chat web app. Which is the best way?
Muhammad
Is django and socketio best for this?
Muhammad
Help me to figure out
ERMIA
Is there some extra benefit to learn class based views? Or Can I skip them because my work can be done by simple views.
Class based views are blessed by some attributes: 1. DRY code 2. Connectivity with others and mixins 3. And alot of featutes...
Rudraksh
I have created a django project. Now I want to use it online means I want to use it from my mobile. Where can I configure it so that I host it online for my personal use without paying or at very very affordable
SALAH ALDAIN ALHAJJ
Are they free?
railway.app
SALAH ALDAIN ALHAJJ
Supra
Are they free?
PythonAnywhere has a free tier. Even DigitalOcean has a free tier. AWS is free for first year I believe. After 1 year there is no free tiers.
Anonymous
Can anyone explain how is annotate() and aggregate() connected