heart stained
Interesting thing is that celery worker received a bunch of duplicated tasks (around 20 within the seconds) when MongoDB (deployed on the same VDS) stated that mongodb instance is overburnt. First thought was that something happened because of the server overload
SantiU
hello! Has anyone ever used the hotmart api?
Doragonsureiyā
hello! Has anyone ever used the hotmart api?
Your question is not related to Django. If it's a Python related question go to @Python group, otherwise please move to @PythonOfftopic group and ask there.
ZeroCool
Hi, do you have any examples on sending email with template and context?
ZeroCool
an example of the view, because I already managed to send the email but only text without template
devmie
Which will be the best django hosting plat. with no sleeping like things after a inactive period.. Is there any?
Tukwasi
Good morning guys
Tukwasi
I really need your help
Tukwasi
How can I write a code to send email to a user when registing to authenticate the user
Rutuja
how managed check up and check out in git?
Doragonsureiyā
how managed check up and check out in git?
Your question is not related to Django. If it's a Python related question go to @Python group, otherwise please move to @PythonOfftopic group and ask there.
Gindera
Use `` please
ZeroCool
Your index.html is in the templates directory?
ZeroCool
your templates directory has to be in the root of the project
ZeroCool
maybe you have it in another folder
Hasan
hi I want to manage my file/media requests for example, my product has a FILE and this file has a URL such as http://localhost:8000/media/product/file/A7a.pdf I want when user request to see/download this file, I throw an error or give access to the user to download it
Saa
Hi everyone... I have a django project that gotta use russian money (ruble) to perform payment. Which payment system is usuful for this? Paypal or......
Doragonsureiyā
Hi everyone... I have a django project that gotta use russian money (ruble) to perform payment. Which payment system is usuful for this? Paypal or......
Adding the word Django to your Off-Topic question doesn't magically turn it to a Django related question, so move to @PythonOfftopic group and ask there.
Zen
says MultiValueDictKeyError
Zen
https://nekobin.com/zeleyowexe
Дмитрий
method get_avatar
Дмитрий
it's call mistake
Doragonsureiyā
method get_avatar
Rule 5️⃣: Never post walls of text or screen photos. Use paste bins like https://linkode.org, https://nekobin.com (or your favorite one)
Almaz
maybe you have it in another folder
Nope bro, is that right name folder but i still don’t decided mistake
Almaz
maybe you have it in another folder
Yeah, my bad, now i decided the error, thanks
Юрий
Good afternoon, can you please tell me how to confirm registration by sending an OTP code to the mail? Code and sequence below Sequence: Entering data in the registration form => Sending the code to the mail indicated in the form => Redirecting to the page for entering the code => If the code is correct, redirecting to the main page, if not, redirecting to the page for entering the code, but with a message about invalid code code => https://linkode.org/#NtN8rnqu1g7ZLZcsM0APj1
null
https://nekobin.com/zeleyowexe
use User.objects.create_user(username=email,email=email,password=password)
Mahdi
I have a question which is I create a super user then i forget the password 😂😑 How can i delete this by terminal or smth?
Anonymous
Go on django website official
Mahdi
Go on django website official
Contact the support and stuff?
Anonymous
Yup
Mahdi
Yup
Oh my beloved project💔😑
Anonymous
No
Anonymous
Just write python manage.py change password username
Sergey
hi folks, I have a really simple question, but I'm really confused. I'm using django-admin. I've added inlines for some models. And there are instances with a lot of related rows, so the instance page takes a lot of time to load all the related rows and render them. I want to simply limit the number of the objects I see on such a page. I've tried to set max_num on a *Inline class, it doesn't change anything. I've tried to add get_queryset method to the inline and slice it [:10], but it says "Cannot filter a query once a slice has been taken". I think it's the second time I'm trying to tackle this question... ok, I just though to send this message to chatgpt, and it finally said to look at the formfield_for_foreignkey method. What do you think? (no, doesn't seem to work)
Tukwasi
Please I need your help guys
Doragonsureiyā
Please I need your help guys
No one can help you until you explain your difficulties.
Maxim
Please I need your help guys
please don't send useless messages
Maxim
Please I need your help guys
if you need help, state your point in the FIRST message
Sergey
So you want to limit number of entries of your main model or are you talking about limiting of the related ones on the single page of the main model? (Inlines or FK)
This one - "limiting of the related ones on the single page of the main model". I'm not sure, but I hope django-admin already does something like select_related. But the problem is, some main models have thousands of related objects. And I don't really need to see them all there. I'd be happy to have a sample of them, like 10, just to have a vague understanding of the content. I don't even need the editing forms to create new objects there.
Satya Anurag
hey, i am using vercel to host my django website. But django package size is exceeding the vercel limit. Does anyone know which django version package is of less size
Mahdi
Is django suitable for being server to a circuit?
.
I think I did call super. You mean, I didn't need to? I'll check it out too. Thanks for the ideas!
Not necessarily, but I forgot to consider that you’ll still need to do a filter to get just the related objects.. So you might encounter again the need to “slice a filtered queryset” which is problematic. So just try the first idea. edit: I got confused. • Slice and then filter: Not ok • Filter and then slice: OK So you can experiment with it out anyway
Doragonsureiyā
Satya Anurag
there's no django version of "less size"
Ok. Thanks. I solved it by compressing some static files
Kiro
Hi, can someone tell me what is the best way to give different results based on the user group in a class based view?
Kiro
The UserPassesTestMixin lets me do something similar but I also need to return to the user that they are not authorized to do a certain thing, for example return a 403
Shamnad
Django showing errors even if i set Debug to False🤔
Anonymous
Any one can how to learn django plz i am beginner
Anonymous
Plz help out
Anonymous
Plz help me out where to and how to start
Adorilson
Any one can how to learn django plz i am beginner
How much beginner? Do you have saw the official tutorial?
Kiro
How about LoginRequiredMixin
The LoginRequiredMixin just ensures that you are logged in, not your group Bte solved by overriding the create method
Adorilson
Zero level
I means... in django? in web development? in programming? in python?
Anonymous
Python
Adorilson
Python
maybe you can try https://roadmap.sh/
<\Hany>
I am having a stroke, please help meIn the middle of work, all the static files of the site gave error 404 No matter what I do, it doesn&#39;t work, I have to solve it quickly, I&#39;m very busy
<\Hany>
normally
Sergey
Not necessarily, but I forgot to consider that you’ll still need to do a filter to get just the related objects.. So you might encounter again the need to “slice a filtered queryset” which is problematic. So just try the first idea. edit: I got confused. • Slice and then filter: Not ok • Filter and then slice: OK So you can experiment with it out anyway
I&#39;ve tried to find the proper way to do it, wasted about an hour at least, I think. But your solution definitely works! Really, thank you for the idea. Here&#39;s the code: class ParentAdmin(admin.ModelAdmin): inlines = [ParentKidsInline] def get_formset_kwargs(self, request, obj, inline, prefix): kwargs = super().get_formset_kwargs(request, obj, inline, prefix) ids = (kwargs[&#39;queryset&#39;] .filter(parent_id=obj.id) .values_list(&#39;id&#39;, flat=True)[:10]) kwargs[&#39;queryset&#39;] = kwargs[&#39;queryset&#39;].filter(id__in=ids) return kwargs AFAIU, the filter to get only parent&#39;s kids is applied to the queryset somewhere down the line, so if we simply get some random ids, some of them will get filtered out later, so we have to filter by parent_id here. I&#39;m still not sure if it&#39;s the best place to put this code. The get_formset_kwargs method was added only in django 4.0, so in the previous versions this wouldn&#39;t work.
Sergey
Just interesting, how does it look in UI?
as usual, but only N kids shown instead of thousands I&#39;m still looking for the proper way. I think the get_formset method is more appropriate to apply the limits there&#39;s a package for pagination of inlined objects (https://github.com/shinneider/django-admin-inline-paginator/blob/master/django_admin_inline_paginator/admin.py). I don&#39;t want to bring it in, as I don&#39;t really need pagination. But that code led me to this solution class ParentKidsInline(admin.TabularInline): ... def get_formset(self, request, obj=None, **kwargs): class LimitedFormSet(super().get_formset(request, obj, **kwargs)): def get_queryset(self): return self.queryset[:10] return LimitedFormSet Not as clean as I&#39;d like, but I think it&#39;s the right direction. I have to rtfm :) BTW, the creator of https://github.com/shinneider/django-admin-inline-paginator has been looking for a new maintainer (see the footer)
Абдулла
Hi everyone! I have a question, maybe someone can help. The question is the following django project which uses rest_framework_simplejwt for authorization and authentication. So there is a view that receives a request and sends a response, everything is standard here. And here, when a request is received, the system sends sql queries to the database for processing it, and in the list of sql queries there is one request that is sent automatically to authenticate the user, and now I need to optimize this particular query, since the system, when compiling a sql query, by default, refers to all fields of the User model, although authentication does not require all fields. Here&#39;s how I can optimize this query and make sure that the sql query to the database is compiled only for certain fields?
Абдулла
Show us the view code
class OrdersView(APIView): @staticmethod def get(request): try: orders = Orders.objects.all().order_by(&#39;-created_date&#39;, &#39;-created_time&#39;) serializer_class = OrdersForReadingSerializer orders = serializer_class.setup_eager_loading(orders) orders = serializer_class(orders, many=True) return Response({&#39;orders&#39;: orders.data}, status=status.HTTP_200_OK) except Exception as e: return Response( {&#39;exception&#39;: str(e)}, status=status.HTTP_500_INTERNAL_SERVER_ERROR)