'Custom method inside Django admin does not throw its error - Why?
I have an admin view in Django which should call and display the result of a custom method. I would expect the following: if that custom method raises an error, I'll see the error popping up in my Django admin view. However, the admin view displays a dash instead: "my_custom_method: -". There is no error in the logs.
I do not want to wrap every of my custom methods in a try/catch block. Is there any other way I can force Django to display that exception and quit showing that admin page?
class MyAdmin(admin.ModelAdmin):
readonly_fields=['my_custom_method']
def my_custom_method(_):
raise AttributeError
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
