Sergey
Hi guys! I want to now if there any kwarg or option for set only delete for filefield. I need it for some reason
Armin
fn
Hi all!
Did anybody try python-telegram-bot library with Django to create Telegram bots?
Neo
Neo
or perhaps i should rephrase to what do you want to do that you need to involve django in it?
fn
Django ORM only.
fn
I've posted a question on stackoverflow
fn
https://stackoverflow.com/questions/70693182/how-to-send-django-model-objects-details-as-answer-according-to-the-users-choi
Neo
Arvindhan
Have anybody used drf for react native backend ?
Neo
you would simply construct a string with the models' fields
response = f'Product Name: {obj.name}\nCost: {obj.cost}'
fn
Doragonsureiyā
Have anybody used drf for react native backend ?
Don't ask meta questions like:
"Any user of $x here?"
"Anyone used technology $y?"
"Hello, I need help on $z!"
Just ask directly! The better you are at explaining the problem, the more likely you are to get help.
Asking smart questions
ꜱᴀᴇᴇᴅ
Hi friends, I wrote a model that takes a few things with a slug. I left this slug by default.
success_url = "{slug}"
I use it like this, I try to save it, the first time it only saves, if I leave another one, it gives an error, I don't know where the problem comes from, can anyone help?
Neo
if the image is open to the public you can simply provide a url to it and telegram should take care of the rest with sendPhoto
fn
fn
Neo
If i were you i would probably write a serializer or something around the model to make a string representation or whatever that would give you what you need to send back to telegram
fn
Thank you very much! I did not think about it)
Neo
No problem. Is your source code public? I'm curious to see how you integrated django with ptb
Neo
django's components should start throwing errors if it isn't properly initialized using the settings module and stuff in my experience
Neo
mm turns out it was a pretty simple google
fn
I think in my case, taking into account that bot is simple, there are no errors
fn
I will post the source code tommorow and let you know
fn
Noobcoder0918
Hello guys I wanted to know if we can import models from one app to another??
Noobcoder0918
I'm getting module not found error when trying to do so
Sergey
Arvindhan
Arvindhan
Noobcoder0918
Yes
Well I'm trying that but getting module not found error
Arvindhan
Sachin Bhati
Can anyone help me ...
How to POST a data to database thorough Api
I have an api ...I have one html css form ... User have to give an input and then that users data I have to store in my database ...how can I do that ....how can I connect my api with html css form? Can anyone hel me out please
Noobcoder0918
Fan / Ac
Chirag
Hello I am having trouble in setup django , can anyone help me plz
Charly
Michael the wolf 🐺
Hi , lets say we are including sidebar.html file into index.html. is it possible to put contents into sidebar.html file from index.html using any blocks ? basically i want to different items in sidebar in different files.
Michael the wolf 🐺
one option i know is to check current url and use if clause to change contents in sidebar.html file
Rohan
Rohan
Like an api driven ui?
Michael the wolf 🐺
i will look into that . thanks. i am not aware of it
Rohan
Michael the wolf 🐺
cool ,i will do some research about it
Rohan
The UI is made generic and the content is all backend driven
Michael the wolf 🐺
nice
GG
Hello guys, what is a correct way for check permissions based on django groups and perms (has_perms or something) in DRF ? To keept a secure access to api resources
Charly
GG
I'dont know how implement it correctly on views, I make a try and works fine, but maybe is not correct
GG
class GroupView(mixins.ListModelMixin, mixins.CreateModelMixin, mixins.UpdateModelMixin, viewsets.GenericViewSet):
permission_classes = (IsAuthenticated, hasGroupListPermissions,) # if is auth
queryset = Group.objects.all()
serializer_class = GroupSerializer
GG
from rest_framework.permissions import BasePermission
from vulns.models import Group
class hasGroupListPermissions(BasePermission):
message = 'List groups not allowed.'
def has_permission(self, request, view):
return request.user.has_perm('view_group', Group)
Carlitos
GG
thanks!
Carlitos
Carlitos
Check the Django admin documentation there are some examples
Оппозиция
Why doesn't bulk_update update the first element?
Charly
Оппозиция
It does, if not, you code may be wrong
```
for message in messages_publish:
logger.info('id: %s public: %s' % (message.id, message.is_public))
Message.objects.bulk_update(messages_publish, ['is_public', 'is_pending'])
```
2022-01-14 22:38:33,842 models[70461] INFO: id: d096828c-3e46-46e2-bb88-39e5adf47d23 public: True
2022-01-14 22:38:33,842 models[70461] INFO: id: 826d3866-6c2d-4f5e-ba7b-813ca83730ab public: True
2022-01-14 22:38:33,842 models[70461] INFO: id: c338bc79-b2e3-4ddd-a1ca-7e3055454541 public: True
2022-01-14 22:38:33,842 models[70461] INFO: id: 6ac325b7-475b-4019-9866-801efb4f389d public: True
but element d096828c-3e46-46e2-bb88-39e5adf47d23
is not updated
A27
👍🏻
Izbash
Adiziel
Is it possible to create non superuser in tenant if yes please refer me some article or some resource
Charly
Shilpy
Pagination in Django Rest Framework giving wrong count. How to solve this?
Charly
Shilpy
As in? Like what is affecting the count value?
Shilpy
M***
I am inserting a 5 lakhs data to MySQL through Django. It will take arround 1.5 to 2 hr. So how could I speedup this process. The process is checking the data which is present inside the table and update or create the row in database.
Vaibhav
Vadim
Hi, what field can be used for an array of values?
Vadim
or list values?
Ashutosh
Ashutosh
Use .bulk_create()
Method..
Or you can run custom sql commond ( save your data in temp csv and upload to sql db using commond directly. )
Not safe... ( security issues..).
Sai
vvv
anyway can someone help me to upload django on hosting?