Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
Add an Image field and audio field on the front end. Using Django backend and reactjs front end
I need to add an image field and audio field in the front end.The Audio file should be accepted from a user in the front end. Then, machine learning file should be given the accepted file for processing and a text and image returned from it should be shown in the front end. How can I proceed? -
Django - Bad request syntax or unsupported method
I want to post data via an api onto my django app. This is how far I got: import pandas import requests excel_data_df = pandas.read_excel('workorders.xlsx') json_str = excel_data_df.to_json(orient='records', date_format='iso') API_ENDPOINT = "http://127.0.0.1:8000/api/create/" API_KEY = "dF8NbXRA.94Mj2xeXT3NZOtx1b575CvNvbs8JWo0D" source_code = json_str data = {'api_dev_key':API_KEY, 'api_option':'paste', 'api_paste_code':source_code, 'api_paste_format':'csv'} r = requests.post(url = API_ENDPOINT, data = data) apitest = r.text views.py class PostDataView(CreateAPIView): queryset = Workorder.objects.all() serializer_class = WorkorderSerializer serializers.py class WorkorderSerializer(serializers.ModelSerializer): class Meta: model = Workorder exclude = ['id'] I can enter the data manually using the post forms @ api/create but when I try to post it via the api, I get this error: <html> <head> <meta http-equiv="Content-Type" content="text/html;charset=utf-8"> <title>Error response</title> </head> <body> <h1>Error response</h1> <p>Error code: 400</p> <p>Message: Bad Request.</p> <p>Error code explanation: 400 - Bad request syntax or unsupported method.</p> </body> </html> This is the data I want to post: [{"id":null,"label":"Workorder 1","start":"2019-01-01T00:00:00.000Z","end":"2019-01-10T00:00:00.000Z","duration":9,"ctype":"bar","werk":"a","product":"a","train_number":535435.0,"latest_start_date":"2019-01-10T00:00:00.000Z","latest_start_timebucket":9,"is_start_date_fixed":false,"assigned_start_timebucket":535435.0,"assigned_start_date":"2019-01-10T00:00:00.000Z","costs_early_start":334,"costs_late_start":334,"resource_overall_demands":334,"resource_timeslots_demands":334}, {"id":null,"label":"Workorder 2","start":"2019-01-02T00:00:00.000Z","end":"2019-01-06T00:00:00.000Z","duration":4,"ctype":"bar","werk":"b","product":"b","train_number":234234.0,"latest_start_date":"2019-01-06T00:00:00.000Z","latest_start_timebucket":4,"is_start_date_fixed":false,"assigned_start_timebucket":234234.0,"assigned_start_date":"2019-01-06T00:00:00.000Z","costs_early_start":344,"costs_late_start":344,"resource_overall_demands":344,"resource_timeslots_demands":344}] I think its because of the T00:00:00.000Z, as Im using only Datefields. Is there any way to remove the time from the date? Thank you for any help -
Connect two Django apps with same initial workflow
I have a django project whereby the initial workings of two apps is essentially the same. Therefore, I have split the initial workings (a couple of forms) into its own init application. The idea is then to continue the workflow in the application in one of the two apps (app1 or app2). The idea is to connect the success_url of the last FormView in the init app to the index url of the app to use. I have thought about using sessions to store the url from app1 and redirect to the init app but this has its own implications due to the use of sessions, ie expiry etc. How else could the 'bridge' be performed? -
How to install python 'secrets' for Django on Ubuntu 16.04?
When trying to run python3 manage.py makemigrations on an Ubuntu 16.04 Digital Ocean droplet, I get this error: ImportError: No module named 'secrets' I'm not getting that error on localhost. When I looked up 'secrets' I looks like its a standard library in Python 3.6 and later releases. Is there something I could've done that would remove it, and how can I get it back? -
Django M2M field in a Model Form?
I have a many to many field ConnectedTo in my model and I want to create the object using a form. However when I list it as a field I just get a box with options to highlight and no way of selecting one or more. Ideally I'd love a multiple selection checkbox with a list of items in a scroll box. But I'd start with just having a selectable item. Here's my code so far: models.py: class Part(models.Model): PartID = models.AutoField(primary_key=True, unique=True) SiteID = models.ForeignKey('Site', on_delete=models.CASCADE, null=True) Comment = models.CharField(max_length=255, blank=True) Subtype = models.ForeignKey('Subtype', on_delete=models.CASCADE, null=True) Location = models.CharField(max_length=255, blank=True) ConnectedTo= models.ManyToManyField('self', blank=True, null=True) BatchNo = models.CharField(max_length=32, blank=False, null=True) SerialNo = models.CharField(max_length=32,blank=True) Manufacturer = models.CharField(max_length=32, blank=False, null=True) Length = models.CharField(max_length=6, blank=True, null=True) InspectionPeriod = models.IntegerField(blank=True, null=True) LastInspected = models.DateField(blank=True, null=True) InspectionDue = models.CharField(max_length=255, blank=True) @classmethod def create(cls, siteid, comment, subtype, location, batchno, serialno, manufacturer, length, inspectionperiod, lastinspected, inspectiondue): part = cls(SiteID = siteid, Comment = comment, Subtype = subtype, Location = location, BatchNo = batchno, SerialNo = serialno, Manufacturer = manufacturer, Length = length, InspectionPeriod = inspectionperiod, LastInspected = lastinspected, InspectionDue = inspectiondue) return part def __str__(self): return str(self.PartID) forms.py: class PartForm(forms.ModelForm): class Meta: model = Part fields = … -
Remove From cart Button not working in django?
When i try to remove item from my cart, remove from cart button accessing add-to-cart definition and when i click on remove button, it increase item in the cart means both add-to-cart and remove-from-cart perform same functionality. here, my views.py from django.shortcuts import render, get_object_or_404, redirect from products.models import Product from order.models import Order, OrderItem from django.utils import timezone def cart(request): return render(request,'order/cart.html') def add_to_cart(request,product_id): item = get_object_or_404(Product, pk=product_id) order_item, created = OrderItem.objects.get_or_create( item=item, user=request.user, ordered=False ) order_qs = Order.objects.filter(user = request.user, ordered = False) if order_qs.exists(): order = order_qs[0] #check if the order item is in the order if order.items.filter(item__id = item.id).exists(): order_item.quantity += 1 order_item.save() else: order.items.add(order_item) else: ordered_date = timezone.now() order = Order.objects.create(user = request.user, ordered_date = ordered_date) order.items.add(order_item) return redirect("/products/"+ str(product_id)) def remove_from_cart(request,product_id): item = get_object_or_404(Product, pk=product_id) order_qs = Order.objects.filter(user = request.user, ordered = False) if order_qs.exists(): order = order_qs[0] #check if the order item is in the order if order.items.filter(item__id = item.id).exists(): order_item= OrderItem.objects.filter( item=item, user=request.user, ordered=False )[0] order.items.clear(order_item) else: #add a message that user does not contain order item return redirect("/products/"+ str(product_id)) else: #add a message that user does not have an order return redirect("/products/"+ str(product_id)) return redirect("/products/"+ str(product_id)) urls.py from django.urls import path … -
Django query - How to get concurrent number of records in 5 minutes span of time?
I'm very new in Django and Sql. Sorry for this basic question. I have below model with Django + PostgreSql to record activity start/stop time; class Test(models.Model): class Meta: unique_together = ('test_session_id',) test_session_id = models.CharField(max_length=100, default=None, null=True) started_at = models.DateTimeField(auto_now_add=False, blank=True, null=True) finished_at = models.DateTimeField(auto_now_add=False, blank=True, null=True) I want to figure out how many tests is running in every 5 minutes span of time. If below four session exists, could you please guide me how to write Django queryset to achive below result? Sample Data ==== Test#1 11:33 ~ 12:17 Test#2 11:44 ~ 12:51 Test#3 12:08 ~ 12:19 Test#4 12:21 ~ 12:55 Expected query result === 11:30 => 0 11:35 => 1 11:40 => 1 11:45 => 2 ... 12:10 => 3 12:15 => 3 12:20 => 1 12:25 => 2 ... -
In my Django portal after login to the portal my request.user is always giving the value AnonymousUser
def login(request): if request.method == 'POST': form = AuthForm(request.POST) if form.is_valid(): userEmail = strip_html(form.cleaned_data['auth_email']) userPassword = strip_html(form.cleaned_data['auth_password']) try: person = Auth.objects.get(auth_email=userEmail, auth_password=userPassword) request.session['username'] = person.auth_name return redirect("/crudapplication/show") except: page = 'login.html' message = 'Username doesn\'t exist' Above is a small code snipet. This is my login functionality.So the value of the user email and password I'm providing is present in my database. So when I'm printing the line on console by print(request.user) it always gives the value Anonymoususer. The login function is the part of views.py of my login module -
Accessing dictionaries in Django templates
views.py: return render(request,'images.html',temp) Temp: {'cluster1': ['temp/vinoth/cluster1/demo-pic94.jpg', 'temp/vinoth/cluster1/id1.jpg'], 'cluster2': ['temp/vinoth/cluster2/demo-pic94.jpg', 'temp/vinoth/cluster2/demo-pic99.jpg', 'temp/vinoth/cluster2/id2.jpg', ['temp/vinoth/cluster2/demo-pic94.jpg', 'temp/vinoth/cluster2/demo-pic99.jpg', 'temp/vinoth/cluster2/id2.jpg']], 'cluster3': ['temp/vinoth/cluster3/demo-pic96.jpg', 'temp/vinoth/cluster3/id3.jpg'], 'cluster4': ['temp/vinoth/cluster4/demo-pic99.jpg', 'temp/vinoth/cluster4/id4.jpg'], 'cluster5': ['temp/vinoth/cluster5/demo-pic99.jpg', 'temp/vinoth/cluster5/id5.jpg'], 'cluster6': ['temp/vinoth/cluster6/id6.jpg', 'temp/vinoth/cluster6/triplet loss.jpg'], 'cluster7': ['temp/vinoth/cluster7/id7.jpg', 'temp/vinoth/cluster7/triplet loss.jpg'], 'cluster8': ['temp/vinoth/cluster8/id8.jpg', 'temp/vinoth/cluster8/triplet loss.jpg'], 'cluster9': ['temp/vinoth/cluster9/id9.jpg', 'temp/vinoth/cluster9/triplet loss.jpg']} System check identified no issues (0 silenced). The Values are array of images image.html: <div class="row mt-4"> <div class="col"> <ul class="list-group"> {% for key,value in temp.items %} <h1>{{ key }}</h1> {% endfor %} </ul> </div> </div> But nothing gets printed What am i doing wrong here? -
How can I properly catch errors of a Node js script in Python using Naked?
I am using Naked library of Python mentioned here for executing a Nodejs script which is also available here too. The point is, whenever I run my python script(exactly taken from the above link) through the terminal I can able to see the output of the nodejs script. I included this python script into my Django server and running it whenever an API call is made. I couldn't able to catch the errors properly when the validation of the page fails. It always returns 'success'. I feel this is because Nodejs is asynchronous. If it is so, how can I make the function 'amphtmlValidator.getInstance().then(function(validator)' mentioned in the npm website to synchronous? I am really very much new to Nodejs. Actually I just need to validate AMP pages from python script in Django and the only way I found is calling the node script through python. Everything is ok, but I couldn't catch the errors properly. Please help. -
In my Django portal after login to the portal my request.user is always giving the value AnonymousUser
def __call__(self, request): print(request.user) if not request.user.is_authenticated: ----------logic------- Above is a small code snipet. As request.user is giving Anonymoususer I'm not able to write my logic accordingly. Can somebody suggest? -
__init__() takes 1 positional argument but 2 were given login page
So I am new to python and I have been trying to make a very basic login page and whenever I look up this error all the solutions are very specific to the persons code. I am learning python for my comsci 3 independent study class and I have been making a very simple website so I don't really know how to fix this. I have been running into a lot of different errors making the front end and back end of a login/logout page. So here is my code thanks for the help:) urls.py from django.contrib import admin from django.urls import path from hello.views import myView from hello.views import myHome from hello.views import home from hello.views import index from hello.views import game from django.contrib.auth import views as auth_views from django.views.generic.base import TemplateView #from hello.views import index from django.conf.urls import url, include urlpatterns = [ #path('admin/', admin.site.urls), url(r'^admin/',admin.site.urls), url(r'^hello/',include('hello.urls')), path('sayHello/', myView), path('home/',home,name='Home'), path('game/',game), path('home/game.html',game), path('home/home.html',home), path('game/game.html',game), path('game/home.html',home), url(r'^login/$', auth_views.LoginView, {'template_name': 'login.html'}, name='login'), url(r'^logout/$', auth_views.LogoutView, {'template_name': 'logged_out.html'}, name='logout'), ] login.html {% extends 'base.html' %} {% block title %}Login{% endblock %} {% block content %} <h2>Login</h2> <form method="post"> {% csrf_token %} {{ form.as_p }} <button type="submit">Login</button> </form> {% endblock %} logged_out.html {% … -
Why must context be retrieved via the get_context_data method of the generic class DetailView?
I have a simple question which i will explain. I am reading about generic views using the docs on djangoproject.com, On this page they show the following example: from django.utils import timezone from django.views.generic.detail import DetailView from articles.models import Article class ArticleDetailView(DetailView): model = Article def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) context['now'] = timezone.now() return context My question is: Why would context need to be initialized by calling the get_context_data method from super() when ArticleDetailView is already inheriting from DetailView ? Can't you already access the context through the get_context_data of the subclass? Like this.get_context_data(**kwargs)? I'm confused! -
How to set `lookup_field` correctly for `HyperlinkedModelSerializer` in Django Rest Framework?
I need to change default HyperlinkedModelSerializer urls. According to documentation, I have to either define url field manually like this: serializers.py class StockSerializer(serializers.HyperlinkedModelSerializer): url = serializers.HyperlinkedIdentityField(view_name='stock-detail', lookup_field='unique_id') class Meta: model = Stock fields = ['id', 'url', 'symbol', 'unique_id', 'other_details'] Or use extra_kwargs like this: serializers.py class StockSerializer(serializers.HyperlinkedModelSerializer): class Meta: model = Stock fields = ['id', 'url', 'symbol', 'unique_id', 'other_details'] extra_kwargs = { 'url': {'view_name': 'stock-detail', 'lookup_field': 'unique_id'} } But non of them work for me. The error is: django.core.exceptions.ImproperlyConfigured: Could not resolve URL for hyperlinked relationship using view name "stock-detail". You may have failed to include the related model in your API, or incorrectly configured the `lookup_field` attribute on this field. This is my views.py: class StockViewSet(ModelViewSet): queryset = Stock.objects.all() serializer_class = StockSerializer And if I change lookup_field to pk (in serializers.py), it work without any errors but urls are not what I want. So how can I set lookup_field correctly? -
TypeError: zincrby() got multiple values for argument 'amount'
I wrote this function for recommendation some items and I use the redis database: def products_bought(self,products): product_ids=[p.id for p in products] for product_id in product_ids: for with_id in product_ids: if product_id!=with_id: r.zincrby(self.get_product_key(product_id), with_id, amount=1) but when I run this codes for use this function: from video.models import Product java1 = Product.objects.get(name='java1') java2 = Product.objects.get(name='java2') java3 = Product.objects.get(name='java3') net1 = Product.objects.get(name='net1') net2 = Product.objects.get(name='net2') net3 = Product.objects.get(name='net3') db1 = Product.objects.get(name='db1') db2 = Product.objects.get(name='db2') db3 = Product.objects.get(name='db3') from video.recommender import Recommender r = Recommender() r.products_bought([java1,java2]) r.products_bought([java1,java3]) r.products_bought([java2,java1,]) r.products_bought([net1,net2]) r.products_bought([net1,net2]) r.products_bought([net2,net3]) r.products_bought([db1,db2]) r.products_bought([db1,db3]) r.products_bought([db2,db1]) I got this error -
Django Rest - Use @action with custom decorator
I have a Rest API in Django and I have the following method in a class that extends ModelViewSet: @custom_decorator @action(methods=['get'], detail=False, url_name="byname", url_path="byname") def get_by_name(self, request): # get query params from get request username = request.query_params["username"] experiment = request.query_params["experiment"] If I remove the first annotator everything works fine. But when I am trying to call this function with both decorators, it does not even find the specific url path. Is it possible to use multiple decorators along with the @action decorator? -
Django unit test client login doesn't work. Why?
I've built an API using Django and Django Rest Framework. In my serializer I defined an organisation which can be posted, but needs to be stored to a different model. I defined my serializer as follows: class DeviceSerializer(serializers.HyperlinkedModelSerializer): geometrie = PointField(required=False) organisation = serializers.CharField(source='owner.organisation') owner = PersonSerializer(required=False) class Meta: model = Device fields = ( 'id', 'geometrie', 'longitude', 'latitude', 'organisation', 'owner', ) def get_longitude(self, obj): if obj.geometrie: return obj.geometrie.x def get_latitude(self, obj): if obj.geometrie: return obj.geometrie.y def create(self, validated_data): print("ORG:", validated_data.get('organisation'], "NO ORG FOUND")) # # Do some custom logic with the organisation here But when I post some json to it, which includes an organisation (I triple checked the input), it prints the line ORG: NO ORG FOUND. Why on earth doesn't it forward the organisation? -
pytest, how to keep database change between test
I'm using the following inside conftest.py @pytest.fixture(scope='session') def django_db_setup(): settings.DATABASES['default'] = { 'ENGINE': 'django.db.backends.postgresql_psycopg2', 'NAME': 'my_db', 'HOST': 'localhost', } it reads data from existing DB fine. Now I want to run two tests and want the change I made in preceding tests to persist until test2 (until the whole tests in the file is finished) def test_1(): user = User.objects.get(email='a@example.com') user.username = 'hello' user.save() def test_2(): user = User.objects.get(email='a@example.com') print(user.username) # expect 'hello' but it's not there's scope `session/module' and wonder what it means, session means the whole test run? -
How to ensure uniqueness in create_or_update without db level unique constraint in Django
I am using django 1.10 with MySQL 5.7. I have a table that has a unique_together constraint on multiple columns. But few of these columns are nullable. So the DB level uniqueness is not ensured for null entries in any of these fields. I am using create_or_update method to ensure the uniqueness of rows at the application level. But in race conditions, even this does not ensure uniqueness as the system is horizontally scaled and multiple processes are concurrently trying to call the create_or_update function. I think that this should be very a normal use-case for most of the high-scale services. How do we take care of this problem? From what I think, My options can be: save a string instead of keeping the entries nullable. (but it is a foreign-key field). save a formatted string based on fields of unique together column and check uniqueness on that. I feel that both these options would be unintuitive. What's be the commonly followed best practice here? -
Is there a way I can track only the first change to a field in django models?
I have a django model Posts class Post(models.Model, ModelMeta): ... publish = models.BooleanField(default=False) date_published = models.DateTimeField(default=timezone.now) ... I want to update the date_published field only once, for the first time when publish is set to True. I have gone through Field Tracker and pre_save but both of them update on every change. I probably need to use some sort of flag that is set when publish is set to True(for the first time). Since objects can be updated and queued again, publish is again set to False before approved by an admin. I may probably add flag to the model but I think there probably should be a better way to do this? -
Set the user's profile on creation
I have a user profile model (one to one with User) that looks like this: class Profile(models.Model): user = OneToOneField(User, on_delete=models.CASCADE) facebook_id = CharField(max_length=20, blank=True) google_id = CharField(max_length=20, blank=True) def __str__(self): return self.user.email # creates a corresponding profile for the newly created user @receiver(post_save, sender=User) def user_save(sender, instance, created, **kwargs): if created: Profile.objects.create(user=instance) and I would like to set the user's profile when I create a new user, so something like this: user = User( first_name=validated_data['first_name'], last_name=validated_data['last_name'], username=validated_data['username']) user.profile['facebook_id'] = social_id But this doesn't seem to work. What is the right way to do this? -
on making asynchronous django chat server i got error on running server
Unhandled exception in thread started by .wrapper at 0x000001B5D1AF5A60> Traceback (most recent call last): File "C:\Users\HP\AppData\Local\Programs\Python\Python35\lib\site-packages\django\utils\autoreload.py", line 225, in wrapper fn(*args, **kwargs) File "C:\Users\HP\AppData\Local\Programs\Python\Python35\lib\site-packages\django\core\management\commands\runserver.py", line 112, in inner_run autoreload.raise_last_exception() File "C:\Users\HP\AppData\Local\Programs\Python\Python35\lib\site-packages\django\utils\autoreload.py", line 248, in raise_last_exception raise _exception[1] File "C:\Users\HP\AppData\Local\Programs\Python\Python35\lib\site-packages\django\core\management__init__.py", line 327, in execute autoreload.check_errors(django.setup)() File "C:\Users\HP\AppData\Local\Programs\Python\Python35\lib\site-packages\django\utils\autoreload.py", line 225, in wrapper fn(*args, **kwargs) File "C:\Users\HP\AppData\Local\Programs\Python\Python35\lib\site-packages\django__init__.py", line 24, in setup apps.populate(settings.INSTALLED_APPS) File "C:\Users\HP\AppData\Local\Programs\Python\Python35\lib\site-packages\django\apps\registry.py", line 120, in populate app_config.ready() File "C:\Users\HP\AppData\Local\Programs\Python\Python35\lib\site-packages\channels\apps.py", line 20, in ready monkeypatch_django() File "C:\Users\HP\AppData\Local\Programs\Python\Python35\lib\site-packages\channels\hacks.py", line 10, in monkeypatch_django from .management.commands.runserver import Command as RunserverCommand File "C:\Users\HP\AppData\Local\Programs\Python\Python35\lib\site-packages\channels\management\commands\runserver.py", line 11, in from channels.routing import get_default_application File "C:\Users\HP\AppData\Local\Programs\Python\Python35\lib\site-packages\channels\routing.py", line 9, in from channels.http import AsgiHandler File "C:\Users\HP\AppData\Local\Programs\Python\Python35\lib\site-packages\channels\http.py", line 152, in class AsgiHandler(base.BaseHandler): File "C:\Users\HP\AppData\Local\Programs\Python\Python35\lib\site-packages\channels\http.py", line 214, in AsgiHandler @sync_to_async File "C:\Users\HP\AppData\Local\Programs\Python\Python35\lib\site-packages\asgiref\sync.py", line 202, in init self._is_coroutine = asyncio.coroutines._is_coroutine AttributeError: module 'asyncio.coroutines' has no attribute '_is_coroutine' -
Text choices attribute not recognised
I'm trying to create a model with django-multiselectfield, but when I run python manage.py runserver I get an error saying : AttributeError: module 'django.db.models' has no attribute 'TextChoices'. I successfully installed django-multiselectfield-0.1.10 and I can't figure out why I get this error. Thanks for any help! from django.db import models from multiselectfield import MultiSelectField class MovieGenre(models.TextChoices): Action = 'Action' Horror = 'Horror' Comedy = 'Comedy' genre = MultiSelectField( choices=MovieGenre.choices, max_choices=3, min_choices=1 ) def __str__(self): return self.question_text -
Running 2 service on 2 terminal using docker-compose
I am using window 10 with docker for desktop linux container. docker-compose.yml version: '2.1' networks: my: {} services: web: build: context: . container_name: myweb command: run python manage.py runserver_plus 0.0.0.0:8000 hostname: myweb depends_on: - service networks: my: aliases: - myweb service: build: context: . container_name: myservices command: run python manage.py runserver_plus 0.0.0.0:6001 hostname: myservice networks: my: aliases: - myservice Terminal 1 docker-compose run --service-ports web Terminal 2 docker-compose run --service-ports service Service getting timeout from web. but when I run just below common docker-compose run --service-port web Then working fine. But I need to put debugger(ipdb) in both services(web/service). Can Someone please hlep me out. -
Django pass extra data to ModelSerializer create from a ModelViewSet serializer.save()
I have this ModelViewSet def create(self, request, *args, **kwargs): data_to_save = request.data pharmacy = Pharmacy.objects.get(pk=request.data['pharmacy']) serializer = self.get_serializer(data=data_to_save) serializer.is_valid(raise_exception=True) serializer.save(myArg=pharmacy) headers = self.get_success_headers(serializer.data) return Response({'results': serializer.data}, status=status.HTTP_201_CREATED, headers=headers) The self.get_serializer(...) points to a class PharmacyUserSerializer(serializers.ModelSerializer): ... The PharmacyUserSerializer(...), I'm overriding the create(...) function like so def create(self, validated_data): request = self.context['request'] myArg = self.context['myArg'] pharmacy = request.user.pharmacy user = User.objects.create_user( **validated_data, user_type=c.PHARMACY, pharmacy=pharmacy ) return user ACcording to the DRF docs, this line looks right (passing arguments to the save method) serializer.save(myArg=pharmacy) Doing the above gives the error, TypeError: 'myArg' is an invalid keyword argument for this function So what's going on? What's the right way to pass data (i guess I'm missing something in the docs). And how do I intercept this extra data in the PharmacyUserSerializer