Acquaintance
Does anybody have telegram-django sync solution?
LIke a temporary database with unread messages or smth like that
Which the client was used? (telethon/python-telegram etc.)
How were you caching that? (get_dialogs then filter)
Acquaintance
I try to write an additional extension to an internal "CRM" and I'd like to avoid flooding ban (Maybe I'll use django scheduler)
Данил
Данил
Данил
Данил
You can use pymongo library
ᅠ ᅠ
Данил
Or import DjangoProject.DjangoApp.YourModule.YourFunctionOrVariable as func
Данил
Acquaintance
As I have got you need MongoDB to save extra data
For a start, I can use an existing sqlite to store "unread chats"
The thing is that I wanna make "folders" in models.py and relate telegram unread chats to them and to my CRM users (profile in models.py)
I just need to show if the user has any unread chats which are related to the user
Soo... maybe there is a ready to go solution and somebody has already written such a thing
The question is how to cache those chats without flooding.. in fact, this question partly concerns django
Acquaintance
Данил
Question not for me😁😁😁. I don't understand folders in models.py
Acquaintance
The models.py will have a class with some relations
user = ForeignKey(profile)
chats = m2m(all_the_chats)
Then all the related chats will be filtered by "unread" boolean value or something like that
Данил
Show your asgi.py
Данил
Did you configured Chanel_Layers variable in your settings.py?
Данил
CHANNEL_LAYERS = {
'default': {
'BACKEND': 'channels_redis.core.RedisChannelLayer',
'CONFIG': {
"hosts": [("redis", 6379)],
},
},
}
For example
Данил
Your project name is myproject?
Данил
Данил
Than just install redis local on your machine and run it
Данил
Данил
I'm not sure but if you will read Django channels documentation you will get why I use redis
Данил
https://redis.io/docs/install/install-redis/install-redis-on-linux/
Данил
redis on your machine
Данил
computer
Данил
I hope you are using linux or mac os
Данил
Did you ran redis?
Данил
Данил
To start redis command redis-server
Mahan
how fix this error?
TypeError: fromisoformat: argument must be str
Charly
ᅠ ᅠ
Guys, there's a problem. There are files that are not in the project (saving to the database after collecting data from the site, the parsing script itself and the launch script). All these files are located outside the project, when I run them, they work. As soon as I transfer them to the project, there is an error, I tried imports - also an error. The GPT chat did not help, nor did the forums. Maybe someone has encountered this. I use Selenium, BS4, Django.
Shan
I'm new in django. Anyone have some guidelines how to create a function in django python. I have script in java to move java function to python function as an API
Charly
Shan
Charly
No
Then you should learn Python before trying to even try Django.
Muflone
You need to know python to script in Python
Charly
Shan
Ahmed
Yeh but the serialization
C_K
15 days is sufficient to learn django ?
C_K
I don't have experience as I am fresher
Maxim
C_K
Charly
Yes
That isn't a no/yes question.
C_K
Yes I have experience in python and basic web dev
C_K
Charly
Minimum how many days ?
As you don't give details you'll probably need twice as much or more as you suggested.
Charly
It also depends on how many time you invest.
Charly
And if you are good at self learning.
C_K
Okay, thanks
peenyywise
Hi everyone is there anyone who know django cms
peenyywise
I need some help
Doragonsureiyā
I need some help
No one can help you until you explain your difficulties.
peenyywise
Actually I have a plugin in my djangocms project and I need to give a delete button which on click should delete the image but only after saving the plugin
hadi
hi, deploy a Django channels project using daphne and supervisor with the help of docker and docker compose, how can it be arranged and sequenced in docker compose? should supervisor and Daphne setting up and be on the main project image or seprate images?
Doragonsureiyā
Jamal
# user_management/forms.py
from django import forms
from .models import UserList
class UserForm(forms.ModelForm):
class Meta:
model = UserList
fields = 'all'
approval = forms.ModelChoiceField(
queryset=UserList.objects.filter(designation__in=['Management', 'HOD']),
label='Approved By'
)
def label_from_instance(self, obj):
return f"{obj.fname} {obj.lname}"
—————————————
My question is, while using in the user_form.html
UserList Object('1111')
But I need to bring fname, lname and store the employee_number in the record
Anonymous
Hello, how can I pass 2 models to the DetailView class in views.py?
Mirco
Anonymous
whats your goal ?
I want to create a page with publication and comments, so I have to pass Comments and Publication models.
Anonymous
Mirco
your Publication model should have relationship with Comments
if you don't know what FK is, please study basics from beginning
Anonymous
Oh, sorry. Did you mean Foreign Key?
Anonymous
And I have to make relationship between Publication and Comments by Foreign key?
Mirco
Anonymous
Thanks
Same
Hello. I have a django app that sends an email with a predefined text to an address entered by the user. I would like to know if there is a way in Django to limit the number of times a user can send mail to either one or different addresses. My plan is that if not, I would store the recipient email and the sending date in the database so that the page would give an error message when trying to send the email as long as a certain time had not passed, but That does not prevent multiple users from spamming the same address. I hope I have been able to explain myself
The IT
The IT
When sending email check the model to see if email exist don't trigger mail if not process the email
Anonymous
I want to make three types of users in my django project one for manager , doctor and patient . There will be restrictions on which webpages they can access ... Can someone suggest me how can I do this..
Muflone
Anonymous
But the required details for three of them are different from each other . For example - doctor will have their degrees , specialization on the other hand required details from patients is phone number, blood group,etc
Muflone