-
Notifications
You must be signed in to change notification settings - Fork 147
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds a get_last_invalidation template tag.
- Loading branch information
1 parent
1dfe456
commit f5bfeec
Showing
3 changed files
with
51 additions
and
0 deletions.
There are no files selected for viewing
Empty file.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
from django.apps import apps | ||
from django.template import Library | ||
|
||
from ..api import get_last_invalidation as get_last_invalidation_function | ||
|
||
|
||
register = Library() | ||
|
||
|
||
@register.assignment_tag | ||
def get_last_invalidation(*tables_or_model_lookups, **kwargs): | ||
tables_or_models = [] | ||
for table_or_model_lookup in tables_or_model_lookups: | ||
if '.' in table_or_model_lookup: | ||
tables_or_models.append(apps.get_model(table_or_model_lookup)) | ||
else: | ||
tables_or_models.append(table_or_model_lookup) | ||
return get_last_invalidation_function(*tables_or_models, **kwargs) |
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