typeddjango / django-stubs

PEP-484 stubs for Django
MIT License
1.58k stars 436 forks source link

Disallow mutually exclusive arguments `boolean` and `empty_value` in admin `display` decorator #2211

Open flaeppe opened 4 months ago

flaeppe commented 4 months ago

Trying to capture the following ValueError raised by Django: https://github.com/django/django/blob/2719a7f8c161233f45d34b624a9df9392c86cc1b/django/contrib/admin/decorators.py#L59-L63

e.g.

from django.contrib.admin.decorators import display

@display(boolean=True, empty_value="empty")
def f() -> None: ...

Raises

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "django/contrib/admin/decorators.py", line 60, in decorator
    raise ValueError(
ValueError: The boolean and empty_value arguments to the @display decorator are mutually exclusive.