Action that respects the filters in changeview_list

1
2
3
4
5
6
def publish(modeladmin,request,queryset):
    kwargs = {}
    for filter,arg in request.GET.items():
        kwargs.update({filter:arg})
    queryset = queryset.filter(**kwargs)
    queryset.update(published=True)

More like this

  1. Redirect with change list with filters intact with admin actions by AndrewIngram 4 years, 9 months ago
  2. View all log entries in the admin by jakub 2 years, 9 months ago
  3. A action decorator for URLs by Batiste 6 years ago
  4. Type checking templatetag filters by marcorogers 4 years, 1 month ago
  5. optparse dic action by bl4th3rsk1t3 4 years, 9 months ago

Comments

(Forgotten your password?)