Rammanoj
this snippet is working one — https://dpaste.de/y9vi
Rajjix
nice, you did it 🎉
Rammanoj
nice, you did it 🎉
thanks for the help
Rajjix
your welcome
Ronald
Anyone with some decent Django Rest Framework experience? Got a question.
Ronald
So
Ronald
No sure if Rest Framework is out of scope of this chat
Ronald
but anyway
ʚɞÇherry Łoveʚɞ
no, it's related
Ronald
I’ve managed to setup the basics of Django rest framework.. it returns the whole queryset of a model. Nice.
Rajjix
controlling satellites with django rest?
Ronald
however
Ronald
I don’t find much info online for when it comes to filtering the API.
Ronald
especially with variables
Rajjix
u ruined it, you made all that big intro i thought u had a spacex idea
Ronald
anyway\
Ronald
back to my question
Rajjix
filtering what ? The queryset ?
Rajjix
(model data)
ʚɞÇherry Łoveʚɞ
ʚɞÇherry Łoveʚɞ
what's you exactly want to do ?
Ronald
oh more specifically, foreign keys
ʚɞÇherry Łoveʚɞ
oh more specifically, foreign keys
you need to do it yourself with custom Filter class.
ʚɞÇherry Łoveʚɞ
are you tried with this docs https://www.django-rest-framework.org/api-guide/filtering/
usmanium
Can someone share this book please?
George
Can someone share this book please?
Here its forbidden to ask for copywrited books
Rajjix
if you’re not willing to pay for it, you won’t get it here for sure, but here is a website for the author of the book, he shares a lot of tutorials https://wsvincent.com
George
I wouldnt also pay for a book cos there is no need to.
George
Internet has enough free resources.
usmanium
It's okay no problem, but some kindsness Will be better. We all using Internet but nobody knows whose behind. I came in peace
Mirco
It's okay no problem, but some kindsness Will be better. We all using Internet but nobody knows whose behind. I came in peace
Everyone must come here in peace, otherwise the exit door is over there 😀 Anyway , if that book has a price, it's because the writer has done a job for everyone who wanna learn from him So, your payment should be a thank to the author for his amazing job ( if the book is good obviously 😂 ) 😀
Sergey
Hello! Tell me, is there a name for authentication with one key? Not a login and password. Only one unique key. TY
Rajjix
token
Sergey
You misunderstand me a little I need to implement authorization in drf so that the user sends a token(instead of login and password) that is recorded in the database, and I gave him jwt. I can't find such solutions. Maybe some specific name?
Rajjix
as far as as i know u can let someone login with their grandpa’s name if you want. it doesn’t always require login and pass that’s just the convention, u only need to override your backend method that’s responsible for authenticating users and giving them a token to receive their grandpa’s name instead of login&pass, but if your purpose to make your own api-key like other services we usually use, it’s very similar drf has something called token authentication, or third party library called django-rest-framework-api-key which makes it a bit easier, but authentication principle remains the same in all mentioned subjects u require any type of identification of the user and issue a token to the user, which he will use to access your services
Mohit
How to let users login using either username or email? The user should be able to login with both
Anonymous
How to let users login using either username or email? The user should be able to login with both
One way is to get the user modal object with the email or username and then use the check_password method to check the password and login
Renita
Hey there! I would like to know how can I do the following using Django: I have a python file full of methods of extracting data from a URL. I need that data to be fed as the database data. How can I achieve that? Where should the python file reside in the project structure and how do i insert data into database from the file
Rajjix
django responds to http requests, so you would need to trigger those functions in your views, or another method would be using celery if you want trigger those functions on a time schedule, make a model and use the save method to save retrieved data
Renita
Okay I will look into it
Rammanoj
hey guys, I have a large sql file (both ddl and dml written). I have no models. Is there any way to generate models from it??
Renita
Oh
Renita
I will look into that
Rajjix
hey guys, I have a large sql file (both ddl and dml written). I have no models. Is there any way to generate models from it??
Idk if this is useful, but assuming you have a premade database this might help for django to generate models for it. So theoretically you can execute those commands to create your db, then use inspectdb to generate a models.py file https://docs.djangoproject.com/en/2.1/howto/legacy-databases/
Nithin
Hey, i am developing a rest api using drf. When users are signing up they can choose what all features they want acess to and they can only access those features. Is the best way to impliment this using permissions? Or is there any specific packages for this?
ibrahim süren
you can write your own permission classes
ibrahim süren
easiest way i think
Nithin
I see, thanks
mahori.
Anyone experienced with using django+spacy?
mahori.
Would love to discuss
Raghavendra
How to get a object from js in a html page to views.py
Rammanoj
How to get a object from js in a html page to views.py
just make a http request and pass the object as the parameter to th request
dhelbegor
Hi guys, can you help me with a question please? how do I pass an index on the self.get_object to receive only the folder and not the files inside it? This is what is coming: little-thomas-test: s3.ObjectSummary (bucket_name = 'little-thomas-test', key = 'run-001 / 000000401917_DP10_E09_15.ab1') and I just need it: little-thomas-test: s3.ObjectSummary (bucket_name = 'little-thomas-test', key = 'run-001 /') # just the folder detail this folder is in a s3 bucket This is my configuration. bucket = s3.Bucket (name = "little-thomas-test") FilesNotFound = True get_folder = str (self.get_object () .slug) for obj in bucket.objects.filter (Prefix = get_folder): print ('{0}: {1}'. format (bucket.name, obj) FilesNotFound = False if FilesNotFound: print ("ALERT", "No file in {0}". format (bucket))
Anonymous
Good day
Anonymous
How do I send a document from database to email, please any code snippet or reference
George
How do I send a document from database to email, please any code snippet or reference
First you may process it, for example, covert it to html and then i domt really know
Anonymous
Thanks Guys sorry for not getting back to you, I have a solution already
Ghorz
just make a http request and pass the object as the parameter to th request
He wants instant response without reloading or refreshing page
Ghorz
How do I send a document from database to email, please any code snippet or reference
In your views, create a function that retrieves the documents, create send_mail function and pass the document retrieval function to send_mail
Ghorz
Also remember to specify the event, either send on users action trigger or send to all users based on event such as time
ibrahim süren
hello, my static files gives 404 error on production
George
hello, my static files gives 404 error on production
read the deployment manual, it's normal
ibrahim süren
George
did you read it?
ibrahim süren
yes
ibrahim süren
https://docs.djangoproject.com/en/2.1/howto/static-files/ is it?
George
no
George
DEPLOYMENT
George
development is not deployment
George
https://docs.djangoproject.com/en/2.1/howto/deployment/
ibrahim süren
https://docs.djangoproject.com/en/2.1/howto/deployment/
i did the same things but it says "STATICFILES_DIRS setting should not contain the STATIC_ROOT setting. "