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)
Данил
Hello I want to create a project with Celery and Django for my resume, but I have no idea Help 😅
Celery documentation will help you, and you have to use Redis this noted in Celery documentation
Данил
Данил
You can use pymongo library
ᅠ ᅠ
It's strange cause you can use instruction import. There is no problem
I got it, I'm stupid because I forgot to write from... import😂
Данил
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
Данил
Question not for me😁😁😁. I don't understand folders in models.py
Acquaintance
Question not for me😁😁😁. I don't understand folders in models.py
No no.. it's gonna be a usual object😅 I mean it'll be shown to the user as a folder
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?
Данил
Try my variant, it's have to work but you have to use redis
And localhost instead redis in message if it's not docker compose your using
Данил
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
ᅠ ᅠ
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.
Wolfred
Hi guys, im integrating Celery with django and im always getting the following error: ImportError: cannot import name '_state' from partially initialized module 'hydra_manager.celery' (most likely due to a circular import) This is my code at hydra_manager/__init__.py (this is the code causing the problem): # This will make sure the app is always imported when # Django starts so that shared_task will use this app. from .celery import app as celery_app # __all__ = ("celery_app",) And this is my hydra_manager/celery.py file: import os from celery import Celery # Set the default Django settings module for the 'celery' program. os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'hydra_manager.settings') app = Celery('hydra_manager') # Using a string here means the worker doesn't have to serialize # the configuration object to child processes. # - namespace='CELERY' means all celery-related configuration keys # should have a `CELERY_` prefix. app.config_from_object('django.conf:settings', namespace='CELERY') # Load task modules from all registered Django apps. app.autodiscover_tasks() @app.task(bind=True, ignore_result=True) def debug_task(self): print(f'Request: {self.request!r}')
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
No
Then you should learn Python before trying to even try Django.
Muflone
You need to know python to script in Python
Ahmed
Yeh but the serialization
C_K
15 days is sufficient to learn django ?
Charly
15 days is sufficient to learn django ?
Depends on your skills and experience.
C_K
I don't have experience as I am fresher
Charly
I don't have experience as I am fresher
Experiencie learning things, using other framewoks, with python, etc.
Charly
Yes
That isn't a no/yes question.
C_K
Yes I have experience in python and basic web dev
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?
Anonymous
whats your goal ?
I want to create a page with publication and comments, so I have to pass Comments and Publication models.
Mirco
I want to create a page with publication and comments, so I have to pass Comments and Publication models.
so u don't need 2 models, I mean, the DetailView needs Publication model and then inside its template you can show comments related to that publication via FK
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?
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
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..
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