Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
Django REST Framwork: How do I use the ListAPIView cache only for anonymous users?
I think I saw something somewhere before about using the ListAPIView cache only for anonymous users, but when I looked again, I could not find any such information. I seem to recall that it could be done in settings.py or in the decorator. Does anyone know of such a section? -
DJANGO - What is more used, Class Based Views or Function Based Views?
I know that each one has advantages and disadvantages, but I would like to know which one I should focus on more, which would be the most used in the job market? -
How can I share a python module and its variables between uwsgi workers using Django
I'am currently working on a Django app that uses a module I created called stream. This module starts a thread to open a camera with opencv and yield frames. Now That I am trying to run it with nginx and uwsgi I realized that the stream module gets initialized with every new worker. This causes a problem as each worker is attempting to start a new connection with the same camera. Is there a way to make this stream module globally accessible between workers instead of being initialized by every worker? (below is a snippet of my views.py) from . import stream @xframe_options_exempt @login_required def stream_log(request) -> StreamingHttpResponse: """ This endpoint requires a logged in user to view the logged data for the current stream session. It is fed through an iframe into the `view` page :param request: http request :return: StreamingHttpResponse """ try: return StreamingHttpResponse(stream.log_feed()) except: pass @login_required @gzip.gzip_page def camera_stream(request) -> StreamingHttpResponse: """ This endpoint requires a logged in user to view the stream feed from the camera. It is fed through an iframe into the `view` page :param request: http request :return: StreamingHttpResponse """ try: return StreamingHttpResponse(stream.video_camera.feed(), content_type="multipart/x-mixed-replace;boundary=frame") except: pass -
optimize solution for multi user type , two of them share manytomany field
The system is mutli user(based on signals) : Company Driver Client Company and Driver have team and can invite drivers to their teams So company and driver share the team field which is many to many field I found two solutions : First one: Team field will be in the BaseUser mode. pros: Simple implementation Cons: client user will have a team field on it’s record in database which mean redundant data. Second one: Create abstract model hold team field, then both company, driver models will inherit that abstract model. Pros: Avoid creating team field in Client user Cons: More code Code a little bit messy Increase complexity of invitation and join logic ( must be optimized to fetch if the invitation creator is a company or driver then deal depend on that) , (in first solution the creator always will be the BaseUser) Add an extra fields to invitation object refere to CompanyMembership and DriverMembership, (in first solution was just a field refere to the general membership), but this invitation object will delete after joining , will be kept in database in case the invited one does not joined , and can solve by using celery to delete expired … -
How do I work around 'circular import' in Django?
I'm getting a 'circular import' error when trying to makemigrations in Django. The two models in question are these. The error is being flagged on Team. from django.db import models from django.contrib.auth.models import User from footballapi.models.team import Team from footballapi.models.bio import Bio class Player(models.Model): user = models.OneToOneField(User, on_delete=models.CASCADE) bio = models.ForeignKey(Bio, on_delete=models.CASCADE) teams = models.ManyToManyField(Team, on_delete=models.CASCADE, related_name="members") from django.db import models from footballapi.models.player import Player class Team(models.Model): name = models.CharField(max_length=50) roster_spot = models.ForeignKey(Player, on_delete=models.CASCADE) I think the issue is with the ManyToManyField, and I keep reading that I should use a string instead of the import. But I've tried every combination of words and can't find the right string. What should it be? By the way, these models are all from the same app. -
How to install Cairo on Windows 11
I'm trying to run "python manage.py makemigrations" on Windows 11. I keep getting an error saying that "OSError: dlopen() failed to load a library: cairo / cairo-2 / cairo-gobject-2 / cairo.so.2". I've searched the internet to see how I can install this library but all of the sources I've seen were outdated and none of the solutions worked. Has anybody been able to install cairo on Windows 11? -
How to get all referenced objects in Django?
I have two models: class ArticleCategory(models.Model): Category_name = models.CharField(max_length=50, null=False, blank=False) def __str__(self): return self.Category_name class Article(models.Model): Title = models.CharField(max_length=100, blank=False, null=False) Content = tinymce_models.HTMLField(null=False, blank=False) Category = models.ManyToManyField(ArticleCategory,blank=False) Assuming that the user will create some categories without necessarily linking them to any article, how do I get all the ArticleCategory objects that at least have one Article object linked to them? -
I understand decorators on a base level but am confused by @django.display()
Working through the django tutorials and came across the following code: @admin.display( boolean=True, ordering='pub_date', description='Published recently?', ) Had no idea what it was so I did some googling and learned what decorators are in Python. I feel comfortable with that topic. However, in all the videos and docs I went through I didn't see an example like @admin.display() Only things like @log or @timer. Pretty much just a simple class or function decorator. My guess is that @admin.display is a decorator where admin is the class and display is one of many wrapper methods(is that even possible) in that class? Just confused I guess as to the syntax as I can't find any examples like it :( -
How do I indicate ManyToMany relationship in Django models when both are primary keys?
I'm creating Django models and I'm having an issue designating a ManyToMany relationship so that a join table is created in the database. The two models I'm trying to join look like this: class Host(models.Model): user = models.OneToOneField(User, on_delete=models.CASCADE) bio_information = models.ForeignKey(Bio, on_delete=models.CASCADE) class Team(models.Model): name = models.CharField(max_length=50) creator = models.ForeignKey(Host, on_delete=models.CASCADE) They need to join on the primary keys, so that I end up with a join table that looks like this with the table name host_team: id int [PK] host_id int team_id int Since you don't include the ID when creating models, how do I designate the MtoM relationship and get django to create the join table? -
Onetimesecret on django rest
I trying to do service onetimesecret(https://onetimesecret.com/) on DRF. I dont know, how I can add code word to get the phrase.I will be very glad, if you help me models.py class Secret(models.Model): """ Secret """ secret = models.TextField() # Поле для ввода секрета code_word = models.CharField(max_length=22) # Поле для ввода кодовой фразы slug = models.SlugField(max_length=255, unique=True, verbose_name='URL') def __str__(self): return f'{self.id} = {self.code_word}' def get_absolute_url(self): return reverse('post', kwargs={'post_slug': self.slug}) views.py from rest_framework import generics from rest_framework.response import Response from rest_framework.views import APIView from .logic import link_generate from .models import Secret from .serializers import SecretSerializer class SecretCreateView(generics.CreateAPIView): serializer_class = SecretSerializer def post(self, request, *args, **kwargs): serializer = SecretSerializer(data=request.data) if serializer.is_valid(): serializer.validated_data['slug'] = link_generate() serializer.save() return Response({ 'Slug': serializer.validated_data['slug'], }, status=201) return Response(serializer.errors, status=400) class GetSecretViewSet(APIView): def get(self, request, slug): secrets = Secret.objects.get(slug=slug) serializer = SecretSerializer(secrets) return Response(serializer.data) -
Django only reading some environmental values
I have a Django project deployed with Docker, and now the project doesn't load all my environmental values specified in the .env file. Only some of them are read. This is my .env file: DJANGO_DEBUG=changeme(1/0) DB_NAME=changeme DB_USER=changeme DB_PASS=changeme SECRET_KEY=changeme EMAIL_PASSWORD=changeme EMAIL=email@example.com DOMAIN=example.com And in setting.py I access the values that way: DEBUG = bool(int(os.environ.get('DJANGO_DEBUG', 0))) DATABASES = { 'default': { 'ENGINE': 'django.db.backends.postgresql', 'HOST': os.environ.get('DB_HOST'), 'NAME': os.environ.get('DB_NAME'), 'USER': os.environ.get('DB_USER'), 'PASSWORD': os.environ.get('DB_PASS'), } } EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend' EMAIL_HOST = 'smtp.gmail.com.' EMAIL_USE_TLS = True EMAIL_PORT = 587 EMAIL_HOST_USER = os.environ.get('EMAIL') EMAIL_HOST_PASSWORD = os.environ.get('EMAIL_PASSWORD') All the database related values are read properly as well as the secrey key. But the rest of the values are not read, and I don't understand why. Which could be the problem? -
Google Places API - Autocomplete not firing
I asked a question on the same topic a couple of days ago, but made some progress (I found some code) so I thought I would create a new question. I am still trying to input the Google Places API into a form for businesses. I tried all sorts of combinations from the various posts I have seen on here, but still no luck. So it's likely I am either missing something or have made a typo that I cannot spot. Starting with the JavaScript file In a very simple version of the file, calling auto complete works. function initAutocomplete(){ autocomplete = new google.maps.places.Autocomplete(document.getElementById("autocomplete"),{ componentRestrictions: {'country':['uk']}, fields: ['name','geometry','address_components'], types:['establishment','geocode'] }); autocomplete.addListener('place_changed'); } (I do get a message saying "Uncaught TypeError: Cannot read properties of undefined (reading 'apply')" but I still get a return) However, I soon as I start adding more code, something breaks and I am told that "initAutocomplete is not a function". I found a solution to that. Reading a few post on here, an easy way to get rid of this message is simply to get rid of "&callback=initAutocomplete" at the end of the script. But a new problem turns up: the auto complete simply doesn't fire … -
why i am getting error while installing package from requirement file in django
Hi Everyone i have clone my django project on ubuntu machine(22.04.1 LTS) python version is- 3.8.10 and django version is 2.2 while installing packages using cmd pip install -r requirements.txt then after installing some packages i got error, as per me this is mysqlclient error Note-mysql db working fine. please help me out. Error Collecting mysqlclient==2.0.3 Using cached mysqlclient-2.0.3.tar.gz (88 kB) Preparing metadata (setup.py) ... error error: subprocess-exited-with-error × python setup.py egg_info did not run successfully. │ exit code: 1 ╰─> [16 lines of output] /bin/sh: 1: mysql_config: not found /bin/sh: 1: mariadb_config: not found /bin/sh: 1: mysql_config: not found Traceback (most recent call last): File "<string>", line 2, in <module> File "<pip-setuptools-caller>", line 34, in <module> File "/tmp/pip-install-490urkf8/mysqlclient_91ecf52f39004862be75d78177e00bdb/setup.py", line 15, in <module> metadata, options = get_config() File "/tmp/pip-install-490urkf8/mysqlclient_91ecf52f39004862be75d78177e00bdb/setup_posix.py", line 70, in get_config libs = mysql_config("libs") File "/tmp/pip-install-490urkf8/mysqlclient_91ecf52f39004862be75d78177e00bdb/setup_posix.py", line 31, in mysql_config raise OSError("{} not found".format(_mysql_config_path)) OSError: mysql_config not found mysql_config --version mariadb_config --version mysql_config --libs [end of output] note: This error originates from a subprocess, and is likely not a problem with pip. error: metadata-generation-failed × Encountered error while generating package metadata. ╰─> See above for output. note: This is an issue with the package mentioned above, not pip. … -
Create a view with two functionalities so that it can all be in one template?
I need my template to display an edit button after the comment is done but I have no idea on how I could and should do that. Is it a view or a method in FeedbackView that I shoul make? Usually I would a view for each action but wouldn't it require me to do a different template for each one of the views? Also, how can a user be restricted to only doing one comment? # VIEW class ProductFeedbackView(DetailView): model = Product template_name = 'store/product_feedback.html' def get_context_data(self , **kwargs): data = super().get_context_data(**kwargs) connected_comments = Comment.objects.filter(product=self.get_object()) number_of_comments = connected_comments.count() data['comments'] = connected_comments data['no_of_comments'] = number_of_comments data['comment_form'] = CommentForm() return data def post(self , request , *args , **kwargs): if self.request.method == 'POST': comment_form = CommentForm(self.request.POST) if comment_form.is_valid(): content = comment_form.cleaned_data['content'] new_comment = Comment(content=content, author=self.request.user, product=self.get_object()) new_comment.save() return redirect(self.request.path_info) # FORM class CommentForm(forms.ModelForm): class Meta: model = Comment fields = ['content'] # MODEL class Comment(models.Model): product = models.ForeignKey(Product, on_delete=models.CASCADE, blank=True, null=True, related_name='comments') author = models.ForeignKey(User, on_delete=models.CASCADE, blank=True, null=True,) content = models.CharField(max_length=200, null=False, blank=True) date = models.DateTimeField(auto_now_add=True) class Meta: ordering = ['-date'] # TEMPLATE {% if user.is_authenticated %} <form action="" method="POST" id="main_form"> <div> <label for="comment">Type comment</label> {{ comment_form }} {% csrf_token %} … -
django-dramatiq pipelines only run first stage
I am trying to use django-dramatiq to run a pipeline of several stages, each defined as dramatiq Actors, using the pipeline(<stages>).run() method but it's only running the first stage/Actor and not attempting the other stages. I've defined some cutdown fake actors to illustrate the problem: import dramatiq @dramatiq.actor def fake_extract(process_pk, *args, **kwargs): print(f"fake_extract: Process PK= {process_pk} Running extract on {kwargs['fits_file']}") @dramatiq.actor def fake_astromfit(process_pk, *args, **kwargs): print(f"fake_astromfit: Process PK= {process_pk} Astrometric fit on {kwargs['ldac_catalog']}, updating {kwargs['fits_file']}") @dramatiq.actor def fake_zeropoint(process_pk, *args, **kwargs): print(f"fake_zeropoint: Process PK= {process_pk} ZP determination on {kwargs['ldac_catalog']} with {kwargs['desired_catalog']} ref catalog") I've then defined the stages and built a pipeline: import os from dramatiq import pipeline from test_dramatiq.dramatiq_tests import fake_extract, fake_astromfit, fake_zeropoint fits_filepath = '/foo/bar.fits' fits_file = os.path.basename(fits_filepath) steps = [{ 'name' : 'proc-extract', 'runner' : fake_extract, 'inputs' : {'fits_file':fits_filepath, 'datadir': os.path.join(dataroot, temp_dir)} }, { 'name' : 'proc-astromfit', 'runner' : fake_astromfit, 'inputs' : {'fits_file' : fits_filepath, 'ldac_catalog' : os.path.join(dataroot, temp_dir, fits_file.replace('e91.fits', 'e91_ldac.fits')), 'datadir' : os.path.join(dataroot, temp_dir) } }, { 'name' : 'proc-zeropoint', 'runner' : fake_zeropoint, 'inputs' : {'ldac_catalog' : os.path.join(dataroot, temp_dir, fits_file.replace('e91.fits', 'e92_ldac.fits')), 'datadir' : os.path.join(dataroot, temp_dir), 'desired_catalog' : 'PS1' } }] pipes = [] for step_num, step in enumerate(steps): inputs = step['inputs'] print(f" Performing pipeline step {step['name']}") pk … -
AWS public ip refused to connect on broswer even tho docker-compose is running fine and all traffics are allowed
I have onfigured all the security groups ports and address, i can connect to the ec2-user from my terminal. when i run docker-compose up --build it fires up successfully, but the ip 13.36.211.140 ec2-13-36-211-140.eu-west-3.compute.amazonaws.com resfuse to connect on the browser. These are all the rules i have i have also read many stackoverflow and blog posts to fix this, i have added many rules to accept ports as you can see below. What might be the best fix for this? I know i am definitely missing something... this is my docker-compose.yaml file version: '3' services: django_app: build: . env_file: - .env volumes: - static_vol:/app/static - media_vol:/app/media ports: - "8000:8000" nginx: build: ./nginx volumes: - static_vol:/app/static - media_vol:/app/media ports: - "80:80" depends_on: - django_app volumes: static_vol: media_vol: Updated >>>>>>>>>>>>>>> when i change the url to http, the url turns to https://django/ this is how it looks -
Deploy django with SQL Server on host [closed]
I want to deploy my first django app on host but everywhere i read documentation about deploying django with sqllite -
Getting M2M field data in template Django
I want to get m2m data in my template through the views but failing to do so. The thing is that I'm able to show the data of m2m field looping it from template itself but it does slow down the website. My Team apps Model looks like this: class Team(models.Model): title = models.CharField(max_length=255) team_country = CountryField(max_length=200, blank=True, null=True) members = models.ManyToManyField(User, related_name='teams') created_by = models.ForeignKey(User, related_name='created_teams', on_delete=models.CASCADE) Now in my tournament app I'm trying to get "members" of the team. My Tournamet Views look like this: def tournament_page(request, slug): page = 'tournament_page' user = request.user tournament = Tournament.objects.get(slug=slug) players = tournament.participants.select_related('user') all_players = Profile.objects.select_related('user') side_tourneys_ongoing = Tournament.objects.filter(state='Ongoing')[:10] side_tourneys_upcoming = Tournament.objects.filter(state='Upcoming')[:10] side_tourneys_completed = Tournament.objects.filter(state='Completed')[:10] teams = Team.objects.select_related('created_by') context = { 'page': page, 'tournament': tournament, 'side_tourneys_ongoing': side_tourneys_ongoing, 'side_tourneys_upcoming': side_tourneys_upcoming, 'side_tourneys_completed': side_tourneys_completed, 'teams': teams, 'players':players, 'all_players':all_players } Now I'm able to show the teams with their members in the template using for loop inside the template itself as: Html template <div class="grid-x"> {% for team in teams %} {% for player in players %} {% if team.id == player.active_team_id and team.game == tournament.game %} <div class="wf-card event-team"> <div> {{team.title}} </div> <div class="event-team-players"> {% for member in team.members.all %} {{ member.username }} {% … -
Refuse connect to my local server database MySQL
I working with a project in Python and Postgress And I should had a methode to connect to db from MySQL I write this function def connexion (): db = mysql.connect( host = "localhost", user = "root", passwd = "", database = "Test", port ="3306" ) return db when I call this function to verify linking database I had this error raise exception.with_traceback(None) from new_cause mysql.connector.errors.InterfaceError: 2003: Can't connect to MySQL server on 'localhost:3306' (111 Connection refused) What I should I do to make this connection validated RQ: I'm sure about name and port number -
Django filter query when two datetime columns have same date
I want to filter a Django queryset when two datetime columns have the same date. I have tried the following two codes that do not work : drivers = drivers.filter(deleted_at__date=F("created_at__date")) and drivers = drivers.filter(deleted_at__date=F("created_at")) -
Reverse for 'app_list' with keyword arguments '{'app_label': 'common'}' not found. 1 pattern(s) tried: ['admin/(?P<app_label>auth|otp_totp)/$']
config/urls.py from django_otp.admin import OTPAdminSite from django.contrib.auth.models import User from django_otp.plugins.otp_totp.models import TOTPDevice from django_otp.plugins.otp_totp.admin import TOTPDeviceAdmin class OTPAdmin(OTPAdminSite): pass admin_site = OTPAdmin(name='OTPAdmin') admin_site.register(User) admin_site.register(TOTPDevice, TOTPDeviceAdmin) urlpatterns = [ re_path(r'^admin/', admin_site.urls) ] common/admin.py from common.models import ConfigVar, ConfigVarFile, Source from config.urls import admin_site admin_site.register(ConfigVar) admin_site.register(ConfigVarFile) admin_site.register(Source) error {"@timestamp": "2022-08-24T16:21:04.889396Z", "ecs.version": "1.0.0", "log.level": "ERROR", "message": "Internal Server Error: /admin/", "process.thread.name": "Thread-1", "log.logger": "django.request", "fileName": "log.py", "funcName": "log_response", "lineNo": 241, "spanId": "d5bb9ad916674801", "traceId": "d5bb9ad916674801", "error.type": "<class 'django.urls.exceptions.NoReverseMatch'>", "error.message": "Reverse for 'app_list' with keyword arguments '{'app_label': 'common'}' not found. 1 pattern(s) tried: ['admin/(?P<app_label>auth|otp_totp)/$']", "error.stack_trace": "Traceback (most recent call last):\n File \"/Users/tiwari.aditya/.pyenv/versions/3.9.13/envs/amsnbfcvenv/lib/python3.9/site-packages/django/core/handlers/exception.py\", line 55, in inner\n response = get_response(request)\n File \"/Users/tiwari.aditya/.pyenv/versions/3.9.13/envs/amsnbfcvenv/lib/python3.9/site-packages/django/core/handlers/base.py\", line 197, in _get_response\n response = wrapped_callback(request, *callback_args, **callback_kwargs)\n File \"/Users/tiwari.aditya/.pyenv/versions/3.9.13/envs/amsnbfcvenv/lib/python3.9/site-packages/django/contrib/admin/sites.py\", line 261, in wrapper\n return self.admin_view(view, cacheable)(*args, **kwargs)\n File \"/Users/tiwari.aditya/.pyenv/versions/3.9.13/envs/amsnbfcvenv/lib/python3.9/site-packages/django/utils/decorators.py\", line 133, in _wrapped_view\n response = view_func(request, *args, **kwargs)\n File \"/Users/tiwari.aditya/.pyenv/versions/3.9.13/envs/amsnbfcvenv/lib/python3.9/site-packages/django/views/decorators/cache.py\", line 62, in _wrapped_view_func\n response = view_func(request, *args, **kwargs)\n File \"/Users/tiwari.aditya/.pyenv/versions/3.9.13/envs/amsnbfcvenv/lib/python3.9/site-packages/django/contrib/admin/sites.py\", line 242, in inner\n return view(request, *args, **kwargs)\n File \"/Users/tiwari.aditya/.pyenv/versions/3.9.13/envs/amsnbfcvenv/lib/python3.9/site-packages/django/contrib/admin/sites.py\", line 553, in index\n app_list = self.get_app_list(request)\n File \"/Users/tiwari.aditya/.pyenv/versions/3.9.13/envs/amsnbfcvenv/lib/python3.9/site-packages/django/contrib/admin/sites.py\", line 537, in get_app_list\n app_dict = self._build_app_dict(request)\n File \"/Users/tiwari.aditya/.pyenv/versions/3.9.13/envs/amsnbfcvenv/lib/python3.9/site-packages/django/contrib/admin/sites.py\", line 519, in _build_app_dict\n \"app_url\": reverse(\n File \"/Users/tiwari.aditya/.pyenv/versions/3.9.13/envs/amsnbfcvenv/lib/python3.9/site-packages/django/urls/base.py\", line 88, in reverse\n return resolver._reverse_with_prefix(view, prefix, *args, **kwargs)\n File \"/Users/tiwari.aditya/.pyenv/versions/3.9.13/envs/amsnbfcvenv/lib/python3.9/site-packages/django/urls/resolvers.py\", line 802, in … -
A shutdown hook for Django with mod_wsgi
I have a simple Django server that runs and manages some services in the backgrounds. I want to stop those services when the server stops. After looking online, I have found this solution: signal.signal(signal.SIGINT, _stop_services) And it works great when I run the server with python manage.py runserver. But, when I run the server with Apache engine and mod_wsgi and restarting/stopping the apache server, the callback is not invoked. I also tried using SIGTERM and even the atexit module, but none of them worked. Is there any built-in solution in Django for this? I know that in packages like aiohttp you can add a listener that will be called when the server shuts down. -
How to make create and retrieve work in the same serializer?
i have a somewhat tangled problem, I have the following models class ModelA(models.Model): name = models.CharField(max_length=64) class ModelB(models.Model): model_a = models.ForeignKey(ModelA, on_delete=models.CASCADE) and the serializers class ModelASerializer(serializers.ModelSerializer): class Meta: model = ModelA fields = '__all__' class ModelBSerializer(serializers.ModelSerializer): terminal = ModelASerializer(read_only=True) class Meta: model = ModelB fields = '__all__' when I want to create a ModelB object including the model_a_id it has 2 responses depending on whether I put the read_only=True or False I would like that when I try to create via POST in an object of ModelB I only have to send the mode_a_id, but at the same time when I do a GET it returns the serialized data of ModelASerializer in the model_a field. If I put the read_only = True it only works to receive the serialized data in GET, but via POST I cannot assign an id to model_a in case of read_only=False, I can't assign the id to that object either since it asks me for a dictionary, I imagine to create a new ModelA Object, but I only want to assign one that already exists. A solution may be to place the serializer with another variable name, but I would really like it to … -
show dynamic data from form value change in template
I'm new to django, i'm used to angular. i'm trying to do something that make sense to me in angular and I can't achieve in django. I'm working with python 3.9 and django 4.1 I simplified my case to this.. I have a form that I created and and a view for it, i have a select element, whenever i select something, i want to show what i selected. so I created a LocationForm form class: class LocationForm(forms.Form): apartment_type = forms.ModelChoiceField(queryset=ApartmentType.objects.all()) apartment type is just a list of apartment types (building, apartment, garden and so on) i past the form to the view: def location(request): context = {'form': LocationForm} return render(request, 'prospects/location.html', context) and the code for the view: {% load static %} <form> {% csrf_token %} {{ form.as_p }} <input type="submit" value="Save"> </form> CCC{{ form.apartment_type.value }}DDD<br/> the problem is that no matter what I select, form.apartment_type.value still shows None, it's not being updated. i guess i'm used to angular too much but this issue is really alarming for me if django only parses things statically, i guess i'm not used to it and i have no idea how to resolve it otherwise. in my full code i want to … -
Fcm-Django IOS no sound
So everything works fine in terms of notifications being sent. however, no sound gets played when a notification is delivered to an IOS device I am using fcm-django as the package. here is the code I use: myself is just the user sending the notification to. fcmdevicee = FCMDevice.objects.get(user=usertosendto) fcmdevicee.send_message(Message( notification=Notification( title=f"{myself.username}new notification") ))