Skip to content

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

Closed
flaeppe wants to merge 1 commit intotypeddjango:masterfrom
flaeppe:fix/display-mutually-exclusive
Closed

Disallow mutually exclusive arguments boolean and empty_value in admin display decorator#2211
flaeppe wants to merge 1 commit intotypeddjango:masterfrom
flaeppe:fix/display-mutually-exclusive

Conversation

@flaeppe
Copy link
Copy Markdown
Member

@flaeppe flaeppe commented Jun 6, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant