Mirco
Hello can I have a Django project and I want to deploy it on AWS. Can somebody please tell me which service I should use. I am confused between EC2 and S3 services. Like if I use EC2 then do I have to use S3 or not
EC2 is like a "VM" , S3 is a storage service and you can use with Django to store statics and media files , while your Django app will run on an EC2 machine but if you can, you should study what ECS and Fargate is, so you can run a docker container serverless
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
fn
Hi all! Did anybody try python-telegram-bot library with Django to create Telegram bots?
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
https://stackoverflow.com/questions/70693182/how-to-send-django-model-objects-details-as-answer-according-to-the-users-choi
well if you already can fetch the row from the database what exactly is stopping you?
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}'
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
Neo
What about an image? {obj.img.url} ?
If it has an image you might want to consider using sendPhoto with other details like price and name in caption
ꜱᴀᴇᴇᴅ
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
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
Neo
It is not public)
then you can upload it
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
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
Noobcoder0918
Yes
Well I'm trying that but getting module not found error
Arvindhan
Well I'm trying that but getting module not found error
Have you registered the app in your settings config ?
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
Chirag
Hello I am having trouble in setup django , can anyone help me plz
Charly
Hello I am having trouble in setup django , can anyone help me plz
you'll need to explain here whats the issue
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
Like an api driven ui?
Michael the wolf 🐺
i will look into that . thanks. i am not aware of it
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
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
I'dont know how implement it correctly on views, I make a try and works fine, but maybe is not correct
I use drf and I do it in the same way with permission_classes in the viewset
GG
thanks!
Carlitos
Check the Django admin documentation there are some examples
Оппозиция
Why doesn't bulk_update update the first element?
Charly
Why doesn't bulk_update update the first element?
It does, if not, you code may be wrong
Оппозиция
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
👍🏻
Adiziel
Is it possible to create non superuser in tenant if yes please refer me some article or some resource
Adiziel
you can create non-suoper users in djang admin
Yeah but I want those normal users specific to a perticular tenant
Charly
Yeah but I want those normal users specific to a perticular tenant
Djangohas no tenants by default so you are the only one that knows how tenants are implemented on your application
Shilpy
Pagination in Django Rest Framework giving wrong count. How to solve this?
Shilpy
As in? Like what is affecting the count value?
Charly
As in? Like what is affecting the count value?
It's impossible to say without seeing what you did
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.
Vadim
Hi, what field can be used for an array of values?
Vadim
or list values?
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..).
vvv
anyway can someone help me to upload django on hosting?