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
Twig.extend(function(Twig) { | |
// Add the {% spaceless %} token | |
Twig.logic.extend({ | |
type: 'spaceless', | |
regex: /^spaceless$/, | |
next: [ | |
'endspaceless' | |
], | |
open: true, |
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
/** | |
* twig.async.js | |
* | |
* An asynchronous implementation of twigjs that returns a Promise on instantiation if the template is asynchronous. | |
* Works just like twig(), but when instantiated, twigAsync returns a Promise. The twig template | |
* is passed as the only parameter when resolving the Deferred object. | |
* | |
* e.g. | |
* tpl = twigAsync({href:'/templates/profile/profile-welcomeNewDesign.twig'}); | |
* $.when(tpl).done(function(twigTemplate){ |
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
class BaseModelAdmin(Admin): | |
def queryset(self, request): | |
qs = super(BaseModelAdmin, self).queryset(request) | |
# Use the approximate queryset to avoid any non-performant | |
# 'COUNT(*)' queries | |
# Mixin the ApproximateCountQuerySetMixin to add the approximate count | |
# to any custom querysets | |
class AugmentedApproximateCountQueryset(ApproximateCountQuerySetMixin, qs.__class__): | |
pass |