#35179: Admindocs treats model some model methods containing positional-only
arguments or keyword-only arguments as attributes
-----------------------------------+------------------------------------
Reporter: David Sanders | Owner: nobody
Type: Bug | Status: new
Component: contrib.admindocs | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------------+------------------------------------
Changes (by Natalia Bidart):
* version: 5.0 => dev
* stage: Unreviewed => Accepted
Comment:
After some investigation, this definitely seems like a valid issue. I did
some initial debugging, and both methods are being detected as fields
because the guard (in django/contrib/admindocs/views.py:ModelDetailView):
{{{#!python
elif (
method_has_no_args(func)
and not func_accepts_kwargs(func)
and not func_accepts_var_args(func)
):
fields.append(
{
"name": func_name,
"data_type": get_return_data_type(func_name),
"verbose": verbose or "",
}
)
}}}
is being evaluated with these values:
{{{
method_has_no_args(func)=True func_accepts_kwargs(func)=False
func_accepts_var_args(func)=False
}}}
The methods `func_accepts_kwargs` and `func_accepts_var_args` need to be
updated to understand the `*` and `/` syntax (new since Python 3.8).
David, would you like to prepare a patch? :-)
--
Ticket URL: <https://code.djangoproject.com/ticket/35179#comment:2>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/0107018d8f130ac3-883a3570-67d7-4d11-9eb0-ccb0b89181cb-000000%40eu-central-1.amazonses.com.