0

Where does the **kwargs argument comes from for the formfield_for_manytomany Django function?

class MyModelAdmin(admin.ModelAdmin):
def formfield_for_manytomany(self, db_field, request, **kwargs):
    if db_field.name == "cars":
        kwargs["queryset"] = Car.objects.filter(owner=request.user)
    return super(MyModelAdmin, self).formfield_for_manytomany(db_field,  
    request, **kwargs)

kwargs["queryset"]?

Does anybody know?

bootstrapman
  • 109
  • 10
  • not a duplicate the question is where does the **kwargs come from in that function, not what is a **kwrags. this needs good moderation, but judgement on making it duplicate. – weather api Aug 18 '17 at 01:10
  • **kwargs is a general argument representing all the keword arguments in a python function. For example in your case the function has a keyword argument as 'queryset'. – Sachiv Paruchuri Aug 18 '17 at 02:57

0 Answers0