Python Guy
How they it get pk? def retrieve(self, request, pk=None): queryset = Post.objects.all() post = get_object_or_404(queryset, pk=pk)
Python Guy
is it in request?
Rohit
How they it get pk? def retrieve(self, request, pk=None): queryset = Post.objects.all() post = get_object_or_404(queryset, pk=pk)
it's url parameter. If pk is defined in url the value for pk will be received from url
Rohit
What is the difference between @app.task(bind=True) and shared_tasks in celery?
https://groups.google.com/g/celery-users/c/XiSDiNjBR6k?pli=1 better explanation
JustAnotherOne
does jinja inherit the js code from the parent to the child? I need to write a global js code for all the html templates in the project is it possible?
~:$
YES. Include that js code file in your base.html
I am not sure about the inheriting thing. But your global logic will work.
JustAnotherOne
YES. Include that js code file in your base.html
I’ve tried it with a pure js code, didn’t try it with a file code
JustAnotherOne
I’ll try it now with a js file, and I’ll give a feedback
~:$
I’ve tried it with a pure js code, didn’t try it with a file code
Do you not know about template inheriting in django templates?
Daniel
Hello I'm a newbie How do I get started with Django I have a little background on python
Doragonsureiyā
Hello I'm a newbie How do I get started with Django I have a little background on python
Looking for Django tutorials? you can follow these three recommended ones: * Official documentation and tutorial * Tutorial from MDN * Tutorial from django-girls
Python Guy
Hi, I deployed my django app on netlify and now I am not able to access my admin page, it shows page not found
Python Guy
Is Django able to deployed on netlify🤔?
i thought I did, but it is not working, so I remvoed
Shubham
Can anyone tell me how to do e-mail validation and pagination in my project🥺
Anshu
Can anyone tell me how to do e-mail validation and pagination in my project🥺
If you're using CBV, just use the attribute paginate_by for pagination
Shubham
If you're using CBV, just use the attribute paginate_by for pagination
I have used it written a function also but I don't know what's wrong 😔
Кир
Hi! I'm trying to write tests for drf ViewSet's endpoints using pytest. But when I'm creating a user with token inside a test and sending GET request with headers (i'm using token auth) I receive {'detail': 'Invalid token.'}. Even considering the fact that objects have been created and that I can see token when print it.
Amir
Hi there How can I learn django?
Doragonsureiyā
Hi there How can I learn django?
Looking for Django tutorials? you can follow these three recommended ones: * Official documentation and tutorial * Tutorial from MDN * Tutorial from django-girls
Rebellion
Friends, I'm creating cards in template displaying some info in them like title and body. But, body text is too long. So, how can limit the numbers body characters say only first 20 characters. Instead of showing entire body text, how can I show only few characters...? Thank you!
Rebellion
This is related to css , text truncate
Is there any simple way in HTML like any attribute/ tag..?🧐
SuperN00b
Is there any simple way in HTML like any attribute/ tag..?🧐
Unless u handle the text before return to templates, or u must use css or js for this , html can't help this
SuperN00b
Css actually is quite funny , u should try :)
Rebellion
Css actually is quite funny , u should try :)
I got a way... 'slice' attribute works here....
Rebellion
You mean js ?
<p class="card-text">{{ post.body|slice:"100" }}</p>
Rebellion
I don't know if its js or html only
SuperN00b
SuperN00b
But this is nice, I guess I should learn some more about django template
SuperN00b
Thank bro
Rebellion
Ah nice, this is django template function , not html
Yeah, seems great... Very easy to use as we can define number of max characters like '100'
Rebellion
Ah nice, this is django template function , not html
https://docs.djangoproject.com/en/4.0/ref/templates/builtins/ Yes, You are right... It is Django built-in template tag....
~anonymous~
Heya guys , I am new to django , can you please guide me with some video tuts?
Python Guy
Hi, this is my view for like feature but data that I am sending is undefined to users. So What should I change https://pastebin.com/9qG0rsb0
Python Guy
change self.request.user to request.user maybe this help to you
But that's not the data I am sending back
Python Guy
Python Guy
Response(data)
Actually think is kind of Jugaad . Do you know any better way for Liking Post?
Ixlos
like this post user liked_time ...
Python Guy
like this post user liked_time ...
Only like, like is manytomany
Python Guy
Only like, like is manytomany
It's inside post model
Ixlos
Have user fields in like model?
Python Guy
Have user fields in like model?
Actually there is no like model. Like is inside post
Ixlos
Actually there is no like model. Like is inside post
why? how to use manytomany relation?
Python Guy
Anonymous
Django rest framework in how to upload large CSV or Excel file ? From endpoint
Ixlos
my suggestion is create like model post=foreignkey user=fk liked_time=datetime unliked_time=datetime default=null delete like field on post model
Ixlos
maybe this help to you
Linus
Guys someone here has experience with async
Linus
Im using drf that doesnt support async
Linus
In views i have async methods that i turn into sync with async_to_sync
Linus
Is this correct? Im doing this to use asyncio
Turbulance
Guys, I'm having trouble running my django project on my LAN
Mirco
It's worth it
:x-re
Hi guys i need help How can i hide @gmail.com after send mail to user
Alireza
Hi, i have a website and I should upload some files with specific standard files or like below: Title of question? Option 1 Option 2 Option 3 Option 4 Title of question? Option 1 Option 2 Option 3 Option 4 And these files or with .txt format. I want to upload these files and the django automatically add these files data to the database. How can i Access the files for scraping with python when it uploads by Django?
Вова
Hi guys, can I make database queries directly without using django migrations?
Rinat
Hi guys, can I make database queries directly without using django migrations?
Yes. Look at django cursor, and make raw queries to database.
Yusra
guys I'm new with django and currently I've started learning and building end points, I'm in authentication process now and I want to know auth library that works with rest framework, do ypu know any reliable auth library that works fine with rest framework?
Mounted
Hello
Mounted
How can I execute the function after loading the template?
.
It depends on what auth u need