Sasha
I do this request, and I get request.method == 'GET' in my program, please help https://i.ibb.co/3FyGcx2/Screenshot-from-2022-08-17-17-03-38.png
Sasha
What is your doubt ?
I get a "get" request insted of "post" inside program
Di
Hey everyone Looking for a русский guy who could help me with users I'm working on the project where I have TWO kinds of users, ones who makes posts (and can see only their own posts), and ones who sees everybody's posts. I have a lot troubles getting how to work with users in Django If anyone could suggest some information or videos, i would be grateful
Sasha
how do you know ? can you print out request variable? look again?
https://i.ibb.co/j3rkZGG/Screenshot-from-2022-08-17-18-05-46.png
T4P4N
https://i.ibb.co/j3rkZGG/Screenshot-from-2022-08-17-18-05-46.png
your post request is getting redirect to a get request, can you show me your views.py
T4P4N
I am unable to get the pk to refer the user to it
try with user = request.user if post.user = user # update post else: return redirect to not authorized page
Sasha
your post request is getting redirect to a get request, can you show me your views.py
https://i.ibb.co/8nyMZjR/Screenshot-from-2022-08-17-18-12-32.png
Sasha
everyone russian there
T4P4N
https://i.ibb.co/8nyMZjR/Screenshot-from-2022-08-17-18-12-32.png
looks good to me! can you try with class views if you're comfortable?
Sasha
looks good to me! can you try with class views if you're comfortable?
why am I getting "GET" insted of "POST" from postman?
Sasha
Can u share url.py
nothing interesting there https://i.ibb.co/vYwrj5L/Screenshot-from-2022-08-17-18-18-00.png
Seraph
I have a question about django-rest-framework. I have a table with 8500 rows and I have an endpoint that get items, but only get 800 hundred. Somebody knows how to get all items from endpoint? The endpoint doesn't have filter.
T4P4N
why am I getting "GET" insted of "POST" from postman?
does your project requires authentication? if yes then its probably redirecting to login url for authentication.
T4P4N
the problem was missing slash
oh yes!, i remember spending 5 days debugging social authentication issue caused by missing slash. 😅 still feel bad for me lols.
The Inspired
I have a question about django-rest-framework. I have a table with 8500 rows and I have an endpoint that get items, but only get 800 hundred. Somebody knows how to get all items from endpoint? The endpoint doesn't have filter.
are you sure you have 8500 rows and not actually 800? might wanna refresh your db... if your db is alright, ,then just directly print the queryset you are getting in the shell...
The Inspired
could also be pagination
The Inspired
Is there any way to access the serializer field inside the method field?
I'm sorry, what? accessing the serializer field? just do serializer.data?
Seraph
No pagination neither filter
The Inspired
No pagination neither filter
where are you viewing your data? in postman?
Seraph
yes
The Inspired
open up postman settings and check maximum response size option under the general tab.
The Inspired
try setting it to 0
Seraph
thanks
The Inspired
thanks
did it work?
Seraph
I'm afk
The Inspired
okay
Klepshydra
hey, I'm building a Django app with django rest api. the database I'm using is sqlite3 I'm running runserver, and two commands both commands spawn threads and keep themselves active to perform some jobs continuously the problems is that I cannot write to db, I've tried everything, save, update, update_fields, force update, I've tried to delete all connections nothing seems to works, maybe switching to postgres could be a solution?
Klepshydra
.save() does not fail but does not update the db, I think the problem could be about race conditions or database connection but I can't figure out
Seraph
@TRAXCUTTER The error was in query.
Tez
I want to display images and videos,kinda like instagram does. Anyone who knows how I can go about it?
Muhammed
Is there any way to delete migrations in production environment in docker
S
Try both save() & create() in django shell. See how it behaves.
Klepshydra
Try both save() & create() in django shell. See how it behaves.
I need to update, django shell is not seeing the update
Klepshydra
I think the transaction is not being committed
Anu
Who knows signals in python very well... please can you please explain me?
Charly
Is there any way to delete migrations in production environment in docker
thats a very bad idea, why do you want to do that?
Charly
Who knows signals in python very well... please can you please explain me?
https://docs.djangoproject.com/en/4.1/topics/signals/
Muhammed
thats a very bad idea, why do you want to do that?
Conflict occurs is there any way without drop db
Muhammed
Postgres
Charly
Postgres
google then how to delete database
Maxim
google then how to delete database
he asked without drop db
Muhammed
Muhammed
I deleted a table
Muhammed
But can't recreate
Maxim
Exactly help plz
i can't help you this is too complex a question to be answered in a nutshell
Maxim
I deleted a table
i can only say that it was a bad idea
Charly
I deleted a table
So if you did that then create it manually, messing with migrations on a production database is going to generta more issues
Fakhteh
I created an app using django and when I type "python3 manage.py runserver" in terminal, I see "No module named 'pages.app'" Error. What should I do for fixing it?
Maxim
Exactly help plz
the best i can advise is to practice consistency on a copy of the product base before doing anything in production
AL
Is there an alternative for total_seconds() method of Python in Django ORM?
AL
I want to use something like to get the duration between two timestamps in Django's ORM
Klepshydra
Share the code. Lets see.
I solved btw, I was storing the object also in a class field, removing that solved the conflict and now the other thread can update
Klepshydra
thank you :)
Ogundare
Hello seniors. I'm creating a blog app in project, I currently have two apps, blog and portfolio apps. The problem is I'm trying to display my blog objects in the blog home but it's not displaying, below are the screenshots. Please help!!!
Ogundare
Háà, I can't attach files.
Doragonsureiyā
Háà, I can't attach files.
Rule 5️⃣: Never post walls of text or screen photos. Use paste bins like https://linkode.org, https://nekobin.com (or your favorite one)
Christof
buttons not allowed to share
Doragonsureiyā
buttons not allowed to share
What are you talking about?
Ogundare
urls.py http://linkode.org/#VZEjojJTcbOtgGbgQFKbf4
Ogundare
views http://linkode.org/#QqBVEw7QgGALGziHqhcm64 blog html code http://linkode.org/#aKV8FWBMEVi7mPuoxyUKd5
Ogundare
Urls
urls.py http://linkode.org/#VZEjojJTcbOtgGbgQFKbf4