Hi,
I have a custom admin action that update the queryset of the selected items in the admin list:
# Django 3.2
def custom_action(self,description="Log it"):
def action_func(modeladmin, request, queryset):
try:
_task_date = datetime.datetime.strptime(request.POST['task_date'], "%d/%m/%Y")
queryset.update(task_date=_task_date)
messages.info(request, "All selected tasks logged successfully")
except:
emsg = sys.exc_info()[1]
messages.error(request,emsg)
action_func.short_description = description
return action_func
The issue is the validation that is implemented with the model “Clean” method is never invoked. Note that when saving/updating one instance of the model the validation is processed correctly.
Thanks in advance.