text
stringlengths
0
1.05M
meta
dict
from django import template from django.template.context import RequestContext from django.template.loader import render_to_string from advanced_reports.views import list as advreport_list from advanced_reports import get_report_or_404 register = template.Library() @register.tag(name='advreport_detail')...
{ "repo_name": "vikingco/django-advanced-reports", "path": "advanced_reports/templatetags/advreport_utils.py", "copies": "1", "size": "2800", "license": "bsd-3-clause", "hash": 8764689073426431000, "line_mean": 39.0142857143, "line_max": 110, "alpha_frac": 0.6603571429, "autogenerated": false, "ra...
from django import template from django.template.defaultfilters import escape from django.utils.safestring import mark_safe from workshops.models import TrainingProgress register = template.Library() @register.simple_tag def progress_label(progress): assert isinstance(progress, TrainingProgress) if progres...
{ "repo_name": "pbanaszkiewicz/amy", "path": "amy/workshops/templatetags/training_progress.py", "copies": "1", "size": "1412", "license": "mit", "hash": 1886362791534416400, "line_mean": 27.8163265306, "line_max": 88, "alpha_frac": 0.6196883853, "autogenerated": false, "ratio": 3.9441340782122905,...
from django import template from django.template.defaultfilters import filesizeformat from django.utils.safestring import mark_safe from goals.permissions import ( is_content_editor, is_content_author, is_contributor, ) register = template.Library() @register.filter("is_author") def user_is_author(user)...
{ "repo_name": "izzyalonso/tndata_backend", "path": "tndata_backend/goals/templatetags/goal_filters.py", "copies": "2", "size": "2810", "license": "mit", "hash": -24201346854263690, "line_mean": 25.0185185185, "line_max": 80, "alpha_frac": 0.6391459075, "autogenerated": false, "ratio": 3.716931216...
from django import template from django.template.defaultfilters import linebreaks, urlize from symposion.conference.models import current_conference from pycon.sponsorship.models import Sponsor, SponsorLevel register = template.Library() class SponsorsNode(template.Node): @classmethod def handle_token...
{ "repo_name": "pyconjp/pyconjp-website", "path": "pycon/sponsorship/templatetags/sponsorship_tags.py", "copies": "1", "size": "3695", "license": "bsd-3-clause", "hash": 8675453588106114000, "line_mean": 30.5811965812, "line_max": 139, "alpha_frac": 0.600270636, "autogenerated": false, "ratio": 3....
from django import template from django.template.defaultfilters import linebreaks, urlize from symposion.conference.models import current_conference from symposion.sponsorship.models import Sponsor, SponsorLevel register = template.Library() class SponsorsNode(template.Node): @classmethod def handle_token...
{ "repo_name": "pyconau2017/symposion", "path": "symposion/sponsorship/templatetags/sponsorship_tags.py", "copies": "6", "size": "3718", "license": "bsd-3-clause", "hash": -4877749398318927000, "line_mean": 29.9833333333, "line_max": 95, "alpha_frac": 0.5976331361, "autogenerated": false, "ratio":...
from django import template from django.template.defaultfilters import safe from cms.plugins.utils import get_plugin_media register = template.Library() class PlaceholderNode(template.Node): def __init__(self, placeholder, width): self.placeholder = placeholder self.width = width def...
{ "repo_name": "dibaunaumh/tikal-corp-website", "path": "cms/templatetags/placeholder_tags.py", "copies": "1", "size": "1282", "license": "bsd-3-clause", "hash": 5599132749368097000, "line_mean": 31.8974358974, "line_max": 93, "alpha_frac": 0.651326053, "autogenerated": false, "ratio": 4.287625418...
from django import template from django.template.defaultfilters import safe from blog.models import Sponsor, Footer from wagtail.core.models import Page from markdown import markdown register = template.Library() @register.filter() def markdownify(value): return markdown(value) @register.simple_tag(takes_con...
{ "repo_name": "davidjrichardson/uwcs-zarya", "path": "lib/templatetags/base_tags.py", "copies": "1", "size": "3903", "license": "mit", "hash": -5382244733385129000, "line_mean": 34.4818181818, "line_max": 117, "alpha_frac": 0.6607737638, "autogenerated": false, "ratio": 3.8835820895522386, "con...
from django import template from django.template.defaultfilters import stringfilter, force_escape from django.utils.safestring import mark_safe import richtemplates.settings from richtemplates.skins import get_skins from richtemplates.skins import get_skin_by_alias from richtemplates.skins import get_skin_from_request...
{ "repo_name": "lukaszb/django-richtemplates", "path": "richtemplates/templatetags/richtemplates_tags.py", "copies": "1", "size": "4050", "license": "bsd-3-clause", "hash": 3221996809026363400, "line_mean": 34.5263157895, "line_max": 79, "alpha_frac": 0.6224691358, "autogenerated": false, "ratio":...
from django import template from django.template.defaultfilters import stringfilter from currencies.models import Currency from currencies.utils import calculate_price, convert_currency, get_currency register = template.Library() @register.filter(name='currency') @stringfilter def set_currency(value, arg): retur...
{ "repo_name": "jmp0xf/django-currencies", "path": "currencies/templatetags/currency.py", "copies": "1", "size": "2977", "license": "bsd-3-clause", "hash": -3855965663757745000, "line_mean": 34.0352941176, "line_max": 98, "alpha_frac": 0.6708095398, "autogenerated": false, "ratio": 4.2528571428571...
from django import template from django.template.defaultfilters import stringfilter from currencies.models import Currency from currencies.utils import calculate_price register = template.Library() @register.filter(name='currency') @stringfilter def set_currency(value, arg): return calculate_price(value, arg) ...
{ "repo_name": "barseghyanartur/django-currencies", "path": "currencies/templatetags/currency.py", "copies": "2", "size": "1106", "license": "bsd-3-clause", "hash": 436334591026486460, "line_mean": 29.7222222222, "line_max": 96, "alpha_frac": 0.7070524412, "autogenerated": false, "ratio": 4.205323...
from django import template from django.template.defaultfilters import stringfilter from currencies.utils import calculate_price, convert register = template.Library() @register.filter(name='currency') @stringfilter def set_currency(value, arg): return calculate_price(value, arg) class ChangeCurrencyNode(templ...
{ "repo_name": "mysociety/django-currencies", "path": "currencies/templatetags/currency.py", "copies": "1", "size": "1222", "license": "bsd-3-clause", "hash": -1021671870979031000, "line_mean": 29.55, "line_max": 96, "alpha_frac": 0.7004909984, "autogenerated": false, "ratio": 4.100671140939597, ...
from django import template from django.template.defaultfilters import stringfilter from django.core.urlresolvers import get_resolver from datetime import datetime from django.conf import settings from urlparse import parse_qs import re import urlparse BOOTSTRAP_BASE_URL = getattr(settings, 'BOOTSTRAP_BASE_URL', ...
{ "repo_name": "unicefuganda/ureport_website", "path": "ureport_website/ureport_website/templatetags/websitetags.py", "copies": "1", "size": "3186", "license": "mit", "hash": 1771590400231467500, "line_mean": 24.496, "line_max": 79, "alpha_frac": 0.6258631513, "autogenerated": false, "ratio": 3.32...
from django import template from django.template.defaultfilters import stringfilter from django.core.urlresolvers import reverse from microblogging.models import Tweet import re register = template.Library() user_ref_re = re.compile("@(\w+)") def make_user_link(text): username = text.group(1) return """@<a hr...
{ "repo_name": "Tyler2004/django-microblogging", "path": "microblogging/templatetags/microblogging_tags.py", "copies": "1", "size": "1146", "license": "mit", "hash": 1330037177361868500, "line_mean": 32.7058823529, "line_max": 94, "alpha_frac": 0.7059336824, "autogenerated": false, "ratio": 3.4005...
from django import template from django.template.defaultfilters import stringfilter from django.shortcuts import get_object_or_404 from django.utils.html import conditional_escape from django.utils.safestring import mark_safe from datetime import datetime import re #regexp shit from browseNet.models import Smb from...
{ "repo_name": "blampe/M2M", "path": "m2m/requests/templatetags/request_extras.py", "copies": "2", "size": "1141", "license": "mit", "hash": -1297469301196112600, "line_mean": 23.8043478261, "line_max": 117, "alpha_frac": 0.6827344435, "autogenerated": false, "ratio": 3.692556634304207, "config_...
from django import template from django.template.defaultfilters import stringfilter from django.template.loader import get_template register = template.Library() def trim(value, num): return value[:num] trim = stringfilter(trim) register.filter(trim) @register.simple_tag def no_params(): """Expected no_para...
{ "repo_name": "disqus/django-old", "path": "tests/regressiontests/templates/templatetags/custom.py", "copies": "2", "size": "7211", "license": "bsd-3-clause", "hash": -1780159616348616000, "line_mean": 46.1307189542, "line_max": 136, "alpha_frac": 0.7301345167, "autogenerated": false, "ratio": 3....
from django import template from django.template.defaultfilters import stringfilter from django.template.loader import render_to_string from main import claiming from main.models import Page register = template.Library() def get_claimable_pages(request): if not request.user.is_authenticated(): return [] ...
{ "repo_name": "reverie/jotleaf.com", "path": "jotleaf/main/templatetags/main_tags.py", "copies": "1", "size": "2272", "license": "mit", "hash": 4664698520767653000, "line_mean": 29.7027027027, "line_max": 118, "alpha_frac": 0.6980633803, "autogenerated": false, "ratio": 3.6178343949044587, "con...
from django import template from django.template.defaultfilters import stringfilter from django.utils.html import format_html, mark_safe from django.forms import DateField, DateTimeField, ModelChoiceField, ModelMultipleChoiceField from django.db import models import json register = template.Library() @register.filte...
{ "repo_name": "zagaran/silica", "path": "silica/django_app/templatetags/silica.py", "copies": "1", "size": "4801", "license": "mit", "hash": -4251903704184427500, "line_mean": 42.6454545455, "line_max": 132, "alpha_frac": 0.6369506353, "autogenerated": false, "ratio": 3.5668647845468056, "confi...
from django import template from django.template.defaultfilters import stringfilter from django.utils.html import strip_entities, strip_tags import re register = template.Library() @register.filter @stringfilter def sentence_case(value): return value.replace("_", " ").capitalize() @register.filter @stringfilte...
{ "repo_name": "CivicTechTO/django-councilmatic", "path": "councilmatic_core/templatetags/extras.py", "copies": "1", "size": "2797", "license": "mit", "hash": 5865572423438480000, "line_mean": 23.7522123894, "line_max": 83, "alpha_frac": 0.6496245978, "autogenerated": false, "ratio": 3.34569377990...
from django import template from django.template.defaultfilters import stringfilter from django.utils.html import strip_entities, strip_tags import re register = template.Library() @register.filter @stringfilter def sentence_case(value): return value.replace("_", " ").capitalize() @register.filter @stringfilter ...
{ "repo_name": "bonville/nyc-councilmatic-test", "path": "core/templatetags/extras.py", "copies": "1", "size": "2374", "license": "mit", "hash": 5312713415010665000, "line_mean": 28.3086419753, "line_max": 79, "alpha_frac": 0.6680707666, "autogenerated": false, "ratio": 3.353107344632768, "confi...
from django import template from django.template.defaultfilters import stringfilter from django.utils.html import strip_tags import re from django.utils.safestring import mark_safe from django.core.serializers import serialize import json from django.db.models.query import QuerySet from urllib.parse import urlsplit, p...
{ "repo_name": "datamade/django-councilmatic", "path": "councilmatic_core/templatetags/extras.py", "copies": "1", "size": "4170", "license": "mit", "hash": -4556507921302283300, "line_mean": 24.4329268293, "line_max": 128, "alpha_frac": 0.6597122302, "autogenerated": false, "ratio": 3.393002441008...
from django import template from django.template.defaultfilters import stringfilter from django.utils.safestring import mark_safe from django.core.urlresolvers import reverse from main.models import Post from utils.templatetags.post_color import post_color import markdown register = template.Library() class Disabl...
{ "repo_name": "entwanne/Rodolphe", "path": "rodolphe/utils/templatetags/markup.py", "copies": "2", "size": "3193", "license": "bsd-2-clause", "hash": 2325004418487790600, "line_mean": 34.8764044944, "line_max": 80, "alpha_frac": 0.6144691513, "autogenerated": false, "ratio": 3.875, "config_test...
from django import template from django.template.defaultfilters import stringfilter from django.utils.safestring import mark_safe from django.utils.html import escape from pygments import highlight from pygments.lexers import guess_lexer_for_filename, TextLexer, DiffLexer from pygments.formatters import HtmlFormatter ...
{ "repo_name": "michaelwisely/django-greta", "path": "src/greta/templatetags/greta_tags.py", "copies": "1", "size": "2926", "license": "bsd-3-clause", "hash": -7403511747571096000, "line_mean": 21.1666666667, "line_max": 74, "alpha_frac": 0.7026657553, "autogenerated": false, "ratio": 3.4545454545...
from django import template from django.template.defaultfilters import stringfilter from django.utils.safestring import mark_safe from django.utils.html import urlize as urlize_impl from woot.apps.catalog.models.interactions import Interaction, UserInteraction import re register = template.Library() @register.filte...
{ "repo_name": "Makeystreet/makeystreet", "path": "woot/apps/catalog/templatetags/catalog_tags.py", "copies": "1", "size": "1083", "license": "apache-2.0", "hash": 5702128871310097000, "line_mean": 32.84375, "line_max": 111, "alpha_frac": 0.7119113573, "autogenerated": false, "ratio": 3.7474048442...
from django import template from django.template.defaultfilters import stringfilter from django.utils.safestring import mark_safe from django.utils.html import urlize register = template.Library() @register.filter(is_safe=True, needs_autoescape=True) @stringfilter def urlise(value, autoescape=None): """Like the ...
{ "repo_name": "jclgoodwin/bustimes.org.uk", "path": "busstops/templatetags/urlise.py", "copies": "1", "size": "1448", "license": "mpl-2.0", "hash": 672372590730632400, "line_mean": 47.2666666667, "line_max": 120, "alpha_frac": 0.6837016575, "autogenerated": false, "ratio": 3.2393736017897092, "...
from django import template from django.template.defaultfilters import stringfilter from django.utils.safestring import mark_safe from pygments import highlight from pygments.formatters import HtmlFormatter from pygments.lexers import get_lexer_by_name,guess_lexer,ClassNotFound register = template.Library() def gener...
{ "repo_name": "bastir85/django-chartit", "path": "demoproject/syntax_colorize/templatetags/syntax_color.py", "copies": "4", "size": "1119", "license": "bsd-2-clause", "hash": 301882661191094200, "line_mean": 26.975, "line_max": 94, "alpha_frac": 0.7167113494, "autogenerated": false, "ratio": 3.71...
from django import template from django.template.defaultfilters import stringfilter from django.utils.safestring import mark_safe from wagtail.wagtailcore.rich_text import RichText import re from unusualbusiness.utils.ub_link_handlers import expand_inline_html, UBRichText from django.utils.text import (slugify as _slu...
{ "repo_name": "jeremy-c/unusualbusiness", "path": "unusualbusiness/pages/templatetags/ub_wagtailcore_tags.py", "copies": "1", "size": "1500", "license": "bsd-3-clause", "hash": 3118482735403880400, "line_mean": 29, "line_max": 95, "alpha_frac": 0.652, "autogenerated": false, "ratio": 3.8167938931...
from django import template from django.template.defaultfilters import stringfilter from django.utils.safestring import mark_safe import re from sozluk.models import Baslik, Entry from sozluk.forms import BaslikForm, EntryForm from collections import OrderedDict from datetime import date from django.template.loader imp...
{ "repo_name": "sozlukus/sozlukus.com", "path": "sozlukus/sozluk/templatetags/ttag.py", "copies": "1", "size": "2770", "license": "mit", "hash": 5187222743183116000, "line_mean": 31.2093023256, "line_max": 97, "alpha_frac": 0.623465704, "autogenerated": false, "ratio": 2.962566844919786, "config...
from django import template from django.template.defaultfilters import stringfilter from django.utils.safestring import mark_safe import bleach import markdown2 register = template.Library() # Not really safe, but Django needs to think it is. @register.filter(is_safe=True) @stringfilter def unsafe_markdown(value): ...
{ "repo_name": "w0rp/w0rpzone", "path": "w0rplib/templatetags/markdown.py", "copies": "1", "size": "1374", "license": "bsd-2-clause", "hash": 4200208242134314000, "line_mean": 19.5074626866, "line_max": 55, "alpha_frac": 0.4374090247, "autogenerated": false, "ratio": 4.2407407407407405, "config_...
from django import template # from django.template.defaultfilters import stringfilter from django.utils.safestring import mark_safe register = template.Library() @register.simple_tag def bootstrap_tag_class(name): name_low = name.lower() class_ = 'badge-secondary' if name_low.startswith('swc'): ...
{ "repo_name": "swcarpentry/amy", "path": "amy/workshops/templatetags/tags.py", "copies": "1", "size": "1090", "license": "mit", "hash": -3129151690278607400, "line_mean": 28.4594594595, "line_max": 74, "alpha_frac": 0.6651376147, "autogenerated": false, "ratio": 3.550488599348534, "config_test"...
from django import template from django.template.defaultfilters import stringfilter from django.utils.safestring import mark_safe, SafeData from django.utils.text import normalize_newlines from django.utils.html import escape from dojo.models import Check_List register = template.Library() @register.filter(name='por...
{ "repo_name": "ksmaheshkumar/django-DefectDojo", "path": "dojo/templatetags/display_tags.py", "copies": "1", "size": "1127", "license": "bsd-3-clause", "hash": -3769091664122037000, "line_mean": 26.512195122, "line_max": 70, "alpha_frac": 0.7187222715, "autogenerated": false, "ratio": 3.707236842...
from django import template from django.template.defaultfilters import stringfilter from django.utils.translation import ugettext_lazy as _ from contentcuration.models import License register = template.Library() LICENSE_MAPPING = {l.license_name: l.license_url for l in License.objects.all()} DESCRIPTION_MAPPING = {...
{ "repo_name": "fle-internal/content-curation", "path": "contentcuration/contentcuration/templatetags/license_tags.py", "copies": "1", "size": "4580", "license": "mit", "hash": 7366369905265376000, "line_mean": 72.8709677419, "line_max": 125, "alpha_frac": 0.5296943231, "autogenerated": false, "ra...
from django import template from django.template.defaultfilters import stringfilter from events.models import Attendance def event(context, e, event_num=1): """ Renders a single ``Event`` object. """ to_return = { 'event': e, 'request': context['request'], 'event_num': event_num...
{ "repo_name": "ericflo/startthedark", "path": "events/templatetags/events_tags.py", "copies": "2", "size": "1330", "license": "bsd-3-clause", "hash": 3378062626861501400, "line_mean": 28.5777777778, "line_max": 79, "alpha_frac": 0.6180451128, "autogenerated": false, "ratio": 3.993993993993994, ...
from django import template from django.template.defaultfilters import stringfilter from oembed.core import replace register = template.Library() def oembed(input, args): if args: width, height = args.lower().split('x') if not width and height: raise template.TemplateSyntaxError("Oembe...
{ "repo_name": "ericflo/django-oembed", "path": "oembed/templatetags/oembed_tags.py", "copies": "2", "size": "2136", "license": "bsd-3-clause", "hash": -8160984514734566000, "line_mean": 34.6, "line_max": 90, "alpha_frac": 0.6493445693, "autogenerated": false, "ratio": 3.962894248608534, "config...
from django import template from django.template.defaultfilters import stringfilter from oembed.core import replace register = template.Library() def oembed(input): return replace(input) oembed.is_safe = True oembed = stringfilter(oembed) register.filter('oembed', oembed) def do_oembed(parser, token): """ ...
{ "repo_name": "indro/t2c", "path": "apps/external_apps/oembed/templatetags/oembed_tags.py", "copies": "4", "size": "1793", "license": "mit", "hash": -946141412062358300, "line_mean": 32.8301886792, "line_max": 90, "alpha_frac": 0.6536530954, "autogenerated": false, "ratio": 3.932017543859649, "...
from django import template from django.template.defaultfilters import stringfilter from oembed.core import replace register = template.Library() @register.filter(name='oembed', is_safe=True) @stringfilter def oembed(input, args=''): ''' args - optional oembed max size argument args="640x480" - max_width...
{ "repo_name": "webriders/django-oembed", "path": "oembed/templatetags/oembed_tags.py", "copies": "2", "size": "3510", "license": "bsd-3-clause", "hash": -9145420865397806000, "line_mean": 34.8163265306, "line_max": 152, "alpha_frac": 0.6256410256, "autogenerated": false, "ratio": 3.78232758620689...
from django import template from django.template.defaultfilters import stringfilter from polls.models import * from django.utils.safestring import mark_safe from django.core.exceptions import ObjectDoesNotExist ########## CUSTOM TEMPLATE FILTERS ########### register = template.Library() @register.filter(name = 'from...
{ "repo_name": "vguillermo-developer/bbpolls", "path": "polls/templatetags/custom_filters.py", "copies": "1", "size": "2358", "license": "apache-2.0", "hash": -6610234123726577000, "line_mean": 31.75, "line_max": 173, "alpha_frac": 0.7311280746, "autogenerated": false, "ratio": 3.144, "config_te...
from django import template from django.template.defaultfilters import stringfilter from tidylib import tidy_fragment from django.conf import settings from copy import copy from datetime import datetime from ummeli.base.models import Banner from django.db.models import Q, F register = template.Library() @register.fil...
{ "repo_name": "praekelt/ummeli", "path": "ummeli/vlive/templatetags/vlive_tags.py", "copies": "1", "size": "4059", "license": "bsd-3-clause", "hash": -3961463887238889500, "line_mean": 33.9913793103, "line_max": 96, "alpha_frac": 0.6220744026, "autogenerated": false, "ratio": 3.7034671532846715, ...
from django import template from django.template.defaultfilters import stringfilter from viewflow.activation import STATUS from ..flows import SubmissionFlow from ..utils import is_hidden_task register = template.Library() @register.filter @stringfilter def hide_traceback(value): """Removes traceback lines from...
{ "repo_name": "Candihub/pixel", "path": "apps/submission/templatetags/submission.py", "copies": "1", "size": "1707", "license": "bsd-3-clause", "hash": -1857488744029555700, "line_mean": 23.3857142857, "line_max": 76, "alpha_frac": 0.6613942589, "autogenerated": false, "ratio": 4.045023696682464,...
from django import template from django.template.defaultfilters import stringfilter import json from autoprotocol_interpreter import simplify_pipette_operations from autolims.models import Resource from helper_funcs import str_respresents_int register = template.Library() def _to_safe_label(label): return label...
{ "repo_name": "scottbecker/autolims", "path": "autolims/templatetags/run_tags.py", "copies": "1", "size": "1310", "license": "mit", "hash": 8127887028528616000, "line_mean": 23.7358490566, "line_max": 84, "alpha_frac": 0.7091603053, "autogenerated": false, "ratio": 3.358974358974359, "config_te...
from django import template from django.template.defaultfilters import stringfilter import locale register = template.Library() #-----------\ # FILTERS | #-----------/ @register.filter @stringfilter def num_format(value, places = 2, min_places = 2): return format(value, '.', int(places), 3, ',', int(min_places))...
{ "repo_name": "fxdemolisher/frano", "path": "frano/templatetags/frano_filters.py", "copies": "1", "size": "2315", "license": "mit", "hash": -4295274908980760600, "line_mean": 26.2352941176, "line_max": 98, "alpha_frac": 0.5917926566, "autogenerated": false, "ratio": 3.578052550231839, "config_t...
from django import template from django.template.defaultfilters import stringfilter from django.conf import settings register = template.Library() @register.filter(name='markdown') @stringfilter def markdown(value, arg=''): """ Filter to create HTML out of Markdown, using custom extensions. The diffrenc...
{ "repo_name": "ankor-io/ankor-framework", "path": "website/ankorsite/templatetags/markdownlib.py", "copies": "1", "size": "1475", "license": "apache-2.0", "hash": 6538552378831463000, "line_mean": 31.0652173913, "line_max": 72, "alpha_frac": 0.6305084746, "autogenerated": false, "ratio": 4.469696...
from django import template from django.template.defaultfilters import stringfilter from django.utils.html import conditional_escape from django.utils.safestring import mark_safe from nntpchan.frontend.models import Newsgroup, Post import re from urllib.parse import urlparse from html import unescape register = te...
{ "repo_name": "chen-chan/nntpchan", "path": "contrib/frontends/django/nntpchan/nntpchan/frontend/templatetags/chanup.py", "copies": "2", "size": "4174", "license": "mit", "hash": 124092881455020860, "line_mean": 30.1492537313, "line_max": 129, "alpha_frac": 0.5246765692, "autogenerated": false, "...
from django import template from django.template.defaultfilters import stringfilter from django.utils.translation import check_for_language from django.utils.translation.trans_real import translation from transurlvania.translators import NoTranslationError register = template.Library() def token_splitter(token, u...
{ "repo_name": "trapeze/transurlvania", "path": "transurlvania/templatetags/transurlvania_tags.py", "copies": "1", "size": "3257", "license": "bsd-3-clause", "hash": -6574178220845227000, "line_mean": 26.3697478992, "line_max": 102, "alpha_frac": 0.605465152, "autogenerated": false, "ratio": 3.962...
from django import template from django.template.defaultfilters import stringfilter from etcetera.extras import constants register = template.Library() @register.inclusion_tag('tags/paginate.html', takes_context=True) def paginate(context, url_args=''): return { "paged_objects": context["paged_objects"],...
{ "repo_name": "kreeger/etcetera", "path": "extras/templatetags/etcetera_tags.py", "copies": "1", "size": "1034", "license": "bsd-3-clause", "hash": 5693178599501269000, "line_mean": 28.5714285714, "line_max": 66, "alpha_frac": 0.6721470019, "autogenerated": false, "ratio": 3.3901639344262295, "...
from django import template from django.template.defaultfilters import stringfilter from frontdesk.models import ( PACKAGE_VIRUSSCAN_STATUS_INFECTED, PACKAGE_VIRUSSCAN_STATUS_UNINFECTED, PACKAGE_VIRUSSCAN_STATUS_UNDETERMINED, PACKAGE_VIRUSSCAN_STATUS_QUEUED, ) register = template.Libr...
{ "repo_name": "fabiobatalha/inbox", "path": "frontdesk/templatetags/frontdesk_extras.py", "copies": "2", "size": "3251", "license": "bsd-2-clause", "hash": -8403771554542401000, "line_mean": 23.5075757576, "line_max": 81, "alpha_frac": 0.6652241113, "autogenerated": false, "ratio": 3.290946083418...
from django import template from django.template.defaultfilters import stringfilter from pastebin.utils import languageformat register = template.Library() @register.filter @stringfilter def truncatechars(value, index): result = value[:index] if len(value) >= index: result += '...' return res...
{ "repo_name": "DrMegahertz/codenotes", "path": "applications/pastebin/templatetags/pastebin_tags.py", "copies": "1", "size": "1243", "license": "bsd-3-clause", "hash": -2235306412372203300, "line_mean": 18.1230769231, "line_max": 59, "alpha_frac": 0.603378922, "autogenerated": false, "ratio": 3.7...
from django import template from django.template.defaultfilters import stringfilter from tracker.models import PRO PRO_DICT = dict(PRO) register = template.Library() @register.filter def hours(minutes): if not minutes: return '~' elif minutes < 60: return "{:.0f}'".format(minutes) elif ...
{ "repo_name": "Alkxzv/simple-time-tracker", "path": "web/tracker/templatetags/tracker.py", "copies": "1", "size": "1332", "license": "mit", "hash": 708986543825011600, "line_mean": 21.4406779661, "line_max": 55, "alpha_frac": 0.5309667674, "autogenerated": false, "ratio": 3.318295739348371, "co...
from django import template from django.template.defaultfilters import stringfilter from url2png.settings import THUMBNAIL_MAX_WIDTH, VIEWPORT from url2png.api import make_api_url, calc_height register = template.Library() @register.filter @stringfilter def url2png(url, width=THUMBNAIL_MAX_WIDTH): """ Gener...
{ "repo_name": "callowayproject/django-url2png", "path": "url2png/templatetags/url2png_tags.py", "copies": "1", "size": "1064", "license": "apache-2.0", "hash": 8287553343548029000, "line_mean": 27.7567567568, "line_max": 115, "alpha_frac": 0.6954887218, "autogenerated": false, "ratio": 3.33542319...
from django import template from django.template.defaultfilters import stringfilter register = template.Library() @register.filter def mean(values): try: integers = [int(v) for v in values] except (TypeError, ValueError): return 'n/a' return sum(integers)/len(integers)*1.0 @register.fi...
{ "repo_name": "ehealthafrica-ci/rapidsms-decisiontree-app", "path": "decisiontree/templatetags/tree_tags.py", "copies": "2", "size": "1342", "license": "bsd-3-clause", "hash": 556716843315373100, "line_mean": 21.7457627119, "line_max": 60, "alpha_frac": 0.6207153502, "autogenerated": false, "rati...
from django import template from django.template.defaultfilters import stringfilter register = template.Library() def trim(value, num): return value[:num] trim = stringfilter(trim) register.filter(trim) @register.simple_tag def no_params(): """Expected no_params __doc__""" return "no_params - Expected r...
{ "repo_name": "bratsche/Neutron-Drive", "path": "google_appengine/lib/django_1_3/tests/regressiontests/templates/templatetags/custom.py", "copies": "49", "size": "3021", "license": "bsd-3-clause", "hash": -6272919015345070000, "line_mean": 41.5492957746, "line_max": 122, "alpha_frac": 0.7140019861, ...
from django import template from django.template.defaultfilters import stringfilter register = template.Library() @register.filter def percentage(value, arg=2): try: return ('{0:.%s%%}' % arg).format(float(value)) except ValueError: # Unable to parse value return None @register.filter...
{ "repo_name": "Jaidan/django-commontags", "path": "commontags/templatetags/common_filters.py", "copies": "1", "size": "1661", "license": "bsd-3-clause", "hash": 5919408290091993000, "line_mean": 22.7285714286, "line_max": 122, "alpha_frac": 0.5514750151, "autogenerated": false, "ratio": 3.3087649...
from django import template from django.template.defaultfilters import stringfilter register = template.Library() STATUS_COLORS = { 'default': 'blue', 'queued': 'blue', 'undetermined': 'blue', 'infected': 'red', 'uninfected': 'green', 'deposited': 'blue', 'rejected': 'red', 'accepted':...
{ "repo_name": "gustavofonseca/inbox", "path": "frontdesk/templatetags/frontdesk.py", "copies": "2", "size": "1931", "license": "bsd-2-clause", "hash": -5719982471763155000, "line_mean": 22, "line_max": 81, "alpha_frac": 0.621957535, "autogenerated": false, "ratio": 3.543119266055046, "config_te...
from django import template from django.template.defaultfilters import stringfilter register = template.Library() # tags here from django import template from django.template import resolve_variable, NodeList from django.contrib.auth.models import Group register = template.Library() @register.tag() def ifusergr...
{ "repo_name": "lemanjo/pimanager", "path": "pimanager/templatetags/custom_functions.py", "copies": "1", "size": "2313", "license": "bsd-3-clause", "hash": 3620832213371848700, "line_mean": 29.8533333333, "line_max": 104, "alpha_frac": 0.6255944661, "autogenerated": false, "ratio": 4.4395393474088...
from django import template from django.template.defaultfilters import stringfilter register = template.Library() import os @register.filter @stringfilter def filename(value): # returns just the filename itself # for file.name = '../uploads/foo.ext', {{ bar.file.name|filename }} yields 'foo.ext' return os...
{ "repo_name": "elighcash/strands", "path": "apps/strands/templatetags/file_filters.py", "copies": "1", "size": "1072", "license": "unlicense", "hash": -394067842218018700, "line_mean": 30.5588235294, "line_max": 117, "alpha_frac": 0.625, "autogenerated": false, "ratio": 3.446945337620579, "conf...
from django import template from django.template.defaulttags import IfNode, do_if from django.template.loader import render_to_string register = template.Library() class JQueryTemplateNode(template.Node): def __init__(self, nodes, ender): self.nodes = nodes self.ender = ender ...
{ "repo_name": "allanlei/rhinocloud-utils", "path": "rhinocloud/contrib/jquery/templatetags/jqTemplating.py", "copies": "1", "size": "2310", "license": "bsd-3-clause", "hash": -1416612676398007800, "line_mean": 31.5352112676, "line_max": 120, "alpha_frac": 0.632034632, "autogenerated": false, "rat...
from django import template from django.template.defaulttags import kwarg_re from django.utils.encoding import smart_str from .. import utils register = template.Library() class ChannelURLNode(template.Node): def __init__(self, channel, view_name, args, kwargs): self.channel = channel self.view...
{ "repo_name": "reidwooten99/botbot-web", "path": "botbot/apps/bots/templatetags/channel_url.py", "copies": "4", "size": "1689", "license": "mit", "hash": 7886348490358524000, "line_mean": 28.6315789474, "line_max": 77, "alpha_frac": 0.6068679692, "autogenerated": false, "ratio": 4.04066985645933,...
from django import template from django.template.defaulttags import kwarg_re register = template.Library() class LazyURLNode(template.Node): def __init__(self, reverse, args, kwargs, asvar): self.reverse = reverse self.args = args self.kwargs = kwargs self.asvar = asvar def ...
{ "repo_name": "seanbrant/django-hort", "path": "hort/templatetags/url_tags.py", "copies": "1", "size": "1646", "license": "mit", "hash": 4227097536577357300, "line_mean": 29.4814814815, "line_max": 84, "alpha_frac": 0.5650060753, "autogenerated": false, "ratio": 4.0244498777506115, "config_test...
from django import template from django.template.defaulttags import register register = template.Library() @register.filter(name='get_language') def get_language(language_key): if(language_key == 'nb_NO'): return 'Norwegian' else: return 'English' @register.filter(name='get_status') def get_s...
{ "repo_name": "SINTEF-Infosec/Incident-Information-Sharing-Tool", "path": "incidents/templatetags/incidents_get_language.py", "copies": "1", "size": "3257", "license": "apache-2.0", "hash": 2508541912503388700, "line_mean": 34.4130434783, "line_max": 611, "alpha_frac": 0.5974823457, "autogenerated"...
from django import template from django.template.defaulttags import token_kwargs from allauth.socialaccount import providers from allauth.utils import get_request_param register = template.Library() class ProviderLoginURLNode(template.Node): def __init__(self, provider_id, params): self.provider_id_var...
{ "repo_name": "pennersr/django-allauth", "path": "allauth/socialaccount/templatetags/socialaccount.py", "copies": "2", "size": "2987", "license": "mit", "hash": 8837486745842344000, "line_mean": 30.1145833333, "line_max": 84, "alpha_frac": 0.6287244727, "autogenerated": false, "ratio": 4.08618331...
from django import template from django.template.defaulttags import url as url_tag, URLNode from django.conf import settings register = template.Library() ACTIVE_STRING = 'active' @register.tag def url_active(parser, token): try: tag_name, url_var = token.split_contents() except ValueError: ra...
{ "repo_name": "nalourie/django-urlactive-lite", "path": "urlactive/templatetags/urlactive.py", "copies": "3", "size": "1173", "license": "mit", "hash": 2414604098542895000, "line_mean": 29.0769230769, "line_max": 64, "alpha_frac": 0.589087809, "autogenerated": false, "ratio": 4.546511627906977, ...
from django import template from django.template.defaulttags import url from django.core.urlresolvers import reverse from django.conf import settings from django.template import Node, Variable, VariableDoesNotExist from django.utils.html import conditional_escape from django.utils.safestring import mark_safe register ...
{ "repo_name": "mdj2/django-arcutils", "path": "arcutils/templatetags/arc.py", "copies": "2", "size": "3407", "license": "mit", "hash": -629266617203978100, "line_mean": 31.7596153846, "line_max": 93, "alpha_frac": 0.6800704432, "autogenerated": false, "ratio": 3.8367117117117115, "config_test":...
from django import template from django.template import Context, loader from stream_django.exceptions import MissingDataException import logging logger = logging.getLogger(__name__) register = template.Library() LOG = 'warn' IGNORE = 'ignore' FAIL = 'fail' missing_data_policies = [LOG, IGNORE, FAIL] def handle_no...
{ "repo_name": "QLGu/stream-django", "path": "stream_django/templatetags/activity_tags.py", "copies": "1", "size": "1451", "license": "bsd-3-clause", "hash": -3092900657945741300, "line_mean": 29.2291666667, "line_max": 112, "alpha_frac": 0.6836664369, "autogenerated": false, "ratio": 3.7300771208...
from django import template from django.template import Context from django.core.exceptions import ObjectDoesNotExist from django.template.loader import get_template from ..models import TooltipMessage from ..settings import STATIC_URL register = template.Library() def render_tooltip(tooltip_id): try: co...
{ "repo_name": "myrjola/neverlate", "path": "django/neverlate/templatetags/tooltips.py", "copies": "1", "size": "1588", "license": "mit", "hash": 4957838799586874000, "line_mean": 27.375, "line_max": 107, "alpha_frac": 0.6769521411, "autogenerated": false, "ratio": 4.1139896373057, "config_test"...
from django import template from django.template import Context from django.template.loader import get_template from django.utils.safestring import mark_safe register = template.Library() @register.filter def lookup(dictionary, key): value = dictionary[key] return value @register.simple_tag(takes_context=T...
{ "repo_name": "LegoStormtroopr/django-data-interrogator", "path": "data_interrogator/templatetags/data_interrogator_tags.py", "copies": "1", "size": "2562", "license": "mit", "hash": -8766670465785948000, "line_mean": 31.8461538462, "line_max": 104, "alpha_frac": 0.6795472287, "autogenerated": fals...
from django import template from django.template import Context from django.template.loaders.app_directories import load_template_source import tweepy import settings from tweets.models import TwitterUsername register = template.Library() def do_recover_tweets(parser, token): try: tag_name = token.split...
{ "repo_name": "nathangeffen/tbonline-2", "path": "tbonlineproject/tweets/templatetags/recover_tweets.py", "copies": "2", "size": "2182", "license": "mit", "hash": -1436012199657640000, "line_mean": 42.64, "line_max": 111, "alpha_frac": 0.5302474794, "autogenerated": false, "ratio": 4.574423480083...
from django import template from django.template import Context from wordpress.models import Post import re register = template.Library() class PostsContextNode(template.Node): def __init__(self, queryset, var_name): self.queryset = queryset self.var_name = var_name def render(self, context)...
{ "repo_name": "michaelBenin/django-wordpress", "path": "wordpress/templatetags/wp.py", "copies": "1", "size": "1896", "license": "bsd-3-clause", "hash": -1235378342407564500, "line_mean": 26.4927536232, "line_max": 100, "alpha_frac": 0.6313291139, "autogenerated": false, "ratio": 3.61142857142857...
from django import template from django.template import Context from wordpress.models import Post import re register = template.Library() class PostsContextNode(template.Node): def __init__(self, queryset, var_name): self.queryset = queryset self.var_name = var_name def render(self, context...
{ "repo_name": "sunlightlabs/django-wordpress", "path": "wordpress/templatetags/wp.py", "copies": "1", "size": "1872", "license": "bsd-3-clause", "hash": -2551069272019488300, "line_mean": 25, "line_max": 100, "alpha_frac": 0.6394230769, "autogenerated": false, "ratio": 3.565714285714286, "confi...
from django import template from django.template import Context, Template from djangometrics.models import DjangoMetric register = template.Library() def get_for_site(context): site = context.get('site') return DjangoMetric.objects.get_for_site(site) def get_for_model(context): model = context.get('obje...
{ "repo_name": "ninjaotoko/django-metrics", "path": "djangometrics/templatetags/djangometrics_tags.py", "copies": "1", "size": "1499", "license": "bsd-3-clause", "hash": 5597933090260387000, "line_mean": 25.7678571429, "line_max": 70, "alpha_frac": 0.6764509673, "autogenerated": false, "ratio": 3....
from django import template from django.template import Context, Template from django.utils.html import escape from pages.conf import settings register = template.Library() @register.assignment_tag() def get_page_object(objects, sid): """ **Arguments** ``objects`` all objects ``sid` ...
{ "repo_name": "dlancer/django-pages-cms", "path": "pages/templatetags/pages_tags.py", "copies": "1", "size": "4855", "license": "bsd-3-clause", "hash": -5199405878357986000, "line_mean": 24.9625668449, "line_max": 96, "alpha_frac": 0.5816683831, "autogenerated": false, "ratio": 3.999176276771005,...
from django import template from django.template import Context, Template register = template.Library() @register.simple_tag(takes_context=True) def notifications(context): notifications_template = Template(""" {% for notification in notifications %} <div class="container-fluid"> ...
{ "repo_name": "Macainian/BaseDjangoProject", "path": "website/templatetags/notifications.py", "copies": "1", "size": "1175", "license": "mit", "hash": 6889577685938612000, "line_mean": 33.5588235294, "line_max": 93, "alpha_frac": 0.6085106383, "autogenerated": false, "ratio": 5.064655172413793, ...
from django import template from django.template import defaultfilters as filters from django.utils.translation import ugettext_lazy as _ # noqa from horizon import tables from horizon.utils import filters as utils_filters class ServiceFilterAction(tables.FilterAction): def filter(self, table, services, filter_...
{ "repo_name": "Havate/havate-openstack", "path": "proto-build/gui/horizon/Horizon_GUI/openstack_dashboard/dashboards/admin/info/tables.py", "copies": "4", "size": "6306", "license": "apache-2.0", "hash": 8256311190105911000, "line_mean": 31.6735751295, "line_max": 79, "alpha_frac": 0.5719949255, "a...
from django import template from django.template import defaultfilters from django.utils.translation import ungettext register = template.Library() # A tuple of standard large number to their converters intword_converters = ( (0, lambda x: x), (3, lambda x: ungettext('%(value)s thousand', '%(value)s thousands...
{ "repo_name": "jorgecarleitao/public-contracts", "path": "contracts/templatetags/contracts/humanize.py", "copies": "1", "size": "1646", "license": "bsd-3-clause", "hash": 7884729361744115000, "line_mean": 34.0212765957, "line_max": 78, "alpha_frac": 0.6506682868, "autogenerated": false, "ratio": ...
from django import template from django.template import defaultfilters register = template.Library() @register.filter(is_safe=True) @defaultfilters.stringfilter def renderimages(value, model): """ Convert or render image tokens ([image XYZ]) into images. """ from os import path from django impo...
{ "repo_name": "megaprojectske/megaprojects.co.ke", "path": "megaprojects/core/templatetags/core_tags.py", "copies": "1", "size": "1574", "license": "apache-2.0", "hash": -1606323783018285800, "line_mean": 22.4925373134, "line_max": 157, "alpha_frac": 0.6778907243, "autogenerated": false, "ratio":...
from django import template from django.template import defaulttags from django.template.base import Node from django.templatetags.static import do_static register = template.Library() @register.tag def fullurl(parser, token): """Return an absolute URL (including the scheme and domain) matching the given view...
{ "repo_name": "Flimm/django-fullurl", "path": "fullurl/templatetags/fullurl.py", "copies": "1", "size": "1889", "license": "mit", "hash": -6652316856960820000, "line_mean": 24.1866666667, "line_max": 78, "alpha_frac": 0.6850185283, "autogenerated": false, "ratio": 4.088744588744588, "config_tes...
from django import template from django.template import defaulttags from django.template.defaulttags import URLNode from django.utils.text import unescape_string_literal register = template.Library() esi_tmpl = '<esi:include src="%s" />' class EsiTemplateTagError(Exception): pass class EsiNode(URLNode): def...
{ "repo_name": "armstrong/armstrong.esi", "path": "armstrong/esi/templatetags/esi.py", "copies": "1", "size": "1842", "license": "bsd-3-clause", "hash": 4434885527548865000, "line_mean": 33.1111111111, "line_max": 119, "alpha_frac": 0.6058631922, "autogenerated": false, "ratio": 3.902542372881356,...
from django import template from django.template import Library from django.template import RequestContext from django.template import resolve_variable from django.utils.safestring import SafeString from django.conf import settings register = Library() INCLUDE_TEMPLATE = """ <script src="http://maps.google.com/maps?f...
{ "repo_name": "itavor/itavor_lib", "path": "itavor_lib/templatetags/google_maps.py", "copies": "1", "size": "3372", "license": "bsd-3-clause", "hash": 5189926651879353000, "line_mean": 31.7378640777, "line_max": 257, "alpha_frac": 0.5800711744, "autogenerated": false, "ratio": 3.742508324084351, ...
from django import template from django.template import Library from django.template import resolve_variable GOOGLE_MAPS_API_KEY = { "site1":"XXXXXAApNC8VraKxjnpTrC4pax3IRQTfsoMw3qz_e-LauZzPBIws5p_nhSKlQQunTrdkST45GbLxANehi-oSQ", "site2":"FFSDFGSDFGSDFGSDFGrC4pax3IRSA7oaebcwS_GFScocy27dna4926BSle32YWjKmaH2Q-oF...
{ "repo_name": "fatihzkaratana/intranet", "path": "backend/cmsutils/templatetags/googlemap.py", "copies": "3", "size": "3667", "license": "apache-2.0", "hash": -9097086078404402000, "line_mean": 32.3363636364, "line_max": 277, "alpha_frac": 0.5920370875, "autogenerated": false, "ratio": 3.31555153...
from django import template from django.template import Library from django.template import resolve_variable register = Library() BASIC_TEMPLATE = """<img id="%(id)s" src="%(url)s" width="%(width)spx" height="%(height)spx" class="%(css)s" />""" URL_TEMPLATE = "http://maps.google.com/staticmap?center=%(latitude)s,%(l...
{ "repo_name": "fatihzkaratana/intranet", "path": "backend/cmsutils/templatetags/staticgooglemap.py", "copies": "3", "size": "3040", "license": "apache-2.0", "hash": -6611446450182248000, "line_mean": 33.5454545455, "line_max": 214, "alpha_frac": 0.5171052632, "autogenerated": false, "ratio": 3.66...
from django import template from django.template import Library from django.template import TemplateSyntaxError, VariableDoesNotExist register = Library() @register.filter def min_value(object_list, field): """ Returns the min value given an object_list and a field. Example: {{ forecast|min:"hig...
{ "repo_name": "emorozov/django-basic-apps", "path": "basic/tools/templatetags/mathutils.py", "copies": "12", "size": "2515", "license": "bsd-3-clause", "hash": -2200643909849865000, "line_mean": 30.835443038, "line_max": 84, "alpha_frac": 0.6170974155, "autogenerated": false, "ratio": 4.004777070...
from django import template from django.template import Library from django.utils import six from django.utils.safestring import mark_safe from xadmin.util import static, vendor as util_vendor register = Library() @register.simple_tag(takes_context=True) def view_block(context, block_name, *args, **kwargs): if '...
{ "repo_name": "jinjin123/devops2.0", "path": "devops/xadmin/templatetags/xadmin_tags.py", "copies": "11", "size": "1951", "license": "mit", "hash": 7424324986638762000, "line_mean": 29.0153846154, "line_max": 91, "alpha_frac": 0.6678626345, "autogenerated": false, "ratio": 3.7020872865275143, "...
from django import template from django.template import Library from django.utils.safestring import mark_safe from xadmin.util import static, vendor as util_vendor register = Library() @register.simple_tag(takes_context=True) def view_block(context, block_name, *args, **kwargs): if 'admin_view' not in context: ...
{ "repo_name": "f1aky/xadmin", "path": "xadmin/templatetags/xadmin_tags.py", "copies": "9", "size": "1879", "license": "bsd-3-clause", "hash": -8396020492094003000, "line_mean": 28.8412698413, "line_max": 91, "alpha_frac": 0.6641830761, "autogenerated": false, "ratio": 3.6988188976377954, "confi...
from django import template from django.template import Library, Node, Context, loader, resolve_variable from django.template.defaultfilters import date from django.utils.html import escape from datetime import datetime import environment register = Library() # STOLEN FROM Django 1.0 _base_js_escapes = ( ('\\',...
{ "repo_name": "taylorhughes/done-zo", "path": "dnzo/templating/templating.py", "copies": "1", "size": "3551", "license": "mit", "hash": 2729579437203312000, "line_mean": 27.6370967742, "line_max": 103, "alpha_frac": 0.6612221909, "autogenerated": false, "ratio": 3.4711632453567938, "config_test...
from django import template from django.template import Library, Node from django.contrib.sites.models import Site from django.utils.encoding import smart_str import myblog register = Library() class VarNode(Node): def __init__(self, var_name, var_to_resolve): self.var_name = var_name self.var_to...
{ "repo_name": "wahaha02/myblog", "path": "blog/templatetags/utils.py", "copies": "1", "size": "4761", "license": "bsd-3-clause", "hash": 1273559372056200400, "line_mean": 33.0071428571, "line_max": 77, "alpha_frac": 0.5660575509, "autogenerated": false, "ratio": 4.158078602620088, "config_test"...
from django import template from django.template import Library, Node, TemplateSyntaxError from django.template.base import Template from django.utils.safestring import mark_safe register = template.Library() @register.filter() def softwraphtml(value, max_line_length=20): import re whitespace_re = re.compile(...
{ "repo_name": "Laimiux/mydeatree", "path": "pagination/templatetags/pagination.py", "copies": "1", "size": "2475", "license": "bsd-3-clause", "hash": 1656832716160584000, "line_mean": 29.9375, "line_max": 85, "alpha_frac": 0.5838383838, "autogenerated": false, "ratio": 4.004854368932039, "confi...
from django import template from django.template import Library, Node, Variable from attachments.forms import AttachmentForm from attachments.views import add_url_for_obj from django.core.urlresolvers import reverse from django.contrib.contenttypes.models import ContentType from attachments.models import Attachment fro...
{ "repo_name": "leotrubach/django-attachments", "path": "attachments/templatetags/attachments_tags.py", "copies": "1", "size": "8455", "license": "bsd-3-clause", "hash": -466145937276971900, "line_mean": 33.2348178138, "line_max": 95, "alpha_frac": 0.6002365464, "autogenerated": false, "ratio": 4....
from django import template from django.template import loader, Context from django.template.base import Template from djara.django.menus.models import GlobalMenu register = template.Library() def show_global_menu(context, menu_template='djara/django/menus/simple_menu.html'): """ """ request = context[...
{ "repo_name": "saeschdivara/ArangoDjango", "path": "djara/django/menus/templatetags/menu_tags.py", "copies": "1", "size": "4531", "license": "mit", "hash": -4627435385349318000, "line_mean": 29.8299319728, "line_max": 105, "alpha_frac": 0.61686162, "autogenerated": false, "ratio": 4.2188081936685...
from django import template from django.template import loader, Context register = template.Library() @register.simple_tag def semantic_header( content, icon=None, inverted=False, divider=False, level=1, ): """ A simple tag that outputs a ...
{ "repo_name": "gpichot/django-semantic-ui", "path": "semantic_ui/templatetags/semantic_ui.py", "copies": "1", "size": "1475", "license": "mit", "hash": -2121547362787487500, "line_mean": 22.7903225806, "line_max": 80, "alpha_frac": 0.5986440678, "autogenerated": false, "ratio": 3.8713910761154855...
from django import template from django.template import loader from django.template.base import TemplateSyntaxError from django.utils.safestring import mark_safe from ..models import SimpleChart, ChartCell DEFAULT_CHART_NAME = "simple_chart" register = template.Library() # top stuff is directly from armstrong lay...
{ "repo_name": "texastribune/the-dp", "path": "tx_highered/instachart/templatetags/instachart.py", "copies": "1", "size": "2043", "license": "apache-2.0", "hash": 8435905126461849000, "line_mean": 30.921875, "line_max": 89, "alpha_frac": 0.6421928536, "autogenerated": false, "ratio": 3.81869158878...
from django import template from django.template import loader, Node, Variable from django.utils.encoding import smart_str, smart_unicode from django.template.defaulttags import url from django.template import VariableDoesNotExist register = template.Library() def render_title(title, context): # Strip any outer q...
{ "repo_name": "instituteofdesign/django-lms", "path": "libs/templatetags/breadcrumbs.py", "copies": "1", "size": "2893", "license": "bsd-3-clause", "hash": 8741197005318702000, "line_mean": 25.7962962963, "line_max": 91, "alpha_frac": 0.6073280332, "autogenerated": false, "ratio": 3.7866492146596...
from django import template from django.template import loader, TemplateDoesNotExist from django.template.loader import template_source_loaders from djinja2.loaders import Jinja2Loader register = template.Library() class JinjaTemplateNode(template.Node): def __init__(self, template_name): self.template_n...
{ "repo_name": "comoga/django-djinja2", "path": "djinja2/templatetags/include_jinja.py", "copies": "1", "size": "1554", "license": "bsd-3-clause", "hash": -6620839566762028000, "line_mean": 35.1395348837, "line_max": 90, "alpha_frac": 0.6325611326, "autogenerated": false, "ratio": 4.53061224489795...
from django import template from django.template import NodeList from django.template import Variable from django.contrib.auth.models import Group register = template.Library() class GroupCheckNode(template.Node): def __init__(self, groups, nodelist_true, nodelist_false): self.groups = groups self...
{ "repo_name": "carthagecollege/django-djtools", "path": "djtools/templatetags/ifusergroup.py", "copies": "1", "size": "2587", "license": "unlicense", "hash": -953959116889460900, "line_mean": 32.1666666667, "line_max": 104, "alpha_frac": 0.6037881716, "autogenerated": false, "ratio": 4.5069686411...
from django import template from django.template import NodeList from functools import wraps import inspect, logging, sys from portal.models import Institution, Course, Discipline, RelUserInstitution, UserInstitutionRole, RelUserCourse, UserCourseRole, RelUserDiscipline, UserDisciplineRole def condition_tag(func): ...
{ "repo_name": "brunogamacatao/portalsaladeaula", "path": "portal/templatetags/security.py", "copies": "1", "size": "6832", "license": "bsd-3-clause", "hash": -8440274833031063000, "line_mean": 39.9161676647, "line_max": 184, "alpha_frac": 0.618706089, "autogenerated": false, "ratio": 4.2120838471...
from django import template from django.template import NodeList from featureflipper.models import Feature register = template.Library() @register.tag def feature(parser, token): try: tag_name, feature = token.split_contents() except ValueError: raise template.TemplateSyntaxError, \ ...
{ "repo_name": "tobych/django-feature-flipper", "path": "featureflipper/templatetags/feature_tag.py", "copies": "1", "size": "1196", "license": "apache-2.0", "hash": 544629690030941250, "line_mean": 26.8139534884, "line_max": 71, "alpha_frac": 0.6755852843, "autogenerated": false, "ratio": 4.27142...
from django import template from django.template import NodeList from gollahalli_cms.editor.models import ContentModel register = template.Library() @register.tag(name='contentmodelexist') def check_model_exists(parser, token): """ Checks if any data available in ContentModel. ... {% contentmodelexist ...
{ "repo_name": "akshaybabloo/gollahalli-com", "path": "gollahalli_cms/editor/templatetags/model_tags.py", "copies": "1", "size": "1573", "license": "mit", "hash": 48196233844935540, "line_mean": 25.6610169492, "line_max": 110, "alpha_frac": 0.6033057851, "autogenerated": false, "ratio": 4.40616246...
from django import template from django.template import Node from django.apps import apps from django.contrib.sites.models import Site register = template.Library() # TODO: add order_by # or assume since this is about generic pulling of content, template designer can use template tags to manipulate class ModelObjects...
{ "repo_name": "3atmospheres/django-simple-cms", "path": "simple_cms/contrib/templatetags/awesome_tags.py", "copies": "1", "size": "6372", "license": "mit", "hash": -4387143715857159000, "line_mean": 31.1818181818, "line_max": 113, "alpha_frac": 0.5596359071, "autogenerated": false, "ratio": 3.904...
from django import template from django.template import Node from django.contrib.sites.models import Site from django.contrib.contenttypes.models import ContentType from django.conf import settings from simple_cms.models import Navigation, Block, Article, Category from simple_cms.forms import ArticleSearchForm regist...
{ "repo_name": "charlesmastin/django-simple-cms", "path": "simple_cms/templatetags/simple_cms_tags.py", "copies": "1", "size": "5550", "license": "mit", "hash": 5879989247271714000, "line_mean": 34.1265822785, "line_max": 107, "alpha_frac": 0.610990991, "autogenerated": false, "ratio": 4.176072234...
from django import template from django.template import Node from django.db.models import get_model from django.contrib.sites.models import Site register = template.Library() # TODO: add order_by # or assume since this is about generic pulling of content, template designer can use template tags to manipulate class Mo...
{ "repo_name": "charlesmastin/django-simple-cms", "path": "simple_cms/contrib/templatetags/awesome_tags.py", "copies": "1", "size": "6384", "license": "mit", "hash": 2218883126861043500, "line_mean": 31.4111675127, "line_max": 113, "alpha_frac": 0.5595238095, "autogenerated": false, "ratio": 3.883...
from django import template from django.template import Node from vcms.www.models.page import BasicPage as Page register = template.Library() @register.inclusion_tag('admin/www/page/page_table.html') def show_menu_table(lang='en'): menu_list = Page.objects.get_RootMenu() submenu_list = Page.objects.filter(lev...
{ "repo_name": "francisl/vcms", "path": "modules/vcms/www/templatetags/admin_extras.py", "copies": "1", "size": "3392", "license": "bsd-3-clause", "hash": -524043273976872700, "line_mean": 36.2747252747, "line_max": 187, "alpha_frac": 0.6291273585, "autogenerated": false, "ratio": 3.89437428243398...
from django import template from django.template import Node from django.conf import settings import random register = template.Library() def var_tag_compiler(params, defaults, name, node_class, parser, token): "Returns a template.Node subclass." bits = token.split_contents()[1:] return node_class(map(pa...
{ "repo_name": "linkedin/indextank-service", "path": "storefront/templatetags/custom_tags.py", "copies": "1", "size": "2042", "license": "apache-2.0", "hash": 8103231341133592000, "line_mean": 28.1714285714, "line_max": 141, "alpha_frac": 0.652791381, "autogenerated": false, "ratio": 3.34754098360...
from django import template from django.template import Node from django.conf import settings register = template.Library() @register.filter(name='fdivide') def fdivide(value,arg): return float(value) / float(arg) @register.filter(name='fmultiply') def fmultiply(value,arg): return float(value) * float(arg) ...
{ "repo_name": "linkedin/indextank-service", "path": "backoffice/templatetags/custom_tags.py", "copies": "1", "size": "1646", "license": "apache-2.0", "hash": 6707357907987992000, "line_mean": 28.3928571429, "line_max": 134, "alpha_frac": 0.6682867558, "autogenerated": false, "ratio": 3.4725738396...