* Attachment "admindocs.png" added.
Screenshot of admindocs treating some methods as attributes
--
Ticket URL: <https://code.djangoproject.com/ticket/35179>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* 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>