This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from tasks import full_export_task | |
def export_year_zip(user): | |
full_export_task.update_state(state="PROGRESS", meta={}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def expire_view_cache(view_name, args=[], namespace=None, key_prefix=None, method="GET"): | |
""" | |
This function allows you to invalidate any view-level cache. | |
view_name: view function you wish to invalidate or it's named url pattern | |
args: any arguments passed to the view function | |
namepace: optioal, if an application namespace is needed | |
key prefix: for the @cache_page decorator for the function (if any) | |
from: http://stackoverflow.com/questions/2268417/expire-a-view-cache-in-django | |
added: method to request to get the key generating properly |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import operator | |
from haystack.query import SearchQuerySet, SQ | |
query = 'lil way' | |
sqs = SearchQuerySet().filter(reduce(operator.__and__, [SQ(name=word.strip()) for word in query.split(' ')])) |