text
stringlengths
0
1.05M
meta
dict
from django import template from django.template.loader import render_to_string from us_ignite.blog.models import BlogLink register = template.Library() class BlogLinkNode(template.Node): def __init__(self, template_name): self.template_name = template_name def render(self, context): temp...
{ "repo_name": "us-ignite/us_ignite", "path": "us_ignite/blog/templatetags/blog_tags.py", "copies": "1", "size": "1124", "license": "bsd-3-clause", "hash": -6097622877421464000, "line_mean": 26.4146341463, "line_max": 68, "alpha_frac": 0.6708185053, "autogenerated": false, "ratio": 3.8758620689655...
from django import template from django.template.loader import render_to_string from us_ignite.news.models import Article register = template.Library() class ArticleNode(template.Node): def __init__(self, template_name): self.template_name = template_name def render(self, context): templa...
{ "repo_name": "us-ignite/us_ignite", "path": "us_ignite/news/templatetags/news_tags.py", "copies": "1", "size": "1113", "license": "bsd-3-clause", "hash": 3863193471326621000, "line_mean": 26.1463414634, "line_max": 68, "alpha_frac": 0.6711590296, "autogenerated": false, "ratio": 4.00359712230215...
from django import template from django.template.loader import render_to_string from us_ignite.sections.models import Sponsor register = template.Library() class RenderingNode(template.Node): def __init__(self, template_name): self.template_name = template_name def render(self, context): ...
{ "repo_name": "us-ignite/us_ignite", "path": "us_ignite/sections/templatetags/sections_tags.py", "copies": "1", "size": "1107", "license": "bsd-3-clause", "hash": 2614301727759314000, "line_mean": 26.675, "line_max": 68, "alpha_frac": 0.6738934056, "autogenerated": false, "ratio": 3.8172413793103...
from django import template from django.template.loader import render_to_string from us_ignite.snippets.models import Snippet register = template.Library() class SnippetsNode(template.Node): def __init__(self, key, template_name): self.key = key self.template_name = template_name def rend...
{ "repo_name": "us-ignite/us_ignite", "path": "us_ignite/snippets/templatetags/snippets_tags.py", "copies": "1", "size": "1305", "license": "bsd-3-clause", "hash": 4265058700289560600, "line_mean": 26.7659574468, "line_max": 67, "alpha_frac": 0.6521072797, "autogenerated": false, "ratio": 3.849557...
from django import template from django.template.loader import render_to_string from wagtail.admin.userbar import ( AddPageItem, AdminItem, ApproveModerationEditPageItem, EditPageItem, ExplorePageItem, RejectModerationEditPageItem) from wagtail.core import hooks from wagtail.core.models import PAGE_TEMPLATE_VA...
{ "repo_name": "nimasmi/wagtail", "path": "wagtail/admin/templatetags/wagtailuserbar.py", "copies": "14", "size": "3179", "license": "bsd-3-clause", "hash": -2739832704397268500, "line_mean": 31.1111111111, "line_max": 117, "alpha_frac": 0.6568103177, "autogenerated": false, "ratio": 4.08087291399...
from django import template from django.template.loader import render_to_string from wagtail.wagtailcore.models import Page, PageRevision, PAGE_TEMPLATE_VAR # from django.contrib.auth.decorators import permission_required from wagtail.wagtailadmin.userbar import AdminItem, ExplorePageItem, EditPageItem, AddPageItem,...
{ "repo_name": "davecranwell/wagtail", "path": "wagtail/wagtailadmin/templatetags/wagtailuserbar.py", "copies": "1", "size": "2764", "license": "bsd-3-clause", "hash": 9166820869867738000, "line_mean": 31.5176470588, "line_max": 97, "alpha_frac": 0.6642547033, "autogenerated": false, "ratio": 4.03...
from django import template from django.template.loader import render_to_string from wagtail.wagtailcore.models import Page, PAGE_TEMPLATE_VAR register = template.Library() def get_page_instance(context): """ Given a template context, try and find a Page variable in the common places. Returns None if a...
{ "repo_name": "inonit/wagtail", "path": "wagtail/wagtailadmin/templatetags/wagtailuserbar.py", "copies": "8", "size": "1440", "license": "bsd-3-clause", "hash": 5538762145799729000, "line_mean": 27.2352941176, "line_max": 77, "alpha_frac": 0.6569444444, "autogenerated": false, "ratio": 4.18604651...
from django import template from django.template.loader import render_to_string from wagtail.wagtailcore.models import Page, PAGE_TEMPLATE_VAR register = template.Library() @register.simple_tag(takes_context=True) def wagtailuserbar(context): # Find request object request = context['request'] # Don't ...
{ "repo_name": "noodle-learns-programming/wagtail", "path": "wagtail/wagtailadmin/templatetags/wagtailuserbar.py", "copies": "10", "size": "1056", "license": "bsd-3-clause", "hash": 7420318340850487000, "line_mean": 26.7894736842, "line_max": 75, "alpha_frac": 0.6799242424, "autogenerated": false, ...
from django import template from django.template.loader import render_to_string import datetime from apps.feeds.models import Post, Feed register = template.Library() @register.tag() def feed_box(parser, token): bits = token.contents.split() if len(bits) > 3: raise template.TemplateSyntaxError("%s t...
{ "repo_name": "mdblv2/joatu-django", "path": "application/joatu/templatetags/joatu_tags.py", "copies": "1", "size": "1416", "license": "apache-2.0", "hash": -3641941646087858700, "line_mean": 35.3076923077, "line_max": 137, "alpha_frac": 0.5833333333, "autogenerated": false, "ratio": 3.7068062827...
from django import template from django.template.loader import render_to_string import django_comments as comments from django_comments.templatetags.comments import BaseCommentNode from threadedcomments.util import annotate_tree_properties, fill_tree as real_fill_tree register = template.Library() class BaseThreade...
{ "repo_name": "vlevit/vlevit.org", "path": "threadedcomments/templatetags/threadedcomments_tags.py", "copies": "1", "size": "13498", "license": "bsd-3-clause", "hash": 8286367510068576000, "line_mean": 34.0597402597, "line_max": 124, "alpha_frac": 0.5738627945, "autogenerated": false, "ratio": 4....
from django import template from django.template.loader import render_to_string from .. import services register = template.Library() @register.simple_tag def write_rule(rule): if rule['proto'] == services.BOTH: tcp_rule = dict(rule) tcp_rule['proto'] = services.TCP udp_rule = dict(rul...
{ "repo_name": "Kromey/piroute", "path": "iptables/templatetags/iptables_extras.py", "copies": "1", "size": "1197", "license": "mit", "hash": -4321922756890145300, "line_mean": 26.2045454545, "line_max": 72, "alpha_frac": 0.5455304929, "autogenerated": false, "ratio": 3.8863636363636362, "config...
from django import template from django.template.loader import render_to_string register = template.Library() class BaseStyleguideNode(template.Node): def __init__(self, styleguide, reference, template_name, nodelist): self.styleguide = styleguide self.reference = reference self.templat...
{ "repo_name": "seanbrant/pykss", "path": "pykss/contrib/django/templatetags/pykss.py", "copies": "1", "size": "3677", "license": "bsd-3-clause", "hash": -8490477606241946000, "line_mean": 29.6416666667, "line_max": 80, "alpha_frac": 0.6339407125, "autogenerated": false, "ratio": 4.275581395348837...
from django import template from django.template.loader import render_to_string register = template.Library() @register.tag(name="show_errors") def show_errors(parser, token): """Shows error messages for all fields in the given forms""" try: forms = token.split_contents()[1:] except: rai...
{ "repo_name": "MasonM/django-elect", "path": "django_elect/templatetags/show_errors.py", "copies": "1", "size": "1572", "license": "bsd-3-clause", "hash": 3801627906169303000, "line_mean": 33.9333333333, "line_max": 79, "alpha_frac": 0.5852417303, "autogenerated": false, "ratio": 4.10443864229765...
from django import template from django.template.loader import render_to_string register = template.Library() class GoodfieldNode(template.Node): def __init__(self, field, field_type, label=None, cls=''): self.field = template.Variable(field) self.field_type = field_type.strip('\'"') self....
{ "repo_name": "dwaiter/django-goodfields", "path": "goodfields/templatetags/goodfields.py", "copies": "1", "size": "1459", "license": "mit", "hash": 483900302417821950, "line_mean": 26.0185185185, "line_max": 76, "alpha_frac": 0.5784784099, "autogenerated": false, "ratio": 3.7700258397932815, "...
from django import template from django.template.loader import render_to_string register = template.Library() @register.simple_tag def render_template_for(obj, template=None, template_directory=None): """ Renders a template based on the `media_type` of the given object in the given template directory, fa...
{ "repo_name": "proevo/pythondotorg", "path": "community/templatetags/community.py", "copies": "4", "size": "1390", "license": "apache-2.0", "hash": -4258015277651414000, "line_mean": 27.9583333333, "line_max": 99, "alpha_frac": 0.6820143885, "autogenerated": false, "ratio": 4.112426035502959, "...
from django import template from django.template.loader import render_to_string register = template.Library() @register.simple_tag(takes_context=True) def breadcrumb(context, page=None, subpage=None, **kwargs): page = page or context.get('page') subpage = subpage or context.get('subpage') if not page: ...
{ "repo_name": "bruecksen/isimip", "path": "isi_mip/core/templatetags/breadcrumb.py", "copies": "1", "size": "1105", "license": "mit", "hash": -2945000856968914400, "line_mean": 24.6976744186, "line_max": 59, "alpha_frac": 0.5475113122, "autogenerated": false, "ratio": 3.8368055555555554, "confi...
from django import template from django.template.loader import render_to_string register = template.Library() @register.tag def article_content(parser, token): bits = token.split_contents() tagname = bits.pop(0) if len(bits) > 1: raise template.TemplateSyntaxError("%r tag requires a single argume...
{ "repo_name": "jbradberry/django-micro-press", "path": "micropress/templatetags/article_tags.py", "copies": "1", "size": "1218", "license": "mit", "hash": -9039231538923674000, "line_mean": 31.0526315789, "line_max": 88, "alpha_frac": 0.6297208539, "autogenerated": false, "ratio": 3.9163987138263...
from django import template from django.template.loader import render_to_string register = template.Library() @register.tag def render_category(parser, token): try: tag_name, category_dict, first, last = token.split_contents() return CategoryNode(category_dict, first, last) except ValueError:...
{ "repo_name": "praekelt/jmbo-downloads", "path": "downloads/templatetags/downloads_tags.py", "copies": "1", "size": "1397", "license": "bsd-3-clause", "hash": 2965138327653571000, "line_mean": 33.925, "line_max": 79, "alpha_frac": 0.6170365068, "autogenerated": false, "ratio": 4.311728395061729, ...
from django import template from django.template.loader import render_to_string register = template.Library() @register.tag def insert_activity(parser, token): try: tag_name, activity = token.split_contents() except ValueError: raise template.TemplateSyntaxError("%r tag requires exactly one ar...
{ "repo_name": "theworldbright/mainsite", "path": "aspc/activityfeed/templatetags/activityfeed.py", "copies": "1", "size": "2044", "license": "mit", "hash": -7334944810402975000, "line_mean": 37.5849056604, "line_max": 119, "alpha_frac": 0.6325831703, "autogenerated": false, "ratio": 3.65, "conf...
from django import template from django.template.loader import render_to_string, TemplateDoesNotExist from importlib import import_module register = template.Library() from django.conf import settings CUSTOM_FIELD_RENDERER = getattr(settings, 'DAB_FIELD_RENDERER', False) @register.simple_tag(takes_context=True) def...
{ "repo_name": "Corner1024/django-admin-bootstrapped", "path": "django_admin_bootstrapped/templatetags/bootstrapped_goodies_tags.py", "copies": "1", "size": "3622", "license": "apache-2.0", "hash": 1978424606919606800, "line_mean": 31.0530973451, "line_max": 143, "alpha_frac": 0.6637217007, "autogen...
from django import template from django.template.loader import render_to_string, TemplateDoesNotExist register = template.Library() @register.simple_tag(takes_context=True) def render_with_template_if_exist(context, template, fallback): text = fallback try: text = render_to_string(template, context) ...
{ "repo_name": "NoodleEducation/django-admin-bootstrapped", "path": "django_admin_bootstrapped/templatetags/bootstrapped_goodies_tags.py", "copies": "2", "size": "1688", "license": "apache-2.0", "hash": -5044196942674703000, "line_mean": 31.4615384615, "line_max": 143, "alpha_frac": 0.6753554502, "a...
from django import template from django.template.loader import render_to_string, TemplateDoesNotExist try: from django.utils.importlib import import_module except ImportError: from importlib import import_module register = template.Library() from django.conf import settings CUSTOM_FIELD_RENDERER = getattr(set...
{ "repo_name": "avara1986/django-admin-bootstrapped", "path": "django_admin_bootstrapped/templatetags/bootstrapped_goodies_tags.py", "copies": "1", "size": "3703", "license": "apache-2.0", "hash": 7162752883142939000, "line_mean": 31.2, "line_max": 143, "alpha_frac": 0.6659465298, "autogenerated": f...
from django import template from django.template.loader import select_template register = template.Library() @register.simple_tag(takes_context=True) def render_product(context, product): """ Render a product snippet as you would see in a browsing display. This templatetag looks for different templates ...
{ "repo_name": "sonofatailor/django-oscar", "path": "src/oscar/templatetags/product_tags.py", "copies": "5", "size": "1032", "license": "bsd-3-clause", "hash": 7452227010318597000, "line_mean": 33.4, "line_max": 78, "alpha_frac": 0.6889534884, "autogenerated": false, "ratio": 4.336134453781512, ...
from django import template from django.template.loaders.app_directories import load_template_source register = template.Library() def do_jquery_template(parser, token): """ Dump the template in, wrapped in script tags for jQuery.tmpl """ bits = token.split_contents() if len(bits) < 2: ...
{ "repo_name": "rodxavier/Django-Twitter", "path": "tweets/templatetags/jquery_template.py", "copies": "2", "size": "1135", "license": "mit", "hash": 1921474509995541000, "line_mean": 31.4285714286, "line_max": 130, "alpha_frac": 0.613215859, "autogenerated": false, "ratio": 3.6378205128205128, ...
from django import template from django.template.loaders.app_directories import load_template_source register = template.Library() """ jQuery templates use constructs like: {{if condition}} print something{{/if}} This, of course, completely screws up Django templates, because Django thinks {{ and }} mean some...
{ "repo_name": "colinsullivan/bingo-board", "path": "bingo_board/bingo/templatetags/verbatim.py", "copies": "1", "size": "1212", "license": "mit", "hash": 680743763664839800, "line_mean": 25.9333333333, "line_max": 72, "alpha_frac": 0.6369636964, "autogenerated": false, "ratio": 3.986842105263158,...
from django import template from django.template.loader_tags import do_include import re register = template.Library() class JsTemplateBaseNode(template.Node): LEFT_PATTERN = re.compile(r'{!') RIGHT_PATTERN = re.compile(r'!}') LEFT_TARGET = '{{' RIGHT_TARGET = '}}' def __init__(self, inner_nod...
{ "repo_name": "haystack/eyebrowse-server", "path": "common/templatetags/jstemplate.py", "copies": "1", "size": "2818", "license": "mit", "hash": -2665876227511228400, "line_mean": 25.8380952381, "line_max": 71, "alpha_frac": 0.626330731, "autogenerated": false, "ratio": 4.150220913107511, "conf...
from django import template from django.template.loader_tags import ExtendsNode register = template.Library() class IncludeExtendNode(template.Node): """ The node that implements include_extend. Note that we can't inherit from ExtendsNode as only one ExtendsNode is allowed in a template, although the implem...
{ "repo_name": "AloneRoad/Inforlearn", "path": "common/templatetags/base.py", "copies": "1", "size": "2865", "license": "apache-2.0", "hash": 4533747245360041500, "line_mean": 33.9390243902, "line_max": 82, "alpha_frac": 0.6890052356, "autogenerated": false, "ratio": 3.6357868020304567, "config_...
from django import template from django.templatetags import static from django.utils.safestring import mark_safe from markdown import markdown from bleach.sanitizer import Cleaner register = template.Library() exts = ['markdown.extensions.nl2br', 'pymdownx.caret', 'pymdownx.tilde', 'sane_lists'] safe_exts = ['pymdownx...
{ "repo_name": "ashbc/tgrsite", "path": "templatetags/templatetags/markdown_tags.py", "copies": "1", "size": "2022", "license": "isc", "hash": -1655524362134207500, "line_mean": 34.4736842105, "line_max": 113, "alpha_frac": 0.6364985163, "autogenerated": false, "ratio": 3.2044374009508716, "conf...
from django import template from django.templatetags.static import static from django.contrib.staticfiles.finders import find from dashing.settings import dashing_settings import json import urllib2 register = template.Library() _resource = None def remote_path(name): global _resource if not _resource: ...
{ "repo_name": "torstenfeld/django-dashing", "path": "dashing/templatetags/dashing_resources.py", "copies": "1", "size": "1751", "license": "bsd-3-clause", "hash": -87734215028803340, "line_mean": 25.9384615385, "line_max": 80, "alpha_frac": 0.6259280411, "autogenerated": false, "ratio": 4.1492890...
from django import template from django.templatetags.static import static from django.utils.safestring import mark_safe register = template.Library() @register.simple_tag(takes_context=True) def render_meta(context, title=""): request = context.get("request") page = context.get("current_page") cms_page_t...
{ "repo_name": "EuroPython/epcon", "path": "p3/templatetags/meta.py", "copies": "1", "size": "1630", "license": "bsd-2-clause", "hash": 5804443794238392000, "line_mean": 32.9583333333, "line_max": 78, "alpha_frac": 0.6564417178, "autogenerated": false, "ratio": 3.6547085201793723, "config_test":...
from django import template from django.templatetags.static import StaticNode from django.contrib.staticfiles.storage import staticfiles_storage from django.conf import settings register = template.Library() def static(path): return staticfiles_storage.url(path) class StaticFilesNode(StaticNode): @classme...
{ "repo_name": "labcodes/django-static-chooser", "path": "django_static_chooser/templatetags/staticfileschooser.py", "copies": "1", "size": "1502", "license": "mit", "hash": 7908651961276650000, "line_mean": 23.6229508197, "line_max": 76, "alpha_frac": 0.6025299601, "autogenerated": false, "ratio"...
from django import template from django.templatetags.static import StaticNode from django.contrib.staticfiles.storage import staticfiles_storage from ..ui.skins import get_skin_relative_path register = template.Library() #============================================================================== def static(path...
{ "repo_name": "kunitoki/nublas", "path": "nublas/templatetags/nublas_static.py", "copies": "1", "size": "1032", "license": "mit", "hash": -6730715673508467000, "line_mean": 25.4615384615, "line_max": 79, "alpha_frac": 0.6346899225, "autogenerated": false, "ratio": 3.9692307692307693, "config_te...
from django import template from django.test import LiveServerTestCase from .. import data from ... import models from selenium.webdriver.firefox import webdriver class PaymentInitTester(object): @classmethod def setUpClass(cls): cls.selenium = webdriver.WebDriver() super(PaymentInitTester,...
{ "repo_name": "zehome/django-payzen", "path": "django_payzen/tests/payzen_init/tests.py", "copies": "1", "size": "2282", "license": "mit", "hash": 8364055730445590000, "line_mean": 30.6944444444, "line_max": 78, "alpha_frac": 0.6367221735, "autogenerated": false, "ratio": 3.9825479930191974, "c...
from django import template from django.test import TestCase from django.contrib.auth.models import User from django.contrib.gis.geos import Point, LineString from geotagging.models import Geotag, HAS_GEOGRAPHY class TagTestCase(TestCase): """Helper class with some tag helper functions""" def installTagL...
{ "repo_name": "lincolnloop/django-geotagging", "path": "geotagging/tests/tag_tests.py", "copies": "1", "size": "4527", "license": "bsd-3-clause", "hash": 5848587023385333000, "line_mean": 43.3823529412, "line_max": 132, "alpha_frac": 0.5992931301, "autogenerated": false, "ratio": 3.82994923857868...
from django import template from django.test import TestCase from django.core.cache import cache from django import db from .models import TextBlock from .settings import CACHE_PREFIX class BasicTextBlockTests(TestCase): def setUp(self): self.testblock = TextBlock.objects.create( slug='block...
{ "repo_name": "waustin/django-text-blocks", "path": "text_blocks/tests.py", "copies": "1", "size": "2652", "license": "bsd-3-clause", "hash": 6126767764676742000, "line_mean": 34.8378378378, "line_max": 123, "alpha_frac": 0.6123680241, "autogenerated": false, "ratio": 4.2028526148969885, "confi...
from django import template from django.urls.exceptions import NoReverseMatch from django.urls import reverse from django.utils.six.moves.urllib.parse import urlsplit, urlunsplit from django.utils.translation import override from ..translation import get_translation, get_translated_field register = template.Library(...
{ "repo_name": "sha-red/django-shared-utils", "path": "shared/utils/templatetags/translation_tags.py", "copies": "1", "size": "2682", "license": "mit", "hash": -8182676839294318000, "line_mean": 27.5319148936, "line_max": 107, "alpha_frac": 0.687546607, "autogenerated": false, "ratio": 3.842406876...
from django import template from django.urls import resolve from django_bookmark.models import Bookmark from ..models import Content, UTopic from ..views.utils import model_filter from ...threaded_comment.models import ThreadedComments register = template.Library() @register.filter def url_resolve(request, arg): ...
{ "repo_name": "hakancelik96/coogger", "path": "core/cooggerapp/templatetags/coogger_tags.py", "copies": "1", "size": "1432", "license": "mit", "hash": 181849031060672740, "line_mean": 22.4754098361, "line_max": 82, "alpha_frac": 0.6990223464, "autogenerated": false, "ratio": 3.58, "config_test"...
from django import template from django.urls import resolve, reverse_lazy register = template.Library() @register.simple_tag(takes_context=True) def api_list_view(context, model, parent_obj=None): if parent_obj: parent_model = parent_obj.__class__.__name__.lower() app_name = resolve(context['re...
{ "repo_name": "ikcam/django-skeleton", "path": "core/templatetags/core_tags.py", "copies": "1", "size": "1218", "license": "bsd-3-clause", "hash": -116446352500432960, "line_mean": 26.6818181818, "line_max": 73, "alpha_frac": 0.6198686371, "autogenerated": false, "ratio": 3.759259259259259, "co...
from django import template from django.urls import resolve, reverse from django.conf import settings from django.utils.translation import ugettext_lazy as _ from django.utils import translation from blog.models import BlogPost import commonmark from taggit.models import Tag register = template.Library() @register.fi...
{ "repo_name": "censurfridns/blog.censurfridns.dk", "path": "src/blog/templatetags/blog_filters.py", "copies": "1", "size": "1964", "license": "bsd-3-clause", "hash": 2026691135772456400, "line_mean": 32.8620689655, "line_max": 79, "alpha_frac": 0.6451120163, "autogenerated": false, "ratio": 4.041...
from django import template from django.urls import reverse from cbv.models import Klass, ProjectVersion register = template.Library() @register.filter def namesake_methods(parent_klass, name): namesakes = [m for m in parent_klass.get_methods() if m.name == name] assert(namesakes) # Get the methods in or...
{ "repo_name": "refreshoxford/django-cbv-inspector", "path": "cbv/templatetags/cbv_tags.py", "copies": "1", "size": "1953", "license": "bsd-2-clause", "hash": -4782279519530438000, "line_mean": 32.6724137931, "line_max": 105, "alpha_frac": 0.6144393241, "autogenerated": false, "ratio": 4.060291060...
from django import template from django.urls import reverse from django.http import QueryDict from django.utils.html import format_html from ..apps import ditto_apps from .. import app_settings register = template.Library() @register.simple_tag def get_enabled_apps(): """ Returns a list of strings indicati...
{ "repo_name": "philgyford/django-ditto", "path": "ditto/core/templatetags/ditto_core.py", "copies": "1", "size": "5150", "license": "mit", "hash": 7326088662249960000, "line_mean": 28.9418604651, "line_max": 88, "alpha_frac": 0.5834951456, "autogenerated": false, "ratio": 3.6654804270462633, "c...
from django import template from django.urls import reverse from django.utils.html import escape from django.utils.safestring import mark_safe import markdown2 register = template.Library() @register.simple_tag(name='markdown') def markdown_format(text, safe=False): """Devuelve el texto markdown en HTML. E...
{ "repo_name": "snicoper/snicoper.com", "path": "src/apps/utils/templatetags/utils_tags.py", "copies": "1", "size": "4284", "license": "mit", "hash": 5984839916354312000, "line_mean": 29.7194244604, "line_max": 86, "alpha_frac": 0.62529274, "autogenerated": false, "ratio": 3.6033755274261603, "c...
from django import template from django.urls import reverse from django.utils.html import format_html from django.utils.safestring import mark_safe register = template.Library() def navbar_template( title, url, active=False, disabled=False, dropdown=False, deprecated=False ): """Compose Bootstrap v4 <li> ele...
{ "repo_name": "pbanaszkiewicz/amy", "path": "amy/workshops/templatetags/navigation.py", "copies": "1", "size": "3216", "license": "mit", "hash": 937350108160563200, "line_mean": 30.8415841584, "line_max": 83, "alpha_frac": 0.6495646766, "autogenerated": false, "ratio": 3.8653846153846154, "conf...
from django import template from django.urls import reverse from django.utils.safestring import mark_safe from django.utils import timezone, formats from datetime import timedelta from heltour import settings from heltour.tournament.models import Player, Registration, format_score from static_precompiler.utils import c...
{ "repo_name": "cyanfish/heltour", "path": "heltour/tournament/templatetags/tournament_extras.py", "copies": "1", "size": "5099", "license": "mit", "hash": 5342899757969081000, "line_mean": 23.9950980392, "line_max": 87, "alpha_frac": 0.6434595019, "autogenerated": false, "ratio": 3.53606102635228...
from django import template from django.urls import reverse from django.contrib.contenttypes.models import ContentType from dialogos.authorization import load_can_delete, load_can_edit from dialogos.forms import CommentForm from dialogos.models import Comment can_delete = load_can_delete() can_edit = load_can_edit(...
{ "repo_name": "GeoNode/geonode-dialogos", "path": "dialogos/templatetags/dialogos_tags.py", "copies": "1", "size": "3549", "license": "bsd-3-clause", "hash": -5717547324100780000, "line_mean": 23.475862069, "line_max": 76, "alpha_frac": 0.6266553959, "autogenerated": false, "ratio": 3.85342019543...
from django import template from django.urls import reverse from extras.models import ExportTemplate from utilities.utils import prepare_cloned_fields register = template.Library() def _get_viewname(instance, action): """ Return the appropriate viewname for adding, editing, or deleting an instance. """ ...
{ "repo_name": "digitalocean/netbox", "path": "netbox/utilities/templatetags/buttons.py", "copies": "1", "size": "2336", "license": "apache-2.0", "hash": -7795387055183809000, "line_mean": 20.6296296296, "line_max": 106, "alpha_frac": 0.6369863014, "autogenerated": false, "ratio": 3.64430577223088...
from django import template from django.urls import reverse from ..models import ThreadSubscription register = template.Library() class SubscriptionNode(template.Node): def __init__(self, user, varname, thread_list=None): self.user = template.Variable(user) if thread_list: self.thre...
{ "repo_name": "pinax/pinax-forums", "path": "pinax/forums/templatetags/pinax_forums_tags.py", "copies": "1", "size": "2367", "license": "mit", "hash": 3324796620779649500, "line_mean": 27.1785714286, "line_max": 74, "alpha_frac": 0.6472327841, "autogenerated": false, "ratio": 3.8866995073891624, ...
from django import template from django.urls import reverse register = template.Library() @register.inclusion_tag('menu.html', takes_context=True) def show_menu(context): menu_items = [ { 'path': '/2016/', 'icon': 'fa-home', 'title': 'Homepage', }, { ...
{ "repo_name": "pyvec/cz.pycon.org-2016", "path": "pyconcz_2016/common/templatetags/menu_tags.py", "copies": "1", "size": "2411", "license": "mit", "hash": 4065421643934982000, "line_mean": 28.7654320988, "line_max": 83, "alpha_frac": 0.3708004977, "autogenerated": false, "ratio": 4.48975791433892...
from django import template from django.urls import reverse register = template.Library() @register.inclusion_tag('qhonuskan/voting_js.html') def voting_script(): return {"vote_url": reverse('qhonuskan_vote')} @register.filter def is_up_voted_by(object, user): """ If user is up voted given object, it r...
{ "repo_name": "UPDDI/mps-database-server", "path": "qhonuskan_votes/templatetags/qhonuskan_votes.py", "copies": "1", "size": "1967", "license": "mit", "hash": -7310484733856415000, "line_mean": 27.5072463768, "line_max": 86, "alpha_frac": 0.6212506355, "autogenerated": false, "ratio": 3.576363636...
from django import template from django.urls import reverse register = template.Library() @register.inclusion_tag('links/user.html') def user_link(user, text=None, new_window=False): if text is None: text = user.get_full_name() if user.is_active else 'Deactivated user' return {'user': user, 'text': te...
{ "repo_name": "numbas/editor", "path": "accounts/templatetags/user_link.py", "copies": "1", "size": "2137", "license": "apache-2.0", "hash": -1332317418026040800, "line_mean": 32.390625, "line_max": 127, "alpha_frac": 0.5769770707, "autogenerated": false, "ratio": 3.8925318761384333, "config_te...
from django import template from django.urls import reverse, NoReverseMatch from django.template.defaultfilters import stringfilter from django.utils.safestring import mark_safe, SafeData from django.utils.html import escape from emoji import Emoji register = template.Library() @register.filter(name='emoji_replace...
{ "repo_name": "gaqzi/django-emoji", "path": "emoji/templatetags/emoji_tags.py", "copies": "1", "size": "1542", "license": "mit", "hash": -4045737054544674000, "line_mean": 29.2352941176, "line_max": 75, "alpha_frac": 0.7178988327, "autogenerated": false, "ratio": 3.8743718592964824, "config_tes...
from django import template from django.urls import reverse try: from urlparse import urlparse, urlunparse except ImportError: from urllib.parse import urlparse, urlunparse from django.contrib.auth.forms import AuthenticationForm from django.conf import settings from djangopress.core.format.library import Libra...
{ "repo_name": "codefisher/djangopress", "path": "djangopress/accounts/templatetags/accounts.py", "copies": "1", "size": "1564", "license": "mit", "hash": 3913377968143058000, "line_mean": 36.2619047619, "line_max": 135, "alpha_frac": 0.6847826087, "autogenerated": false, "ratio": 3.76867469879518...
from django import template from django.utils.datastructures import MultiValueDict from django.utils.html import conditional_escape as escape from django.utils.encoding import smart_unicode, smart_str from django.template.base import token_kwargs import urllib register = template.Library() class QueryStringNode(temp...
{ "repo_name": "team23/django_backend", "path": "django_backend/templatetags/django_backend_query_tags.py", "copies": "1", "size": "4480", "license": "bsd-3-clause", "hash": 6612924985773935000, "line_mean": 34.2755905512, "line_max": 150, "alpha_frac": 0.5680803571, "autogenerated": false, "ratio...
from django import template from django.utils.datastructures import SortedDict from django.conf import settings import nexus from nexus import conf from nexus.modules import NexusModule register = template.Library() def nexus_media_prefix(): if conf.USE_STATICFILES: return settings.STATIC_URL.rstrip('/'...
{ "repo_name": "blueprinthealth/nexus", "path": "nexus/templatetags/nexus_helpers.py", "copies": "1", "size": "1805", "license": "apache-2.0", "hash": -2696882633956598000, "line_mean": 26.3484848485, "line_max": 91, "alpha_frac": 0.6249307479, "autogenerated": false, "ratio": 4.011111111111111, ...
from django import template from django.utils.datastructures import SortedDict import nexus from nexus import conf from nexus.modules import NexusModule register = template.Library() def nexus_media_prefix(): return conf.MEDIA_PREFIX.rstrip('/') register.simple_tag(nexus_media_prefix) def nexus_version(): ...
{ "repo_name": "disqus/nexus", "path": "nexus/templatetags/nexus_helpers.py", "copies": "2", "size": "1696", "license": "apache-2.0", "hash": -6213400468595124000, "line_mean": 25.9206349206, "line_max": 91, "alpha_frac": 0.6196933962, "autogenerated": false, "ratio": 4, "config_test": false, ...
from django import template from django.utils.dateformat import Formatter register = template.Library() class DurationFormat(Formatter): def __init__(self, d): self.data = d def h(self): "Hours, no leading zero; i.e. '0', '1', '10' , '20'..." return int(self.data.seconds / 3600) ...
{ "repo_name": "soad241/django-audio-video", "path": "audio_video/templatetags/duration.py", "copies": "2", "size": "2108", "license": "bsd-3-clause", "hash": -8907183792204438000, "line_mean": 27.4864864865, "line_max": 79, "alpha_frac": 0.5479127135, "autogenerated": false, "ratio": 3.2380952380...
from django import template from django.utils.encoding import force_text from django.utils.translation import ugettext as _ from django.utils.functional import Promise from django.templatetags.cache import CacheNode from django.template.base import VariableDoesNotExist from django.core.cache import cache from django.co...
{ "repo_name": "praekelt/django-ultracache", "path": "ultracache/templatetags/ultracache_tags.py", "copies": "1", "size": "3828", "license": "bsd-3-clause", "hash": -4801760120755849000, "line_mean": 37.6666666667, "line_max": 99, "alpha_frac": 0.6405433647, "autogenerated": false, "ratio": 4.1927...
from django import template from django.utils.encoding import force_unicode from django.utils.safestring import mark_safe import markdown as markitdown register = template.Library() @register.filter(is_safe=True) def markdown(value, args=''): """ Runs Markdown over a given value, optionally using various ...
{ "repo_name": "Alir3z4/django-kewl", "path": "django_kewl/templatetags/markwhat.py", "copies": "1", "size": "1088", "license": "bsd-3-clause", "hash": 396275767633554800, "line_mean": 27.6315789474, "line_max": 68, "alpha_frac": 0.6755514706, "autogenerated": false, "ratio": 4.25, "config_test"...
from django import template from django.utils.encoding import force_unicode from django.utils.safestring import mark_safe register = template.Library() @register.filter('break') def break_(loop): '''Breaks from a loop. The 'break' filter is used within a loop and takes as input a loop variable, e.g. 'fo...
{ "repo_name": "TejasM/wisely", "path": "wisely_project/users/templatetags/breaktag.py", "copies": "1", "size": "9371", "license": "mit", "hash": 957110136760140900, "line_mean": 35.7529411765, "line_max": 99, "alpha_frac": 0.6007896703, "autogenerated": false, "ratio": 4.3667287977632805, "conf...
from django import template from django.utils.encoding import force_unicode import ttag from ttag.core import BaseTag, DeclarativeArgsMetaclass from ttag.tests.setup import models register = template.Library() class SelfRegisteringMetaclass(DeclarativeArgsMetaclass): def __new__(cls, name, bases, attrs): ...
{ "repo_name": "matuu/django-ttag", "path": "ttag/tests/setup/tags.py", "copies": "2", "size": "5587", "license": "bsd-3-clause", "hash": -5415267591749841000, "line_mean": 25.7320574163, "line_max": 79, "alpha_frac": 0.6094505101, "autogenerated": false, "ratio": 3.6853562005277043, "config_tes...
from django import template from django.utils.encoding import iri_to_uri from django.utils.six.moves.urllib.parse import urljoin register = template.Library() class PrefixNode(template.Node): def __repr__(self): return "<PrefixNode for %r>" % self.name def __init__(self, varname=None, name=None): ...
{ "repo_name": "bretlowery/snakr", "path": "lib/django/templatetags/static.py", "copies": "1", "size": "4048", "license": "bsd-3-clause", "hash": 5750413193939396000, "line_mean": 25.2857142857, "line_max": 116, "alpha_frac": 0.586215415, "autogenerated": false, "ratio": 4.16032887975334, "confi...
from django import template from django.utils.encoding import iri_to_uri register = template.Library() class PrefixNode(template.Node): def __repr__(self): return "<PrefixNode for %r>" % self.name def __init__(self, varname=None, name=None): if name is None: raise template.Templa...
{ "repo_name": "tjsavage/full_nonrel_starter", "path": "django/templatetags/static.py", "copies": "233", "size": "2149", "license": "bsd-3-clause", "hash": 1365877122325783800, "line_mean": 24.5833333333, "line_max": 66, "alpha_frac": 0.5798045603, "autogenerated": false, "ratio": 4.197265625, "...
from django import template from django.utils.encoding import iri_to_uri register = template.Library() class StaticFilesPrefixNode(template.Node): def __init__(self, varname=None): self.varname = varname def render(self, context): try: from django.conf import settings exc...
{ "repo_name": "tjsavage/tmrwmedia", "path": "django/contrib/staticfiles/templatetags/staticfiles.py", "copies": "16", "size": "1151", "license": "bsd-3-clause", "hash": 4716479111307964000, "line_mean": 25.7674418605, "line_max": 81, "alpha_frac": 0.6211989574, "autogenerated": false, "ratio": 4....
from django import template from django.utils.encoding import iri_to_uri register = template.Library() class PrefixNode(template.Node): def __repr__(self): return "<PrefixNode for %r>" % self.name def __init__(self, varname=None, name=None): if name is None: raise template.Templ...
{ "repo_name": "tusbar/django-staticfiles", "path": "staticfiles/templatetags/static.py", "copies": "3", "size": "2157", "license": "bsd-3-clause", "hash": 6037358253937622000, "line_mean": 23.7931034483, "line_max": 66, "alpha_frac": 0.5799721836, "autogenerated": false, "ratio": 4.20467836257309...
from django import template from django.utils.encoding import smart_str from django.core.urlresolvers import reverse, NoReverseMatch from django.db.models import get_model from django.db.models.query import QuerySet register = template.Library() class GroupURLNode(template.Node): def __init__(self, view_name, g...
{ "repo_name": "ericholscher/pinax", "path": "pinax/apps/groups/templatetags/group_tags.py", "copies": "1", "size": "3311", "license": "mit", "hash": 6417700725360784000, "line_mean": 29.9439252336, "line_max": 116, "alpha_frac": 0.545756569, "autogenerated": false, "ratio": 4.149122807017544, "...
from django import template from django.utils.encoding import smart_str register = template.Library() class NavNode(template.Node): def __init__(self, item=None, var_name=None): self.item = item self.var_name = var_name or 'nav' def render(self, context): # If the nav variable is al...
{ "repo_name": "jbergantine/django-templatetags", "path": "django_templatetags/templatetags/nav.py", "copies": "2", "size": "3723", "license": "mit", "hash": 941154207920639600, "line_mean": 32.25, "line_max": 94, "alpha_frac": 0.550899812, "autogenerated": false, "ratio": 4.024864864864865, "co...
from django import template from django.utils.functional import cached_property from wagtail.wagtailimages.models import Filter, SourceImageIOError register = template.Library() @register.tag(name="image") def image(parser, token): bits = token.split_contents()[1:] image_expr = parser.compile_filter(bits[0]...
{ "repo_name": "jordij/wagtail", "path": "wagtail/wagtailimages/templatetags/wagtailimages_tags.py", "copies": "24", "size": "3087", "license": "bsd-3-clause", "hash": 1085239592108806700, "line_mean": 39.6184210526, "line_max": 197, "alpha_frac": 0.6245545837, "autogenerated": false, "ratio": 4.1...
from django import template from django.utils.html import conditional_escape from account.utils import user_display register = template.Library() class UserDisplayNode(template.Node): def __init__(self, user, as_var=None): self.user_var = template.Variable(user) self.as_var = as_var def rende...
{ "repo_name": "zhiwehu/IBookmark", "path": "webapp/apps/account/templatetags/account_tags.py", "copies": "1", "size": "1219", "license": "apache-2.0", "hash": 8562390387113457000, "line_mean": 24.9361702128, "line_max": 95, "alpha_frac": 0.6004922067, "autogenerated": false, "ratio": 3.8333333333...
from django import template from django.utils.html import conditional_escape from django.utils.safestring import mark_safe from django.template.defaultfilters import slugify register = template.Library() def trunc(string, length=75, end='..'): if len(string) > length: return string[:length] + end return string d...
{ "repo_name": "chrisma/ScrumLint", "path": "metricsapp/templatetags/artifactformat.py", "copies": "1", "size": "3754", "license": "mit", "hash": 3013591004301959700, "line_mean": 30.0247933884, "line_max": 158, "alpha_frac": 0.6819392648, "autogenerated": false, "ratio": 3.029862792574657, "con...
from django import template from django.utils.html import conditional_escape from django.utils.safestring import mark_safe from django.template.loader import render_to_string register = template.Library() @register.filter(is_safe=True, needs_autoescape=True) def format_threaded_comments(value, user_voting_data, autoe...
{ "repo_name": "noamsu/djangodash2012", "path": "djangodash/templatetags/custom_tags.py", "copies": "1", "size": "3650", "license": "mit", "hash": -8932132704045981000, "line_mean": 35.51, "line_max": 193, "alpha_frac": 0.5238356164, "autogenerated": false, "ratio": 4.09652076318743, "config_tes...
from django import template from django.utils.html import conditional_escape from django.utils.safestring import mark_safe from django.utils.translation import ugettext as _ from periodicals.models import Article register = template.Library() def article_result(article, autoescape=None): if autoescape: ...
{ "repo_name": "saschwarz/django-periodicals", "path": "periodicals/templatetags/periodicals_tags.py", "copies": "1", "size": "2418", "license": "bsd-3-clause", "hash": 6670190325553287000, "line_mean": 30.4025974026, "line_max": 120, "alpha_frac": 0.6100082713, "autogenerated": false, "ratio": 3....
from django import template from django.utils.html import conditional_escape from django.utils.safestring import mark_safe from issues.models import IssueCategory register = template.Library() @register.filter(needs_autoescape=True) def render_question_tree(question, autoescape=True): e = conditional_escape if a...
{ "repo_name": "chaosphere2112/acme-web-fe", "path": "apps/issues/templatetags/issues_extras.py", "copies": "1", "size": "1858", "license": "apache-2.0", "hash": -945586342503374700, "line_mean": 30.4915254237, "line_max": 71, "alpha_frac": 0.6426264801, "autogenerated": false, "ratio": 3.70119521...
from django import template from django.utils.html import conditional_escape from django.utils.safestring import mark_safe from paigow.pghand import PGHand from paigow.session_utils import session_player register = template.Library() # convenience functions for retrieving stuff from the request context. def tile_siz...
{ "repo_name": "rudisherry666/paigow", "path": "paigow/templatetags/paigow_extras.py", "copies": "1", "size": "3737", "license": "apache-2.0", "hash": 5819202415833125000, "line_mean": 36.7474747475, "line_max": 109, "alpha_frac": 0.7008295424, "autogenerated": false, "ratio": 3.3336306868867083, ...
from django import template from django.utils.html import conditional_escape from django.utils.safestring import mark_safe, SafeString from django.conf import settings from django.utils.module_loading import import_string from markdownx import settings as md_settings # access MARKDOWNX_xxx settings with canonic...
{ "repo_name": "bobhy/cmsplugin-markdownx", "path": "cmsplugin_markdownx/templatetags/cmsplugin_markdownx.py", "copies": "1", "size": "1736", "license": "mit", "hash": 5298717219878902000, "line_mean": 42.4, "line_max": 121, "alpha_frac": 0.7062211982, "autogenerated": false, "ratio": 4.1137440758...
from django import template from django.utils.html import conditional_escape from pinax.apps.account.utils import user_display register = template.Library() class UserDisplayNode(template.Node): def __init__(self, user, as_var=None): self.user_var = template.Variable(user) self.as_var = as...
{ "repo_name": "espenak/pinax-oldversion-backup", "path": "pinax/apps/account/templatetags/account_tags.py", "copies": "3", "size": "1266", "license": "mit", "hash": 4187356863789268500, "line_mean": 23.8235294118, "line_max": 95, "alpha_frac": 0.5853080569, "autogenerated": false, "ratio": 3.9074...
from django import template from django.utils.html import escape from django.contrib.auth.models import User from django.conf import settings from django.utils.hashcompat import md5_constructor import urllib GRAVATAR_URL_PREFIX = getattr(settings, "GRAVATAR_URL_PREFIX", "http://www.gravatar.com/") GRAVATAR_DEFAULT_IM...
{ "repo_name": "ax003d/sichu_web", "path": "sichu/gravatar/templatetags/gravatar.py", "copies": "1", "size": "1789", "license": "mit", "hash": -8886137976266689000, "line_mean": 34.78, "line_max": 118, "alpha_frac": 0.6903297932, "autogenerated": false, "ratio": 3.194642857142857, "config_test":...
from django import template from django.utils.html import escape from django.contrib.auth.models import User from six.moves.urllib.parse import urlencode, urlparse, parse_qs from django.core.urlresolvers import reverse from niji.models import ForumAvatar import hashlib register = template.Library() @register.simple_...
{ "repo_name": "ericls/niji", "path": "niji/templatetags/niji_tags.py", "copies": "1", "size": "3387", "license": "mit", "hash": -97274145436397800, "line_mean": 28.1982758621, "line_max": 93, "alpha_frac": 0.6350752879, "autogenerated": false, "ratio": 3.5577731092436973, "config_test": false, ...
from django import template from django.utils.html import escape from django.utils.safestring import mark_safe from django import template from random import randint from django.template.base import VariableDoesNotExist # L'application doit être dans les INSTALLED_APPS # Pour ce que l'on fasse soit pris en compte pou...
{ "repo_name": "guillaume-havard/testdjango", "path": "sitetest/blog/templatetags/blog_extras.py", "copies": "1", "size": "7679", "license": "mit", "hash": -7884991021466225000, "line_mean": 35.4711538462, "line_max": 140, "alpha_frac": 0.6825313118, "autogenerated": false, "ratio": 3.019506369426...
from django import template from django.utils.html import escape from django.utils.safestring import mark_safe from django.utils.translation import ugettext as _ import json import pprint import os register = template.Library() @register.inclusion_tag('pycassa-panel-stack-trace.html') def stack_trace_table(stack_tra...
{ "repo_name": "pista329/django-debug-toolbar-pycassa", "path": "debug_toolbar_pycassa/templatetags/pycassa_debug_tags.py", "copies": "1", "size": "2539", "license": "mit", "hash": 8389621864400749000, "line_mean": 31.1518987342, "line_max": 88, "alpha_frac": 0.6471051595, "autogenerated": false, ...
from django import template from django.utils.html import escape from django.utils.safestring import mark_safe from django.utils.translation import ugettext_lazy as _ from casepro.rules.models import ( ArchiveAction, ContainsTest, FieldTest, FlagAction, GroupsTest, LabelAction, WordCountTes...
{ "repo_name": "rapidpro/casepro", "path": "casepro/rules/templatetags/rules.py", "copies": "1", "size": "2231", "license": "bsd-3-clause", "hash": -3902869407937727500, "line_mean": 24.6436781609, "line_max": 107, "alpha_frac": 0.6665172568, "autogenerated": false, "ratio": 3.3751891074130107, ...
from django import template from django.utils.html import escape from django.utils.safestring import mark_safe from zentral.core.incidents.models import SEVERITY_CHOICES from zentral.utils.color import text_color_for_background_color register = template.Library() @register.simple_tag def incident_severity(severity, ...
{ "repo_name": "zentralopensource/zentral", "path": "zentral/core/incidents/templatetags/incidents_extras.py", "copies": "1", "size": "1038", "license": "apache-2.0", "hash": -6664078159188066000, "line_mean": 33.6, "line_max": 99, "alpha_frac": 0.6213872832, "autogenerated": false, "ratio": 3.448...
from django import template from django.utils.html import escape from django.utils.safestring import mark_safe from ..helpers import GRAVATAR_DEFAULT_SIZE, get_gravatar_profile_url, get_gravatar_url # Get template.Library instance register = template.Library() def gravatar_url(user_or_email, size=GRAVATAR_DEFAULT_S...
{ "repo_name": "twaddington/django-gravatar", "path": "django_gravatar/templatetags/gravatar.py", "copies": "1", "size": "1573", "license": "mit", "hash": 3197154524711891500, "line_mean": 26.5964912281, "line_max": 91, "alpha_frac": 0.6427209154, "autogenerated": false, "ratio": 3.390086206896551...
from django import template from django.utils.html import escape from django.utils.safestring import mark_safe from ..helpers import ( GRAVATAR_DEFAULT_SIZE, get_gravatar_profile_url, get_gravatar_url, ) # Get template.Library instance register = template.Library() def gravatar_url(user_or_email, size=G...
{ "repo_name": "P-EB/python-django-gravatar2", "path": "django_gravatar/templatetags/gravatar.py", "copies": "1", "size": "1636", "license": "mit", "hash": 5976209869976264000, "line_mean": 24.1692307692, "line_max": 79, "alpha_frac": 0.6143031785, "autogenerated": false, "ratio": 3.45147679324894...
from django import template from django.utils.html import escape from django.utils.safestring import mark_safe import logging register = template.Library() from splango.models import Goal, Subject, GoalRecord, Enrollment, Experiment, ExperimentReport CTX_PREFIX = "__splango__experiment__" class ExperimentNode(tem...
{ "repo_name": "shimon/Splango", "path": "splango/templatetags/splangotags.py", "copies": "1", "size": "4166", "license": "mit", "hash": 1649729438782445600, "line_mean": 35.2260869565, "line_max": 204, "alpha_frac": 0.6397023524, "autogenerated": false, "ratio": 3.829044117647059, "config_test"...
from django import template from django.utils.html import escape from django.utils.safestring import mark_safe import pprint import os register = template.Library() @register.filter def format_stack_trace(value): stack_trace = [] fmt = ( '<span class="path">{0}/</span>' '<span class="file">{1...
{ "repo_name": "agamdua/django-mongoengine", "path": "django_mongoengine/debug_toolbar/templatetags/mongodb_debug_tags.py", "copies": "5", "size": "1416", "license": "bsd-3-clause", "hash": -5923702732401999000, "line_mean": 31.9534883721, "line_max": 78, "alpha_frac": 0.6751412429, "autogenerated":...
from django import template from django.utils.html import escape from django.utils.safestring import mark_safe register = template.Library() import re readmore_showscript = ''.join([ "this.parentNode.style.display='none';", "this.parentNode.parentNode.getElementsByClassName('more')[0].style.display='inline';", "retu...
{ "repo_name": "xsunfeng/cir", "path": "cir/templatetags/readmore.py", "copies": "1", "size": "1026", "license": "mit", "hash": -1841337333184044500, "line_mean": 25.3333333333, "line_max": 87, "alpha_frac": 0.6705653021, "autogenerated": false, "ratio": 3.4545454545454546, "config_test": false,...
from django import template from django.utils.html import escape from voting.models import Vote from voting.managers import possible_votes import logging register = template.Library() class VoteByUserNode(template.Node): def __init__(self, user, object, context_var): self.user = user self.object...
{ "repo_name": "spreeker/democracygame", "path": "democracy/voting/templatetags/voting_tags.py", "copies": "1", "size": "7664", "license": "bsd-3-clause", "hash": -8885815487240698000, "line_mean": 34.4814814815, "line_max": 98, "alpha_frac": 0.6413100209, "autogenerated": false, "ratio": 3.857070...
from django import template from django.utils.html import escape register = template.Library() @register.tag def escapehtml(parser, token): nodelist = parser.parse(('endescapehtml',)) parser.delete_first_token() return EscapeHTMLNode(nodelist) class EscapeHTMLNode(template.Node): def __init__(self, n...
{ "repo_name": "DUCSS/ducss-site-old", "path": "project/utilities/templatetags/utility_tags.py", "copies": "1", "size": "1710", "license": "mit", "hash": -1485907153058529800, "line_mean": 35.4042553191, "line_max": 86, "alpha_frac": 0.6426900585, "autogenerated": false, "ratio": 3.816964285714285...
from django import template from django.utils.html import format_html, escape from django.utils.timesince import timesince from datetime import * from django.utils.timezone import utc from django.contrib.auth.models import Group register = template.Library() @register.filter(name='has_group') def has_group(user, gro...
{ "repo_name": "roberthettrick/django_twitter", "path": "stream_twitter/templatetags/filters.py", "copies": "1", "size": "2037", "license": "bsd-3-clause", "hash": -7447473711233600000, "line_mean": 31.8548387097, "line_max": 77, "alpha_frac": 0.6416298478, "autogenerated": false, "ratio": 3.66366...
from django import template from django.utils.html import format_html, escape from django.utils.timesince import timesince from datetime import * from django.utils.timezone import utc register = template.Library() @register.filter(name='time_difference') def time_difference(value): now = datetime.utcnow().replac...
{ "repo_name": "GetStream/django_twitter", "path": "stream_twitter/templatetags/filters.py", "copies": "1", "size": "1793", "license": "bsd-3-clause", "hash": 5495883937474701000, "line_mean": 32.2037037037, "line_max": 76, "alpha_frac": 0.6385945343, "autogenerated": false, "ratio": 3.66666666666...
from django import template from django.utils.html import format_html from django.utils.formats import date_format from django.utils import timezone from django.utils.safestring import mark_safe from django.conf import settings from django.contrib import staticfiles from babel.dates import format_timedelta register =...
{ "repo_name": "fusionbox/buggy", "path": "buggy/templatetags/buggy_tags.py", "copies": "1", "size": "1152", "license": "bsd-3-clause", "hash": 7434005046310039000, "line_mean": 27.8, "line_max": 76, "alpha_frac": 0.6848958333, "autogenerated": false, "ratio": 3.84, "config_test": false, "has_...
from django import template from django.utils.html import format_html from django.utils.safestring import mark_safe from django.urls import reverse register = template.Library() def navbar_template(title, url, active=False, disabled=False, dropdown=False, deprecated=False): """Compose Bootstr...
{ "repo_name": "swcarpentry/amy", "path": "amy/workshops/templatetags/navigation.py", "copies": "1", "size": "3264", "license": "mit", "hash": -2669305568109884000, "line_mean": 35.6741573034, "line_max": 83, "alpha_frac": 0.6424632353, "autogenerated": false, "ratio": 4, "config_test": false, ...
from django import template from django.utils.html import format_html from django.utils.translation import ugettext as _ from django_hosts.resolvers import reverse from ..models import Release register = template.Library() @register.simple_tag() def release_notes(version, show_version=False): version_x_dot_y = ...
{ "repo_name": "xavierdutreilh/djangoproject.com", "path": "releases/templatetags/release_notes.py", "copies": "1", "size": "1367", "license": "bsd-3-clause", "hash": 6776269726802323000, "line_mean": 32.3414634146, "line_max": 101, "alpha_frac": 0.6444769568, "autogenerated": false, "ratio": 3.72...
from django import template from django.utils.html import format_html register = template.Library() @register.inclusion_tag('commerce/format_coins.html') def show_coins(value): '''Display value with coin icons''' coin_list = [] coin_list.append(int(value / 10000)) #gold coin_list.append(int(value / 10...
{ "repo_name": "Wilsh/goldwarsplus", "path": "commerce/templatetags/commerce_extras.py", "copies": "1", "size": "2228", "license": "mit", "hash": 800249863955112000, "line_mean": 42.6862745098, "line_max": 198, "alpha_frac": 0.6018850987, "autogenerated": false, "ratio": 3.4382716049382718, "con...
from django import template from django.utils.html import mark_safe from views.models import View register = template.Library() @register.simple_tag(takes_context=True) def view(context, slug): try: view_obj = View.objects.get(slug=slug) return view_obj.render(context) except View.DoesNotE...
{ "repo_name": "publica-io/django-publica-views", "path": "views/templatetags/views_tags.py", "copies": "1", "size": "2586", "license": "bsd-3-clause", "hash": -6060773143354500000, "line_mean": 28.0561797753, "line_max": 98, "alpha_frac": 0.6279969064, "autogenerated": false, "ratio": 4.246305418...
from django import template from django.utils.html import mark_safe register = template.Library() @register.filter(name='addcss') def add_css(field, css): return field.as_widget(attrs={"class": css}) @register.filter def form_filed_type(field): return type(field).__name__ @register.filter def accident_ti...
{ "repo_name": "k-vinogradov/noclite", "path": "www/templatetags/custom_tags_filters.py", "copies": "1", "size": "2775", "license": "bsd-3-clause", "hash": 5727112032243220000, "line_mean": 27.3265306122, "line_max": 106, "alpha_frac": 0.5956756757, "autogenerated": false, "ratio": 3.5350318471337...
from django import template from django.utils.http import urlquote from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger import types register = template.Library() @register.simple_tag(takes_context=True) def query_string(context, key, value): GET = context['request'].GET.copy() GET[key] =...
{ "repo_name": "dstndstn/astrometry.net", "path": "net/templatetags/custom_tags.py", "copies": "1", "size": "1725", "license": "bsd-3-clause", "hash": -8917132208119590000, "line_mean": 25.953125, "line_max": 79, "alpha_frac": 0.6011594203, "autogenerated": false, "ratio": 3.542094455852156, "co...
from django import template from django.utils.http import urlquote from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger import urllib import types register = template.Library() @register.simple_tag(takes_context=True) def query_string(context, key, value): GET = context['request'].GET.copy() ...
{ "repo_name": "olebole/astrometry.net", "path": "net/templatetags/custom_tags.py", "copies": "1", "size": "1737", "license": "bsd-3-clause", "hash": -1367621814487664600, "line_mean": 25.7230769231, "line_max": 79, "alpha_frac": 0.6039147956, "autogenerated": false, "ratio": 3.5448979591836736, ...
from django import template from django.utils.http import urlquote from endpoint_monitor.models import EndpointTest from linda_app.lists import CATEGORIES from linda_app.models import Vocabulary, VocabularyClass, VocabularyProperty, get_configuration, \ datasource_from_endpoint register = template.Library() # Loa...
{ "repo_name": "LinDA-tools/LindaWorkbench", "path": "linda/linda_app/templatetags/app_filters.py", "copies": "1", "size": "3360", "license": "mit", "hash": 7887982720966574000, "line_mean": 26.7768595041, "line_max": 142, "alpha_frac": 0.6610119048, "autogenerated": false, "ratio": 3.729189789123...
from django import template from django.utils import html from django.utils.safestring import mark_safe from django.utils.translation import ugettext as _ register = template.Library() EMPTY_LABEL = '<span class="label label-info">Empty</span>' @register.simple_tag def translate(t, lang, langs=None): langs = la...
{ "repo_name": "qedsoftware/commcare-hq", "path": "corehq/apps/app_manager/templatetags/xforms_extras.py", "copies": "1", "size": "3407", "license": "bsd-3-clause", "hash": 4397153366627207000, "line_mean": 30.2568807339, "line_max": 105, "alpha_frac": 0.5811564426, "autogenerated": false, "ratio"...