snc
can anybody tell me how to get request.user in serializer?
snc
overriding save method in serializer
snc
or should i move to CBV
inchidi
can anybody tell me how to get request.user in serializer?
you can pass it from your views like this:
# views
s=YourSerializer(context={"request": request})
# serializer
...
self.context['request'].user
...
if you are using class based api views provided by drf, they already do that inside self.get_serializer() on api view so you dont need to do it by yourself
Dhruva
heroku : The term 'heroku' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the
spelling of the name, or if a path was included, verify that the path is correct and try again.
Dhruva
I have started in the cmd
Dhruva
and there its working
Dhruva
but when trying to access from VS code I m having this error
snc
Anonymous
How to deploy a django app like any other website
Alex
Anonymous
Thanks
Anonymous
Anyone who knows a link to get android studio turtorials
Alex
this group is not about android thou
Anonymous
Yeah i know i was just asking if anyone knows
Rajesh
Django for Beginners: Build websites with Python and Django Book by William S. Vincent
Rajesh
snc
Subroto
Subroto:
I am getting error while running pip install -r requirements.txt
File not found error is showing
snc
Alex
Subroto
charlie
Go to that file directory and run
charlie
Pip
Subroto
charlie
Then check the filename is correct or not
Subroto
Yup same file name
Alex
mystic....
charlie
Either you are not in the same directory or filename is incorrect . Check again
Subroto
Ok
charlie
If not put screenshot
charlie
Adiziel
charlie
Take a screenshot on phone then
Mirco
Doragonsureiyā
Mirco
Subroto
Thanks it worked
charlie
What was the issue
Subroto
What was the issue
Don't know exactly what was the issue ...just restarted the cmd and it worked
Adonis
Momin
Guys can anyone suggest me where to learn custom user registration and login process. I have watched some videos but i didnt help please help me
Alex
Anonymous
please, any suggestion will be accepted
Anonymous
i know, i can use the string functions, but first, i will need the full line, how to do this!?
Doragonsureiyā
To share code or error tracebacks please use an online pasting service, here is a list of suggested sites:
- https://del.dog
- https://dpaste.org
- https://linkode.org
- https://hastebin.com
- https://bin.kv2.dev
Amen
hey there
sudoku
Hey developers I am aiming for a good Django open source project and contribute to get gsoc 21
sudoku
Anyone to be my mentor
sudoku
??
Amen
i wanted to deploy django channels on a vps with Nginx pleaseee help
Anonymous
Hello guys ı need date filter example 1 - 15 june which room avaiable ı wannto filter this , how can ı do ?
Amen
https://stackoverflow.com/questions/20379246/django-filter-by-datetime-on-a-range-of-dates
Amen
Anonymous
thx ı will check
Anonymous
guys when ım filter comeing this error : ['“6/18/2020” value has an invalid format. It must be in YYYY-MM-DD HH:MM[:ss[.uuuuuu]][TZ] format.']
Anonymous
what is mean ??
Mindru
this means that format of data that you are filtering is invalid
Mindru
likke is said there
isa
I have created Django project and an app. After that prepared models with views. Everything was fine. I got below error when I gave a table name with "db_table" within Meta class.
django.db.utils.OperationalError: no such table: me
How can I solve this problem ? Any idea ?
Shivam
How to create a form to get particular user details from session like user id and submit it to store in database??
Ilias
Use modelforms
Ilias
https://docs.djangoproject.com/en/3.0/topics/forms/modelforms/
ジェフ・
So I’m working on this api and I’m having an issue where I want to fetch all the projects a user uploaded or created.
I used serializers.PrimaryKeyRelated and passed the Project model as a query set which works but then I get just the primary key.
I want to be able to get the whole object or arrays of projects a user has.
Anyone to help?
Knight
Good day everyone!
after changing from http to https I'm having the following problem. I'm using postman to test api.
Any ideas why I'm having it?
{
"detail": "CSRF Failed: Referer checking failed - no Referer."
}
George
Knight
Im using sessionAuthentication and https. In this case I shouldnt need csrf, according to the docs
George
What is the cleanest way of creating and saving a list of objects?
tasks = Object.objects.bulk_create(
[
Object(foo=foo)
for foo in bar
]
)
[task.save() for task in tasks]
This is my actual code.
Zhumakhan
bulk_create creates in db, why do you need to save
George
George
George
ah, ok
George
i will try
inchidi
i will try
you can try run this to check that your data inserted to db already
tasks = YourModel.objects.bulk_create(
[
YourModel(foo=foo)
for foo in bar
]
)
for task in tasks:
print(YourModel.object.get(id=taks.id))