{"action":"opened","issue":{"url":"https://api.github.com/repos/Suor/django-cacheops/issues/136","labels_url":"https://api.github.com/repos/Suor/django-cacheops/issues/136/labels{/name}","comments_url":"https://api.github.com/repos/Suor/django-cacheops/issues/136/comments","events_url":"https://api.github.com/repos/Suor/django-cacheops/issues/136/events","html_url":"https://github.com/Suor/django-cacheops/issues/136","id":60052247,"number":136,"title":"How to invalidate objects in queryset when using bulk update? ","user":{"login":"whitefoxx","id":272357,"avatar_url":"https://avatars.githubusercontent.com/u/272357?v=3","gravatar_id":"","url":"https://api.github.com/users/whitefoxx","html_url":"https://github.com/whitefoxx","followers_url":"https://api.github.com/users/whitefoxx/followers","following_url":"https://api.github.com/users/whitefoxx/following{/other_user}","gists_url":"https://api.github.com/users/whitefoxx/gists{/gist_id}","starred_url":"https://api.github.com/users/whitefoxx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/whitefoxx/subscriptions","organizations_url":"https://api.github.com/users/whitefoxx/orgs","repos_url":"https://api.github.com/users/whitefoxx/repos","events_url":"https://api.github.com/users/whitefoxx/events{/privacy}","received_events_url":"https://api.github.com/users/whitefoxx/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-03-06T02:58:56Z","updated_at":"2015-03-06T02:58:56Z","closed_at":null,"body":"No signals were send by django update method, right? so, how to invalidate the objects when using model.objects.filter(**kwargs).update(**kwargs)? \r\nI wrote this method to invalidate the objects return by filter method explicitly, will it work?\r\n\r\ndef nocache_update(qset, **kwargs):\r\n    from cacheops import invalidate_obj\r\n    for obj in qset.iterator():\r\n        try:\r\n            invalidate_obj(obj)\r\n        except:\r\n            pass\r\n    # update must behind invalidate obj\r\n    n = qset.update(**kwargs)\r\n    return n\r\n\r\nAnd call this method as follow:\r\nqset = model.objects.filter(**kwargs)\r\nnocache_update(qset, **kwargs)"}}