Anik8
Vishal
david john
Phill
Phill
What's happening in my app is that I have a view that fetches all data in the dB and I assume "hands it over" to the serializer. Then the serializer gets some detail from the url via a query, say x coordinate, and calculates a distance from that for each data row.
Then I need to filter out the data rows to return only those that have a distance shorter than say 5. The problem is, it seems like I can't filter out the data received
Phill
Phill
As in, how to refilter the query set without the query set's rows having the distance field in the database?
david john
Badal Kumar
Badal Kumar
Django has clear documentation of how to manage static files
david john
From what I understand you need to filter the data based on the query and calculated column, am I right?
May I know the fields you need to calculate on something?
I assumed that you will need to use annotate to base your filter on some calculated column. Lets assume that your data contains a column name x1 and x2. That 2 columns is needed to calculate the distance, and we need to filter the distance greater than 5.
data = Model.objects.annotate(distance=F("x1") - F("x2")).filter(distance__gt=5)
Phill
Phill
Which I'm only getting at the point when I make the extra fields for the serializer
Proton
Hi good evening
Please is there a way to disable video or file download in django
Phill
So maybe I need to get the url params before the serializer? so that maybe I factor it in the objects.filter()?
Phill
Proton
As in you won't allow files to be download on the website
Phill
As in you won't allow files to be download on the website
I don't think that's something generally doable on the backend if you provide the file to the browser, but I guess you can stream a video under some conditions rather than give it whole to the browser; but that again won't save you from advanced downloaders
Proton
Ow okay
Proton
Thanks alot
Phill
Maybe someone else has an opinion, I'm not that seasoned in developing web applications
Proton
Can any one recommend a tutorial on how to make a video purchasing website
Where you the admin uploads videos and someone buys them
Charly
Proton
Any good material you can recommend
Charly
Umarzoda
Hello everyone, is there a video related to cpanel?
I cannot host my website on the Internet, I have a host and a domain
Phill
Phill
Something like what onlyfans or YouTube movies uses
Mark
How to make in url pattern off app link like - admin/some_app/some_model/add/custom_page?
Mark
It's not work urlpatterns = [
path(r'^admin/events/event/add/something', views.hello)
]
Mark
i can't go to link localhost/admin/events/event/add/something
Maxim
Mark
Mark
stock server ip 127.0.0.1:8000
Doragonsureiyā
Looks like you need an offtopic group, please continue this conversation at @pythonofftopic as it's not related to Python
𝕲ü𝖎𝖕𝖊
Max
Hey guys I have some struggle with an HTML canvas. I would like to build a simulation with round about 1000 entities. These entities should be represented in this Canvas (with pixijs) and controlled asynch over the django backend. Does anyone has a clue if this is possible to do? And how?
Thanks a lot!
Pablo
Hi everyone. I am having problems understanding django rest framework token authentication
Saurabh
Anyone have experience with offline conversion Bing API
Mahesh
Saurabh
Can you please tell , how to command over python?
Badal Kumar
Adhil latheef
Which serializer field name can read hexadecimal in serializer field?
Syed
Anyone know how to connect database table to matplotlib in django?
Syed
Plz help
fn
Hi all!
Need a little bit of help, thnx in advance!
https://stackoverflow.com/questions/70602829/how-to-make-a-query-using-multiple-foreign-key-fields-of-django-models
Siddhartha
hey all, i wanna make a payment gateway but have zero clue of how to start anything regarding it, any helps or leads appreciated
Anshu
Anshu
fn
Siddhartha
tech-tycoon
Hello guys
tech-tycoon
Can anyone tell me how can i show my local videos in video tag
Vishal
Proton
Anik8
You should use on_delete in foreign key
Anik8
Try to put the name of the model under ' ' (quotes)
Anik8
For example
Company = models.ForeignKey('company', on_delete=models.CASCADE)
Maxim
go back to the basics of Python and find out what positional arguments are
david john
So maybe I need to get the url params before the serializer? so that maybe I factor it in the objects.filter()?
If the url parameter is needed to calculate the distance, yes you must need it firs, or make it optional.
Lets assume the URL parameter is named value.
if not request.get("value"):
#display all the data if the value is None
data = Model.objects.all()
else:
#Filter the data by distance of x1 and the value.
data = Model.objects.annotate(distance=F("x1") - request.get("value")).filter(distance__gt=5)
I may help you more if can provide a snapshot of your current code and some visual diagram on how you want your application behaves.
david john
Python Guy
"detail": "JSON parse error - Expecting value: line 2 column 14 (char 15)"
what exactly this error is? I treid sending data but got this
𝕯aniel
Delete ','
Phill
𝕯aniel
Or u are not send correct format
Anonymous
Hi good evening to all
Tiger one doubt.
I have return form request.POST
I want to return value using the function.
HttpResponse("your first name is "+output)
How can I store form firstname value to output variable
Thank you ?
Anonymous
I am using this function
output = request.POST.get("fname")
But I got this output
Your name is None
Is it correct or wrong
Ridha
Hii
I need help,
I am trying to create a simple todo application using django,
There I have an option to edit and remove the tasks..
For that how to fetch the collumn I'd to edit? In my SQL I am using
Ridha
Thanks
Ridha
It's working now
Anshu
Mysterious
Hi i need a help.
How can i store two servers celery logs into a single file with a centralized server?
Gomathi
Hi, I designing online course portal using django, in registration form need to authenticate mobile number using otp. I used two library django-auth and twilio to authenticate. But getting error. Is there, any other library r way to proceed. Kindly advice