Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
Developing code checking app
We are gonna to develop an code checking app, so we need to check uploaded code. What do we need: launch code on different languages input to program`s terminal check the final output and compare it with the right solution repeat 2 and 3 step for some times commit to our database (if code is right for example) run 2 or more check workers on one machine be on linux (we prefer ubuntu) measure memory and processor usage (additional) get along with python be safety for server We consider LXD container hypervisor, but it looks terrible. Thanks in advance! -
django include a template into another template
I am trying to include a template into another template but the problem I am having now is the embedded templates doesnt display contents rendered on it in the new template I am trying to embed it into. detail.html {% include "list.html" with instance=user.posts_created.all %} and I have the template in the templates folder. The template is seen but the content does not show up in the detail.html additional codes would be provided on request thanks -
Making custom OAuth for Goodreads in django
Previously, I had made a webapp which used django-allauth for Facebook authentication. Now, for my next project, I am trying to authenticate users on Goodreads but none of the social auth libraries in python (like django-allauth, python-social-auth) support Goodreads, they only support major websites. I want any suggestions or ideas on how to make a custom social auth for my django website to authenticate and redirect users on Goodreads. Or is there any other alternative? The only relevant link I found is this. But it doesn't explains anything. -
Adding a new app to a separate database
I had an existing django project with multiple apps and a lot of tables in the database. Now, I am required to add an app to the existing project, and I want the tables in this new app to be created in a separate database. When I do: $ python manage.py makemigrations app_name $ python manage.py migrate sqlmigrate app_name 0001 $ python manage.py migrate --database=trial_IITK it does nothing. But when I do this extra step: $ python manage.py migrate it creates the table in the default database rather than in the new one. Relevant code snippets: /models.py in the new app from django.db import models # Create your models here. class Participant_IITK(models.Model): name = models.TextField() class Meta: app_label = 'trial_IITK' def __str__(self): return self.name /settings.py DATABASE_ROUTERS = ['CCBT.routers.DatabaseAppsRouter',] DATABASE_APPS_MAPPING = {'trial_site_1': 'trial_IITK', 'trial_site_2': 'trial_NIM'} DATABASES = { 'default': { 'ENGINE': 'django.db.backends.mysql', 'NAME': 'treadwill_org', 'USER': 'root', 'HOST': 'localhost', 'PORT': '3306', 'PASSWORD': '********' }, 'trial_IITK': { 'ENGINE': 'django.db.backends.mysql', 'NAME': 'trial_db_1', 'USER': 'root', 'HOST': 'localhost', 'PORT': '3306', 'PASSWORD': '********' }, 'trial_NIM': { 'ENGINE': 'django.db.backends.mysql', 'NAME': 'trial_db_2', 'USER': 'root', 'HOST': 'localhost', 'PORT': '3306', 'PASSWORD': '********' }, } /routers.py (taken from here) from django.conf import settings class DatabaseAppsRouter(object): def db_for_read(self, model, **hints): if model._meta.app_label in … -
URL not resolved with APIView in Django REST Framework for non-model end point
I'm using Django Rest Framework to create a non-model API endpoint, but I'm a having a bit of trouble setting it up. Below is my code. views.py from rest_framework import views, viewsets from rest_framework.response import Response from myproject.apps.policies.models import Customer from .serializers import CustomerSerializer class CustomerViewSet(viewsets.ReadOnlyModelViewSet): queryset = Customer.objects.all() serializer_class = CustomerSerializer class CalculateQuoteView(views.APIView): def get(self, request, *args, **kwargs): print('Just a random test.') return Response({"success": True, "content": "Hello World!"}) My url.py file: from django.conf.urls import include, url from .policies import views as policies_views from rest_framework.routers import DefaultRouter router = DefaultRouter() router.register('policies', policies_views.CustomerViewSet) #urlpatterns = router.urls urlpatterns = [ url(r'^quote/', policies_views.CalculateQuoteView.as_view()), url(r'^', include(router.urls)), ] Using curl for testing: curl -X GET http://localhost:8000/api/v1/policies/quote/ -H 'Authorization: Token 8636c43eb7a90randomtokenhere5c76555e93d3' I get the following output: {"detail":"Not found."} Basically, in the end I will need to pass in details to the quote API endpoint and get some response data. Is there something I'm missing? -
Complex Django filtering, where filter argument involves comparing two different foreignkey models
Using the below models, imagine five Capacity Instances, each associated to every User and every Question Instance to give independent a question_capacity_value for each capacity per question, and a user_capacity_value for each capacity per user. I want to generate a queryset of Question instances, and filter it to just leave Question instances where for each capacity the associated question_capacity_value is less than the user_capacity_value in every capacity instance associated with the the question. In other words each question will have 5 question_capacity values, and the user will have 5 user_capacity values, and I want to exclude questions where for each capacity, the question_capacity_values is less than the user_capacity_value. class Question(models.Model): question = models.CharField(max_length=200, blank=True) class Capacity(models.Model): capacity_name = models.CharField(max_length=100) def __str__(self): return str(self.capacity_name) class UserCapacityValue(models.Model): user = models.ForeignKey(User, on_delete=models.CASCADE) capacity = models.OneToOneField(Capacity, on_delete=models.CASCADE) user_capacity_value = models.DecimalField(max_digits=5, decimal_places=3, default=0.000) def __str__(self): return str(self.user) + str(self.capacity.capacity_name) + str(self.user_capacity_value) class QuestionCapacityValue(models.Model): question = models.ForeignKey(Question, on_delete=models.CASCADE) capacity = models.OneToOneField(Capacity, on_delete=models.CASCADE) applicable = models.BooleanField(default=False) question_capacity_value = models.DecimalField(max_digits=5, decimal_places=3, default=0.000) def __str__(self): return str(self.question) + str(self.capacity.capacity_name) + str(self.question_capacity_value) Only initial thought (which I'm pretty sure is way off) is: refined_quetion_qset = targetqset.objects.filter(questioncapacityvalue_set__question_capacity_value__lte=F('???')) No idea what to put in the F function, and imagine this only works … -
Can't keep field empty even if it is set to null and blank
Model: class Member( models.Model ): model_categories = models.CharField( max_length = 255, null = True, blank = True ) Form: class MemberForm( forms.ModelForm ): MODEL_CATEGORIES = ( ('advisor', 'advisor'), ('member', 'member'), ('admin', 'admin'), ) model_categories = forms.MultipleChoiceField( widget = forms.CheckboxSelectMultiple, choices = MODEL_CATEGORIES ) class Meta: model = Member fields = [ 'model_categories' ] Still when I submit the form, it requires the field model_categories that can't have no box selected. What is the reason ? -
Related Field got invalid lookup: approval
I try to apply a condition on catcher table, but only approval invalid filed class Catcher(models.Model): catcher_id = models.AutoField(primary_key = True) catcher_fname = models.CharField(max_length = 128, blank = True) catcher_lname = models.CharField(max_length = 128, blank = True) approval = models.CharField(max_length = 2, blank = True) catcher_parent = models.IntegerField() class Meta: db_table = 'catcher' managed = False class Login(models.Model): login_id = models.AutoField(primary_key = True) user_name = models.CharField(max_length = 150) user = models.ForeignKey(Catcher, related_name = 'login_catcher') last_login = models.DateTimeField() role_id = models.IntegerField() confirmed = models.CharField(max_length = 1) class Meta: db_table = 'jobma_login' managed = False query login = login.filter(user__approval='test') # not working? it show me an error invaild lookup field, When i try to fetch with catcher_fname it is working login = login.filter(user__catcher_fname='test') # working :) where i am wrong Please let me know approval is a file in catcher table -
Django mocking request within signal
I have been looking into the requests_mock library in order to check the response. I am just wondering how I can actually 'hijack' the actual request to do a mocked one. In my test_model.py I will create a new SomeModel. When the SomeModel.objects.create() is done, the signal will be triggered. The signal is as follow: @receiver(post_save, sender=SomeModel, dispatch_uid="update_model") def update_model(sender, instance, created, **kwargs): instance.update_status() From the update_status function it goes trough one other function where it sets the payload and the URL, and then it actually does the request in the send_model function as follows: def send_model(url, payload): .... request.post(url, data=json.dumps(payload), headers=headers) My question is, where do I mock the request? -
Can't call randint in redirected script in my python virtual environment shell
I'm trying to create some fixture data for my django app. Whereas I used to just echo json heredocs, it's now long and complex enough that I'm now creating the actual model instances in memory, and then serializing to json. I'm hence trying to run the script (with a modified version of manage.py that has local settings) like so: manage.local.py shell < fixture_data.py > data.json In my fixture_data.py, the models go well enough until my first call to random.randint: from random import randint from myapp.models import Product ... p = Product( price=randint(20,40), ... ) The trace looks like this: Traceback (most recent call last): File "./manage.local.py", line 10, in <module> execute_from_command_line(sys.argv) File "/srv/lib/python3.5/site-packages/django/core/management/__init__.py", line 363, in execute_from_command_line utility.execute() File "/srv/lib/python3.5/site-packages/django/core/management/__init__.py", line 355, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/srv/lib/python3.5/site-packages/django/core/management/base.py", line 283, in run_from_argv self.execute(*args, **cmd_options) File "/srv/lib/python3.5/site-packages/django/core/management/base.py", line 330, in execute output = self.handle(*args, **options) File "/srv/lib/python3.5/site-packages/django/core/management/commands/shell.py", line 101, in handle exec(sys.stdin.read()) File "<string>", line 132, in <module> File "<string>", line 132, in <listcomp> File "<string>", line 132, in <listcomp> NameError: name 'randint' is not defined As you can see, this is run in my project's venv, installed in /srv. The necessary import is right at the top of my script, so … -
PyInstaller executable does not recognize Django apps.py
I have a Django app which I want to make into an executable. I used PyInstaller but I got an error - `ImportError: No module named 'mybigdataapp.apps'` So I followed this question and added the hook file as - `hiddenimports = collect_submodules('mybigdataapp.apps')` But it's still giving the same error. It doesn't recognize the apps file inside mybigdataapp. -
Fetching values preceding a given index value in json field
I have jsonfield [{"0":"Z","1":"Y","2":"X","3":"W","4":"V"}]. I want to fetch all the values preceding "Y" i.e. X,W,V.. i = 0 name = None obj= Model.objects.get(Name=Request['Name']) for key in obj: currentPosition = key[str(i)] i = i +1 if currentPosition == request['Position']: continue else: sendData.append({"Position": currentPosition}) When I am adding Y in request it is fetching details for Z also. Thanks in advance. -
Django signals not receiving
i am using django default receiver to handle signal. but its not working. i have modified User model in APP1 whenver new User object create a receiver in APP2 signal.py is listen to it, but its not working. app1/model.py class User(BaseModel, AbstractBaseUser, PermissionsMixin): email = models.EmailField( verbose_name='email address', max_length=255, unique=True, ) username = models.CharField(max_length=40, unique=True) first_name = models.CharField(max_length=30, blank=True, null=True) last_name = models.CharField(max_length=30, blank=True, null=True) is_active = models.BooleanField(default=True) is_admin = models.BooleanField(default=False) is_staff = models.BooleanField(default=False) is_email_verified = models.BooleanField(default=False) is_paid = models.IntegerField(default=0) access_token = models.CharField(max_length=128, blank=True) objects = UserManager() USERNAME_FIELD = 'email' REQUIRED_FIELDS = ['username'] class Meta: db_table = 'users' def __str__(self): return self.email app2/signals.py from django.conf import settings from django.db.models.signals import post_save from django.dispatch import receiver from accounts.models import User @receiver(post_save, sender=User)#settings.AUTH_USER_MODEL) def create_auth_token(sender, instance=None, created=False, **kwargs): print ("token generated") if created: print("data at signal ****", instance.email, instance) -
msgpack error when using rabbitmq and django channels
I am a bit new to django channels and message queues in general. My requirement is as follows: Web page makes a websocket connection to django server django server needs to subscribe to channels (based on username) on a rabbitMQ server When a message arrives on subscribed channels, route it to the appropriate user web socket, and the web page updates UI I got a basic websocket sample app working as per http://channels.readthedocs.io/en/stable/ Now I'm trying to handle messages that come from a rabbitmq channel I have the following routing: routes = [ route("websocket.receive", ws_message), route("websocket.connect", ws_accept), route("hello", hello_message), ] and the following consumers: import sys import logging logger = logging.getLogger('test') def ws_message(message): logger.debug('---------- Got message on web socket --------------------') message.reply_channel.send({"text": message.content['text']}) def ws_accept(message): logger.debug('--------- Accepted Web Socket connection ----------------') message.reply_channel.send({"accept": True}) def hello_message(): logger.debug('---------- Got message on MQ --------------------') I've written a small external script to send messages into the "hello" channel: #!/usr/bin/env python import pika import sys connection = pika.BlockingConnection(pika.ConnectionParameters('localhost')) channel = connection.channel() channel.queue_declare(queue='hello', arguments={'x-expires': 120000, 'x-dead-letter-exchange': 'dead-letters'}) print 'Sending: ' + sys.argv[1]; channel.basic_publish(exchange='', routing_key='hello', body=sys.argv[1]) connection.close() When I run this script and send a message, I get the following error on the django runserver output: python2 manage.py … -
External JS in Django apps best practice
I have two pages that extends a base template. Each page has their own external js which i need to load. For the time being, i have put both of them before closing body tag in the base which means that both JS are loaded on both pages. How is it possible to load specific JS for specific page? -
__init__() got an unexpected keyword argument 'min_length'
I get the bellow error: ... File "/Library/Python/2.7/site-packages/Django-1.11.2-py2.7.egg/django/utils/autoreload.py", line 227, in wrapper fn(*args, **kwargs) File "/Library/Python/2.7/site-packages/Django-1.11.2-py2.7.egg/django/__init__.py", line 27, in setup apps.populate(settings.INSTALLED_APPS) File "/Library/Python/2.7/site-packages/Django-1.11.2-py2.7.egg/django/apps/registry.py", line 108, in populate app_config.import_models() File "/Library/Python/2.7/site-packages/Django-1.11.2-py2.7.egg/django/apps/config.py", line 202, in import_models self.models_module = import_module(models_module_name) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/importlib/__init__.py", line 37, in import_module __import__(name) File "/Users/luowensheng/Desktop/QIYUN/Project/officialWeb/frontend/models.py", line 93, in <module> class User(models.Model): File "/Users/luowensheng/Desktop/QIYUN/Project/officialWeb/frontend/models.py", line 97, in User phone = models.CharField(min_length=11, max_length=11) File "/Library/Python/2.7/site-packages/Django-1.11.2-py2.7.egg/django/db/models/fields/__init__.py", line 1061, in __init__ super(CharField, self).__init__(*args, **kwargs) TypeError: __init__() got an unexpected keyword argument 'min_length' My Model code is below: class User(models.Model): username = models.CharField(max_length=16) password = models.CharField(max_length=16) real_name = models.CharField(max_length=12) phone = models.CharField(min_length=11, max_length=11) # this is the line 97 email = models.EmailField() qq = models.CharField(max_length=10) address = models.CharField(max_length=64) id_card = models.CharField(min_length = 18, max_length=18) id_card_img_front = models.CharField(max_length=256) id_card_img_back = models.CharField(max_length=256) nickname = models.CharField(max_length=16) profile = models.CharField(max_length=256) Why I get that error? And by the way if there is a better way to constraint the phone length to 11? -
How to add html inside {{ }} in django template
I want to know how to add html inside {{ }}: {{ article.tags.all|join:", " }} This return tags separated by coma for example: sports, cricket, nature etc I want to do this: {{ <span class="label">article.tags.all|join:", "</span> }} I want to design each tag with adding a span class and remove coma Models.py: class Tag(models.Model): name = models.CharField(max_length=255) description = models.CharField(max_length=255, null=True, default='') class article(models.Model): title = models.CharField(max_length=250) disc = models.TextField(verbose_name="Discription") posted = models.DateTimeField(auto_now_add=True, editable=False) updated = models.DateTimeField(auto_now=True) tags = models.ManyToManyField(Tag) -
Object permission checkers Django
I have an app in which I have added the permissions.py file which contains object permission checker function permissions.py from rolepermissions.permissions import register_object_checker from etprojekt_core.roles import VodjaOddelka from .models import Vnos @register_object_checker() def urejanje_del_ure(role, user, vnos): print("YES") if vnos.status == Vnos.PROCESSED: print("Return false!") return False if vnos.user_id == user.id and vnos.is_editable: print("Returning true!") return True if role == VodjaOddelka: print("Vodja oddelka return true!!") return True if vnos.is_editable: print("Is editable return true!") return True return False and then in my template I have: {% can "urejanje_del_ure" vnos user=user as lahko_uredi_vnos %} {% if lahko_uredi_vnos %} <button class="btn btn-default ajax-modal" data-url='{% url "du:uredi_vnos" vnos.id %}'> <i class="fa fa-pencil" aria-hidden="true"> </i> </button> {% endif %} But it does not work. I tried to use print("YES") to test, if the function urejanje_del_ure(role,user,vnos) ever gets called, but it does not. But the button in the template is shown if the user is admin. Any help would be very appreciated -
Why does Localization not work in my Django project?
I'm working on a project that it's default language is not English. I have done the following settings: 1. I created a locale folder in root directory. 2. Then added the following code in settings.py: LOCALE_PATHS = (os.path.join(BASE_DIR, 'locale'),) 3. At the end I run this command in cmd: django-admin makemessages -l fa but the language files weren't created. Where have I gone wrong? -
How to successfully pass a Json to render and manipulate it in Django?
I am trying to return a Json response from a POST request but I am encountering various errors in the path. First, I have the following view class ChartData8(APIView): def tickets_per_day_results(request): if request.method == "POST": template_name = 'personal_website/tickets_per_day_results.html' year = request.POST.get('select_year', None) week = request.POST.get('select_week', None) ....do stuff... data = {"label_number_days": label_number_days, "days_of_data": count_of_days} return render(request,template_name,JsonResponse(data)) that calls the template tickets_per_day_results.html which contains an Ajax request: $.ajax({ method: "POST", url: endpoint, dataType: 'json', contentType: "application/json", headers: {"X-CSRFToken": $.cookie("csrftoken")}, success: function(data){ console.log(data) label_number_days = data.label_number_days days_of_data = data.days_of_data setChart() }, error: function(jqXHR,error_data, errorThrown){ console.log("error on data") console.log(error_data) console.log(JSON.stringify(jqXHR)) console.log("AJAX error: " + error_data + ' : ' + errorThrown) } but this combination throws me context must be a dict rather than JsonResponse error. I tried various alternatives: Alternative 1: Instead of JsonResponse I used Response like the following: class ChartData8(APIView): def tickets_per_day_results(request): if request.method == "POST": template_name = 'personal_website/tickets_per_day_results.html' year = request.POST.get('select_year', None) week = request.POST.get('select_week', None) ....do stuff... data = {"label_number_days": label_number_days, "days_of_data": count_of_days} return render(request,template_name,Response(data)) but this threw out the error context must be a dict rather than Response. Alternative 2: Instead of JsonResponse and Response I tried to convert the object to a dict like the following: … -
Django admin - model visible to superuser, not staff user
I am aware of syncdb and makemigrations but we are restricted to do that on production environment. we recently had couple of tables created on production.As expected, tables were not visible on admin for any user. Post that, we had below 2 queries executed manually on sql django_content_type INSERT INTO django_content_type(name, app_label, model) values ('linked_urls',"urls", 'linked_urls'); auth_permission INSERT INTO auth_permission (name, content_type_id, codename) values ('Can add linked_urls Table', (SELECT id FROM django_content_type where model='linked_urls' limit 1) ,'add_linked_urls'), ('Can change linked_urls Table', (SELECT id FROM django_content_type where model='linked_urls' limit 1) ,'change_linked_urls'), ('Can delete linked_urls Table', (SELECT id FROM django_content_type where model='linked_urls' limit 1) ,'delete_linked_urls'); Now, this model is visible under super-user and is able to grant access to staff users as well but staff users cant see it. Is there any table entry that needs to be entered in it? or is there any other way to do a solve this problem without syncdb, migrations? -
Adding chinese characters support to whole django project
I have whole django project in which I need to add support for chinese characters for the manual input. Is it possible to do it in settings.py for the whole project? -
Django Celery Beat not sending tasks
Triyng to figure uot why my scheduled tasks won't run. Celery is working fine. Celery and celery beat started via systemd Celery service [Unit] Description=Celery Service After=network.target [Service] Type=forking User=awert Group=awert WorkingDirectory=/home/awert/checker_f/ ExecStart=/bin/sh -c '/home/awert/checker_f/checker_e/bin/celery multi start w1 -A checker_p -l info --logfile=/home/awert/celery/sworker.log --pidfile=/home/awert/celery/worker.pid --time-limit=21600 -E -S django' ExecStop=/bin/sh -c '/home/awert/checker_f/checker_e/bin/celery multi stopwait w1 --pidfile=/home/awert/celery/worker.pid' ExecReload=/bin/sh -c '/home/awert/checker_f/checker_e/bin/celery multi restart w1 -A checker_p -l info --pidfile=/home/awert/celery/worker.pid --logfile=/home/awert/celery/sworker.log --time-limit=21600 -E -S django' [Install] WantedBy=multi-user.target Celerybeat service [Unit] Description=Celery beat PartOf=celery.service [Service] User=awert PermissionsStartOnly=true ExecStart=/bin/sh -c '/home/awert/checker_f/checker_e/bin/celery beat -A checker_p -l debug --pidfile=/home/awert/celery/beat.pid --logfile=/home/awert/celery/beat.log --workdir=/home/awert/checker_f/' Restart=on-failure [Install] WantedBy=multi-user.target As far as I can tell from logs celebeat acknowledges of scheduled tasks: [2017-08-24 12:31:42,242: INFO/MainProcess] beat: Starting... [2017-08-24 12:31:42,243: DEBUG/MainProcess] DatabaseScheduler: initial read [2017-08-24 12:31:42,243: INFO/MainProcess] Writing entries... [2017-08-24 12:31:42,272: DEBUG/MainProcess] DatabaseScheduler: Fetching database schedule [2017-08-24 12:31:42,286: DEBUG/MainProcess] Current schedule: <ModelEntry: Sanity sanity_check(*[], **{}) <crontab: */2 * * * * (m/h/d/dM/MY)>> <ModelEntry: celery.backend_cleanup celery.backend_cleanup(*[], **{}) <crontab: 0 4 * * * (m/h/d/dM/MY)>> [2017-08-24 12:31:42,326: DEBUG/MainProcess] beat: Ticking with max interval->5.00 seconds [2017-08-24 12:31:42,331: DEBUG/MainProcess] beat: Waking up in 5.00 seconds. [2017-08-24 12:31:47,337: DEBUG/MainProcess] beat: Synchronizing schedule... [2017-08-24 12:31:47,337: INFO/MainProcess] Writing entries... [2017-08-24 12:31:47,342: DEBUG/MainProcess] beat: Waking up in 5.00 seconds. After that only … -
Django's FilteredSelectMultiple widget only works when logged in
I have a ModelForm in which I use the FilteredSelectMultiple widget. It works perfectly fine when I'm logged in as the superuser I have created. However, when not logged in, I cannot see the widget in the form, I only see the list of all items (like a multiple select). So my question is : why is FilteredSelectMultiple working perfectly fine when logged in, but is not there when logged out ? I haven't set any permission or anything like that anywhere that I can think of. Here are parts of my code : forms.py from django.contrib.admin.widgets import FilteredSelectMultiple class MyModelForm(forms.ModelForm): my_field = forms.ModelMultipleChoiceField(queryset=Something.objects.all(), widget=FilteredSelectMultiple("Somethings", is_stacked=False), required=False) class Media: css = { 'all': (os.path.join(settings.BASE_DIR, '/static/admin/css/widgets.css'),), } js = ('/admin/jsi18n'), class Meta: model = MyModel fields = ('some_field', 'some_other_field') form.html {% extends base.html %} {% block head %} {% load staticfiles %} some stuff {% endblock head %} {% block content %} <script type="text/javascript" src="{% url 'jsi18n' %}" > </script> {{ form.media }} <form enctype="multipart/form-data" method="POST"> {% csrf_token %} {{ form.as_p }} <button type="submit" class="save btn btn-default">Submit</button> </form> {% endblock content %} urls.py url(r'^admin/jsi18n/$', 'django.views.i18n.javascript_catalog', name='jsi18n' ), Tell me if you need any other code. (I use Django 1.8 and Python … -
django push notification showing error in deployment
settings.py: PUSH_NOTIFICATIONS_SETTINGS = { "APNS_CERTIFICATE": os.path.join(BASE_DIR, 'app.pem'), "APNS_TOPIC": "app.Tamakoshi", "APNS_USE_SANDBOX":True, } from the admin panel i created a APNSDevice and entered the Registration ID as well with isActive checked. When I try to send the push notification selecting the device and clicking on 'Send test message', the error I get is Some messages could not be processed: 'DeviceTokenNotForTopic'