#29711: One can use as actions functions generated only by the first call to another function -----------------------------------------+------------------------ Reporter: przemub | Owner: nobody Type: Uncategorized | Status: new Component: contrib.admin | Version: 2.1 Severity: Normal | Keywords: Triage Stage: Unreviewed | Has patch: 0 Needs documentation: 0 | Needs tests: 0 Patch needs improvement: 0 | Easy pickings: 0 UI/UX: 0 | -----------------------------------------+------------------------ It might be that I don't understand something, but I wrote this piece of code yesterday:
{{{ # admin.py def action(fun): def immediately(modeladmin, request, queryset): result = fun(queryset) if result: modeladmin.message_user(request, result) immediately.short_description = fun.short_description + " (now)" def queue(modeladmin, request, queryset): fun.delay(queryset) modeladmin.message_user(request, "Added to the queue.") queue.short_description = fun.short_description + " (add to the queue)" return immediately, queue class CompanyAdmin(admin.ModelAdmin): actions = (*action(telephone), *action(mail)) # (...) }}} And only functions generated by the first call to action() get added. (In the case above two actions from "telephone" only; when reversed, from "mail" only). I suspect that Django might detect them as duplicates. -- Ticket URL: <https://code.djangoproject.com/ticket/29711> Django <https://code.djangoproject.com/> The Web framework for perfectionists with deadlines. -- You received this message because you are subscribed to the Google Groups "Django updates" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-updates+unsubscr...@googlegroups.com. To post to this group, send email to django-updates@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/050.d40ed57a18c613381d5b4abb90d291d2%40djangoproject.com. For more options, visit https://groups.google.com/d/optout.