text stringlengths 0 1.05M | meta dict |
|---|---|
from django.template import Library
from django.utils.html import format_html
from django.utils.safestring import mark_safe
from django.contrib.admin.options import TO_FIELD_VAR
from treebeard.templatetags import needs_checkboxes
register = Library()
CHECKBOX_TMPL = ('<input type="checkbox" class="action-select" val... | {
"repo_name": "django-treebeard/django-treebeard",
"path": "treebeard/templatetags/admin_tree_list.py",
"copies": "2",
"size": "1625",
"license": "apache-2.0",
"hash": 7024265785113599000,
"line_mean": 33.5744680851,
"line_max": 79,
"alpha_frac": 0.6221538462,
"autogenerated": false,
"ratio": 3.5... |
from django.template import Library
from django.utils.http import urlencode
register = Library()
@register.simple_tag(takes_context=True)
def get_sort_by_url(context, field, descending=False):
request = context['request']
request_get = request.GET.dict()
if descending:
request_get['sort_by'] = '-... | {
"repo_name": "UITools/saleor",
"path": "saleor/core/templatetags/shop.py",
"copies": "1",
"size": "1051",
"license": "bsd-3-clause",
"hash": -4594592009938733600,
"line_mean": 27.4054054054,
"line_max": 60,
"alpha_frac": 0.6764985728,
"autogenerated": false,
"ratio": 3.480132450331126,
"config... |
from django.template import Library
from django.utils import simplejson as json
from ..forms import ReportForm
from ..models import Report
register = Library()
@register.inclusion_tag('lint/tags/report_create_form.html', takes_context=True)
def report_create_form(context):
report_pk = context.get('report_pk')
... | {
"repo_name": "beni55/djangolint",
"path": "project/lint/templatetags/lint.py",
"copies": "2",
"size": "1246",
"license": "isc",
"hash": -2450747940816125000,
"line_mean": 29.3902439024,
"line_max": 80,
"alpha_frac": 0.6099518459,
"autogenerated": false,
"ratio": 3.7417417417417416,
"config_tes... |
from django.template import Library
from django.utils.safestring import mark_safe
from django.utils.functional import memoize
register = Library()
def and_n_others(values, limit):
# type: (List[str], int) -> str
# A helper for the commonly appended "and N other(s)" string, with
# the appropriate pluraliza... | {
"repo_name": "ahmadassaf/zulip",
"path": "zerver/templatetags/app_filters.py",
"copies": "5",
"size": "2096",
"license": "apache-2.0",
"hash": 5758667357960261000,
"line_mean": 34.5254237288,
"line_max": 75,
"alpha_frac": 0.6230916031,
"autogenerated": false,
"ratio": 3.510887772194305,
"confi... |
from django.template import Library
from django.utils.safestring import mark_safe
from django.utils.safestring import SafeString, SafeUnicode
from django.conf import settings
from django.utils.encoding import smart_str
from bambu_attachments import ATTACHMENT_REGEX
from bambu_attachments.models import Attachment
from s... | {
"repo_name": "iamsteadman/bambu-attachments",
"path": "bambu_attachments/templatetags/attachments.py",
"copies": "1",
"size": "2702",
"license": "apache-2.0",
"hash": -5178656445507533000,
"line_mean": 31.9634146341,
"line_max": 104,
"alpha_frac": 0.5040710585,
"autogenerated": false,
"ratio": 4... |
from django.template import Library
from django.utils.safestring import mark_safe
from docutils import nodes
from docutils.writers import html4css1
from docutils.core import publish_parts
from docutils.parsers.rst import directives
from pygments import highlight
from pygments.formatters import HtmlFormatter
from py... | {
"repo_name": "dwillis/fumblerooski",
"path": "blog/templatetags/blog_utils.py",
"copies": "3",
"size": "1929",
"license": "bsd-3-clause",
"hash": 2325603802490640000,
"line_mean": 32.275862069,
"line_max": 83,
"alpha_frac": 0.6920684292,
"autogenerated": false,
"ratio": 3.8502994011976046,
"co... |
from django.template import Library
from django.utils.safestring import mark_safe
register = Library()
@register.simple_tag
def field_value(instance, name):
"""
Tag to retrieve the value of a field from a model instance
given its (field's) name.
Parameters:
instance - the model's instance
... | {
"repo_name": "harikvpy/crud",
"path": "singleurlcrud/templatetags/crud_tags.py",
"copies": "1",
"size": "2668",
"license": "bsd-3-clause",
"hash": -416522951440819100,
"line_mean": 29.6666666667,
"line_max": 89,
"alpha_frac": 0.6727886057,
"autogenerated": false,
"ratio": 3.894890510948905,
"c... |
from django.template import Library
from django.utils.safestring import mark_safe
register = Library()
from django.contrib.admin.views.main import PAGE_VAR
from django.utils.html import format_html
from django.utils.translation import ugettext as _
from django.contrib.admin.templatetags.admin_list import (
result... | {
"repo_name": "taedori81/wagtailmodeladmin",
"path": "wagtailmodeladmin/templatetags/wagtailmodeladmin_tags.py",
"copies": "2",
"size": "2829",
"license": "mit",
"hash": -7278406597446438000,
"line_mean": 28.7789473684,
"line_max": 93,
"alpha_frac": 0.6496995405,
"autogenerated": false,
"ratio": ... |
from django.template import Library
from django.utils.six import string_types
from collections import Iterable
from pprint import pprint
import itertools
register = Library()
"""
Template debug tools borrowed from https://github.com/calebsmith/django-template-debug.
"""
@register.simple_tag(takes_context=True)
def ... | {
"repo_name": "DylanMcCall/stuartmccall.ca",
"path": "common/templatetags/debug_tools.py",
"copies": "1",
"size": "1456",
"license": "mit",
"hash": -9077667033225089000,
"line_mean": 27.5490196078,
"line_max": 87,
"alpha_frac": 0.6710164835,
"autogenerated": false,
"ratio": 4.124645892351275,
"... |
from django.template import Library
from django.utils.translation import ugettext as _
import calendar
from intranet import models
import locale
locale.setlocale(locale.LC_ALL, 'es_ES.UTF-8')
register = Library()
@register.filter
def sum(parts, project):
sum = 0
sum_raw = 0
sum_chargeability = 0
sum_... | {
"repo_name": "fatihzkaratana/intranet",
"path": "backend/intranet/templatetags/intranet_helper.py",
"copies": "2",
"size": "1763",
"license": "apache-2.0",
"hash": -6378146561610998000,
"line_mean": 19.7411764706,
"line_max": 66,
"alpha_frac": 0.6931366988,
"autogenerated": false,
"ratio": 3.283... |
from django.template import Library
from django.utils.translation import ugettext_lazy as _
from django.utils.html import format_html
from django.utils.safestring import mark_safe
from django.contrib.admin.views.main import PAGE_VAR
register = Library()
@register.simple_tag
def paginator_number(cl,i):
"""
Gene... | {
"repo_name": "Scholr/scholr-admin",
"path": "scholradmin/templatetags/admin_tags.py",
"copies": "2",
"size": "1594",
"license": "bsd-3-clause",
"hash": 1409024370006252000,
"line_mean": 36.9761904762,
"line_max": 100,
"alpha_frac": 0.5922208281,
"autogenerated": false,
"ratio": 3.391489361702128... |
from django.template import Library
from djflow.runtime.models import WorkItem
register = Library()
def mywork(user):
'''
Display the worklist of a user as a table.
The template *djflow/workitems.html* is used for rendering.
Usage::
{% mywork user %}
settings required::
MID... | {
"repo_name": "glasslion/djflow",
"path": "djflow/runtime/templatetags/work_lib.py",
"copies": "1",
"size": "1088",
"license": "bsd-3-clause",
"hash": 5143477975190998000,
"line_mean": 25.5365853659,
"line_max": 75,
"alpha_frac": 0.6056985294,
"autogenerated": false,
"ratio": 4.283464566929134,
... |
from django.template import Library
from exile import models
register = Library()
@register.filter(name="items_tag")
def ordenItem(menu):
return menu.items.all().order_by('ordenitem__posicion')
# end def
@register.filter(name="subitems_tag")
def ordenSubItem(item, seccion):
if seccion:
return item.s... | {
"repo_name": "exildev/webpage",
"path": "exile/templatetags/menu_filter.py",
"copies": "1",
"size": "1788",
"license": "mit",
"hash": -1166186343487964400,
"line_mean": 24.9130434783,
"line_max": 107,
"alpha_frac": 0.6711409396,
"autogenerated": false,
"ratio": 3.147887323943662,
"config_test"... |
from django.template import Library
from goflow.runtime.models import WorkItem
register = Library()
def mywork(user):
'''
Display the worklist of a user as a table.
The template *goflow/workitems.html* is used for rendering.
Usage::
{% mywork user %}
settings required::
MID... | {
"repo_name": "mikewolfli/django-goflow",
"path": "goflow/runtime/templatetags/work_lib.py",
"copies": "1",
"size": "1088",
"license": "bsd-3-clause",
"hash": 2959405041277405000,
"line_mean": 25.5365853659,
"line_max": 75,
"alpha_frac": 0.6056985294,
"autogenerated": false,
"ratio": 4.2334630350... |
from django.template import Library
from nadmin.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:
return ""
admin_view = context['admin_view']
nodes = []
... | {
"repo_name": "A425/django-nadmin",
"path": "nadmin/templatetags/nadmin_tags.py",
"copies": "1",
"size": "1046",
"license": "mit",
"hash": 4843186507733348000,
"line_mean": 27.2702702703,
"line_max": 79,
"alpha_frac": 0.6434034417,
"autogenerated": false,
"ratio": 3.4983277591973243,
"config_te... |
from django.template import Library
from natural import data, date, number, text, size, file
register = Library()
# natural.data
@register.filter
def printable(value):
'''Wrapper for :func:`natural.data.printable`'''
return data.printable(value)
@register.filter
def sparkline(value):
'''Wrapper for :f... | {
"repo_name": "tehmaze/natural",
"path": "natural/templatetags/naturalise.py",
"copies": "1",
"size": "3571",
"license": "mit",
"hash": -6692392473491198000,
"line_mean": 21.31875,
"line_max": 56,
"alpha_frac": 0.691683002,
"autogenerated": false,
"ratio": 3.4139579349904396,
"config_test": fal... |
from django.template import Library
from signbank.dictionary.forms import GlossSearchForm, MorphemeSearchForm
from signbank.tools import get_default_annotationidglosstranslation
import json
register = Library()
@register.filter
def get_annotation_idgloss_translation(gloss, language):
annotationidglosstranslation... | {
"repo_name": "Signbank/NGT-signbank",
"path": "signbank/dictionary/templatetags/annotation_idgloss_translation.py",
"copies": "1",
"size": "5412",
"license": "bsd-3-clause",
"hash": -769104227822892000,
"line_mean": 32.6149068323,
"line_max": 119,
"alpha_frac": 0.715631929,
"autogenerated": false,... |
from django.template import Library
from signbank.dictionary.models import FieldChoice, Dataset
def get_field_choice(machine_value,field_category):
if machine_value == '' or machine_value in [None,'None']:
return '-'
elif machine_value == '0' or machine_value == 0:
return '-'
elif machine_... | {
"repo_name": "Signbank/NGT-signbank",
"path": "signbank/dictionary/templatetags/field_choice.py",
"copies": "2",
"size": "2362",
"license": "bsd-3-clause",
"hash": -4634018502998720000,
"line_mean": 30.0789473684,
"line_max": 110,
"alpha_frac": 0.6985605419,
"autogenerated": false,
"ratio": 3.82... |
from django.template import Library
from tag_parser.basetags import BaseNode, BaseInclusionNode
register = Library()
@register.tag('BaseNoArgsTag')
class BaseNoArgsTag(BaseNode):
pass
@register.tag('BaseAnyArgsTag')
class BaseAnyArgsTag(BaseNode):
allowed_kwargs = None # disable check
@register.tag('Bas... | {
"repo_name": "steventimberman/masterDebater",
"path": "venv/lib/python2.7/site-packages/tag_parser/tests/templatetags/tag_parser_test_tags.py",
"copies": "1",
"size": "1050",
"license": "mit",
"hash": -867720674828293500,
"line_mean": 23.4186046512,
"line_max": 83,
"alpha_frac": 0.619047619,
"auto... |
from django.template import Library
from urlparse import urlparse, parse_qsl
from urllib import urlencode
register = Library()
@register.inclusion_tag("forms/filters.html")
def filters(filtro, action="", name=None, ajax_container=None):
if name == None:
name = "fil"
return {"action": action, "filtr... | {
"repo_name": "jpardobl/naman",
"path": "naman/web/templatetags/forms.py",
"copies": "1",
"size": "2720",
"license": "bsd-3-clause",
"hash": -7209642766867575000,
"line_mean": 27.0412371134,
"line_max": 114,
"alpha_frac": 0.6345588235,
"autogenerated": false,
"ratio": 3.3705080545229245,
"confi... |
from django.template import Library
from wagtail.core.models import Page
from wagtailmenus.conf import constants, settings
from wagtailmenus.errors import SubMenuUsageError
from wagtailmenus.utils.misc import validate_supplied_values
register = Library()
def split_if_string(val, separator=','):
if isinstance(va... | {
"repo_name": "ababic/wagtailmenus",
"path": "wagtailmenus/templatetags/menu_tags.py",
"copies": "2",
"size": "6648",
"license": "mit",
"hash": 3533197156655894500,
"line_mean": 33.9894736842,
"line_max": 93,
"alpha_frac": 0.6868231047,
"autogenerated": false,
"ratio": 3.4625,
"config_test": fa... |
from django.template import Library
from xadmin.util import static, vendor as util_vendor
import sys
if sys.version_info[0] == 3:
unicode = str
register = Library()
@register.simple_tag(takes_context=True)
def view_block(context, block_name, *args, **kwargs):
if 'admin_view' not in context:
return "... | {
"repo_name": "cupen/django-xadmin",
"path": "xadmin/templatetags/xadmin_tags.py",
"copies": "1",
"size": "1105",
"license": "bsd-3-clause",
"hash": 279179519864187400,
"line_mean": 25.9512195122,
"line_max": 79,
"alpha_frac": 0.6425339367,
"autogenerated": false,
"ratio": 3.453125,
"config_tes... |
from django.template import Library
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:
return ""
admin_view = context['admin_view']
nodes = []
... | {
"repo_name": "ly0/xxadmin",
"path": "xadmin/templatetags/xadmin_tags.py",
"copies": "1",
"size": "1039",
"license": "bsd-3-clause",
"hash": -5816716335873759000,
"line_mean": 27.0810810811,
"line_max": 79,
"alpha_frac": 0.6410009625,
"autogenerated": false,
"ratio": 3.4865771812080535,
"config... |
from django.template import Library
import contextlib
register = Library()
@register.filter(name='get_range')
def get_range(value, startidx=0):
"""
Filter - returns a list containing range made from given value
Usage (in template):
<ul>{% for i in 3|get_range %}
<li>{{ i }}. Do some... | {
"repo_name": "dmartin35/pronosfoot",
"path": "season/templatetags/generic_tags.py",
"copies": "1",
"size": "6844",
"license": "mit",
"hash": 1769371552974744300,
"line_mean": 25.3230769231,
"line_max": 68,
"alpha_frac": 0.6014026885,
"autogenerated": false,
"ratio": 3.388118811881188,
"config_... |
from django.template import Library
import locale
from django.core.urlresolvers import reverse
from django.utils.timesince import timeuntil
from django.template.defaultfilters import title as format_title, capfirst
from ideahub.apps.home.models import Rating
locale.setlocale(locale.LC_ALL, '')
register = Library()
d... | {
"repo_name": "dylanseago/IdeaHub",
"path": "ideahub/apps/home/templatetags/custom_tags.py",
"copies": "1",
"size": "3706",
"license": "mit",
"hash": -6041635374846126000,
"line_mean": 26.4518518519,
"line_max": 118,
"alpha_frac": 0.5966001079,
"autogenerated": false,
"ratio": 3.7624365482233504,... |
from django.template import Library
import locale
from django.core.urlresolvers import reverse
from django.utils.timesince import timeuntil
locale.setlocale(locale.LC_ALL, '')
register = Library()
def get_next_param(context):
request = context['request']
if 'next' in request.GET:
next_param = request... | {
"repo_name": "dylanseago/CommunityFund",
"path": "server/communityfund/apps/home/templatetags/custom_tags.py",
"copies": "1",
"size": "2240",
"license": "apache-2.0",
"hash": 837160425062725500,
"line_mean": 22.5894736842,
"line_max": 86,
"alpha_frac": 0.5982142857,
"autogenerated": false,
"rati... |
from django.template import Library
import math
import re
register = Library()
# The templatetag below is copied from sorl.thumbnail
filesize_formats = ['k', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y']
filesize_long_formats = {
'k': 'kilo', 'M': 'mega', 'G': 'giga', 'T': 'tera', 'P': 'peta',
'E': 'exa', 'Z': 'zetta',... | {
"repo_name": "FinalAngel/django-filer",
"path": "filer/templatetags/filer_tags.py",
"copies": "4",
"size": "3544",
"license": "mit",
"hash": -3107501283599950300,
"line_mean": 33.4077669903,
"line_max": 79,
"alpha_frac": 0.5533295711,
"autogenerated": false,
"ratio": 3.683991683991684,
"config... |
from django.template import Library
import math
import re
RE_SIZE = re.compile(r'(\d+)x(\d+)$')
register = Library()
def _recalculate_size(size, index, divisor=0, padding=0, keep_aspect_ratio=False):
new_one = size[index]
if divisor:
new_one = new_one / float(divisor)
if padding:
new_one ... | {
"repo_name": "ionelmc/django-filer",
"path": "filer/templatetags/filer_image_tags.py",
"copies": "4",
"size": "3015",
"license": "mit",
"hash": -8007400432465218000,
"line_mean": 31.7826086957,
"line_max": 82,
"alpha_frac": 0.6467661692,
"autogenerated": false,
"ratio": 3.302300109529025,
"con... |
from django.template import Library
import re
SIZE_RE = re.compile('\d+x\d+')
register = Library()
def filer_staticmedia_prefix():
"""
Returns the string contained in the setting FILER_STATICMEDIA_PREFIX.
"""
try:
from filer import settings
except ImportError:
return ''
return... | {
"repo_name": "yml/django-filer",
"path": "filer/templatetags/filermedia.py",
"copies": "1",
"size": "2161",
"license": "mit",
"hash": -4673419598343975000,
"line_mean": 27.8266666667,
"line_max": 92,
"alpha_frac": 0.6603424341,
"autogenerated": false,
"ratio": 3.299236641221374,
"config_test":... |
from django.template import Library
from django_bitly.models import Bittle
from django_bitly.exceptions import BittleException
import urllib
register = Library()
@register.filter
def bitlify(value):
"""
Gets or create a Bittle object for the passed object. If unable to get
Bittle and/or create bit.ly, ... | {
"repo_name": "TwigWorld/django-bitly",
"path": "django_bitly/templatetags/bitly.py",
"copies": "1",
"size": "2616",
"license": "bsd-3-clause",
"hash": -1845947985375781600,
"line_mean": 25.16,
"line_max": 85,
"alpha_frac": 0.5760703364,
"autogenerated": false,
"ratio": 3.791304347826087,
"conf... |
from django.template import Library
from django.contrib.admin.templatetags.admin_list import (result_hidden_fields, ResultList, items_for_result,
result_headers)
from django.db.models.fields import FieldDoesNotExist
from django_mongoengine.forms.utils import p... | {
"repo_name": "unixhot/opencmdb",
"path": "django_mongoengine/mongo_admin/templatetags/documenttags.py",
"copies": "2",
"size": "2214",
"license": "apache-2.0",
"hash": -1069084826514123900,
"line_mean": 35.9,
"line_max": 109,
"alpha_frac": 0.6481481481,
"autogenerated": false,
"ratio": 4.1,
"c... |
from django.template import Library
from django.utils.text import slugify
from django.template.loader import get_template
from django.utils.safestring import mark_safe
register = Library()
"""
sticky_navbar = True|False
top_menu = True|False
left_menu = True|False
actions_on_sidebar = True|False
actions_on_bottom... | {
"repo_name": "commite/django-foundation-admin",
"path": "foundation_admin/templatetags/foundation_admin.py",
"copies": "1",
"size": "3775",
"license": "apache-2.0",
"hash": -2143629563427070000,
"line_mean": 26.1582733813,
"line_max": 87,
"alpha_frac": 0.6328476821,
"autogenerated": false,
"rati... |
from django.template import Library
from ..html.builders import build_link
register = Library()
@register.filter
def get_absolute_url_link(obj, text=None):
"""Gets the absolute url html link for the object.
Usage:
{{ obj|get_absolute_url_link:"Some Text" }}
Would return:
u'<a href="{{ THE O... | {
"repo_name": "InfoAgeTech/django-core",
"path": "django_core/templatetags/url_tags.py",
"copies": "1",
"size": "1859",
"license": "mit",
"hash": 7876861667232786000,
"line_mean": 23.4605263158,
"line_max": 77,
"alpha_frac": 0.6514254976,
"autogenerated": false,
"ratio": 3.25569176882662,
"conf... |
from django.template import Library
from ...order import OrderStatus
from ...payment import ChargeStatus
from ...product import ProductAvailabilityStatus, VariantAvailabilityStatus
from ...product.utils.availability import (
get_product_availability_status, get_variant_availability_status)
register = Library()
... | {
"repo_name": "UITools/saleor",
"path": "saleor/core/templatetags/status.py",
"copies": "1",
"size": "2472",
"license": "bsd-3-clause",
"hash": 8858128945601816000,
"line_mean": 30.2911392405,
"line_max": 75,
"alpha_frac": 0.7083333333,
"autogenerated": false,
"ratio": 3.635294117647059,
"confi... |
from django.template import Library
from subdomains.compat.template import simple_tag
from subdomains.utils import reverse
register = Library()
UNSET = object()
@simple_tag(register, takes_context=True)
def url(context, view, scheme=None, subdomain=UNSET, port=UNSET, *args, **kwargs):
"""
Resolves a URL i... | {
"repo_name": "jangeador/django-subdomains",
"path": "subdomains/templatetags/subdomainurls.py",
"copies": "1",
"size": "1802",
"license": "mit",
"hash": 3685336628330385400,
"line_mean": 33,
"line_max": 97,
"alpha_frac": 0.6692563818,
"autogenerated": false,
"ratio": 4.36319612590799,
"config_... |
from django.template import Library
from subdomains.utils import reverse
register = Library()
UNSET = object()
@register.simple_tag(takes_context=True)
def url(context, view, subdomain=UNSET, *args, **kwargs):
"""
Resolves a URL in a template, using subdomain-based URL resolution.
If no subdomain is ... | {
"repo_name": "ipsosante/django-subdomains",
"path": "subdomains/templatetags/subdomainurls.py",
"copies": "1",
"size": "1026",
"license": "mit",
"hash": -6545014674362720000,
"line_mean": 27.5,
"line_max": 79,
"alpha_frac": 0.6617933723,
"autogenerated": false,
"ratio": 4.3474576271186445,
"co... |
from django.template import Library
from tag_parser.basetags import BaseInclusionNode, BaseNode
register = Library()
@register.tag("BaseNoArgsTag")
class BaseNoArgsTag(BaseNode):
pass
@register.tag("BaseAnyArgsTag")
class BaseAnyArgsTag(BaseNode):
allowed_kwargs = None # disable check
@register.tag("Ba... | {
"repo_name": "edoburu/django-tag-parser",
"path": "tag_parser/tests/templatetags/tag_parser_test_tags.py",
"copies": "1",
"size": "1030",
"license": "apache-2.0",
"hash": 3448169667007572500,
"line_mean": 23.5238095238,
"line_max": 84,
"alpha_frac": 0.6310679612,
"autogenerated": false,
"ratio":... |
from django.template import Library
register = Library()
@register.simple_tag
def hsv_to_hex(h, s, v):
"""
>>> print(hsv_to_hex(0, 0, 0))
#000000
>>> print(hsv_to_hex(0, 0, 1))
#FFFFFF
>>> print(hsv_to_hex(0, 1, 1))
#FF0000
>>> print(hsv_to_hex(120, 1, 1))
#00FF00
>>> print(h... | {
"repo_name": "dezede/dezede",
"path": "accounts/templatetags/accounts_extra.py",
"copies": "1",
"size": "1760",
"license": "bsd-3-clause",
"hash": 3227462070527329000,
"line_mean": 22.7837837838,
"line_max": 79,
"alpha_frac": 0.4693181818,
"autogenerated": false,
"ratio": 2.4719101123595504,
"... |
from django.template import Library
register = Library()
@register.simple_tag
def plural(n_str, singular, plural=None):
""" A better pluralization template tag.
The syntax is ``{% plural number "singular" "plural" %}``, where the
``plural`` is optional (the ``singular`` with an ``"s"`` suffix
... | {
"repo_name": "Strangemother/coffee",
"path": "reserved/templatetags/plural.py",
"copies": "1",
"size": "1887",
"license": "mit",
"hash": 3407892471386948600,
"line_mean": 37.5102040816,
"line_max": 77,
"alpha_frac": 0.541600424,
"autogenerated": false,
"ratio": 3.9726315789473685,
"config_test... |
from django.template import Library
register = Library()
def and_n_others(values, limit):
# A helper for the commonly appended "and N other(s)" string, with
# the appropriate pluralization.
return " and %d other%s" % (len(values) - limit,
"" if len(values) == limit + 1 else... | {
"repo_name": "easyfmxu/zulip",
"path": "zerver/templatetags/app_filters.py",
"copies": "125",
"size": "1391",
"license": "apache-2.0",
"hash": 4221161055198376400,
"line_mean": 35.6052631579,
"line_max": 75,
"alpha_frac": 0.6074766355,
"autogenerated": false,
"ratio": 3.566666666666667,
"confi... |
from django.template import Library
register = Library()
from django.template.base import kwarg_re
from django.utils.html import conditional_escape
from django.template.defaulttags import URLNode
class PackageURLNode(URLNode):
def render(self, context):
from django.urls import NoReverseMatch, reverse
... | {
"repo_name": "numbas/editor",
"path": "editor/templatetags/editable_package.py",
"copies": "1",
"size": "3514",
"license": "apache-2.0",
"hash": 6900224803137134000,
"line_mean": 38.4831460674,
"line_max": 100,
"alpha_frac": 0.6269208879,
"autogenerated": false,
"ratio": 4.153664302600473,
"co... |
from django.template import Library
register = Library()
# http://www.djangosnippets.org/snippets/73/
@register.inclusion_tag('paginator.html', takes_context=True)
def paginator(context, adjacent_pages=5):
results_per_page = context['results_per_page']
left_results= context['hits'] - context['last_on_page']
... | {
"repo_name": "lvbeck/niubi",
"path": "common/templatetags/paginator.py",
"copies": "1",
"size": "1195",
"license": "apache-2.0",
"hash": -4578831436284953000,
"line_mean": 40.2068965517,
"line_max": 145,
"alpha_frac": 0.6267782427,
"autogenerated": false,
"ratio": 3.5993975903614457,
"config_t... |
from django.template import Library
register = Library()
def silence_without_field(fn):
def wrapped(field, attr):
if not field:
return ""
return fn(field, attr)
return wrapped
def _process_field_attributes(field, attr, process):
# split attribute name and value from 'attr:v... | {
"repo_name": "martinrusev/amonone",
"path": "amon/templatetags/formhelpers.py",
"copies": "2",
"size": "2208",
"license": "mit",
"hash": -7907326385538091000,
"line_mean": 26.2592592593,
"line_max": 73,
"alpha_frac": 0.6598731884,
"autogenerated": false,
"ratio": 3.6019575856443717,
"config_te... |
from django.template import Library
register = Library()
@register.filter
def remaining(item_list, total):
"""
Returns a null list of remaining items derived from the total. Usefull in
situations where you want exactly ten items in an interface and you may only
have eight items.
"""
list_len... | {
"repo_name": "chanul13/django-basic-apps",
"path": "basic/tools/templatetags/listutils.py",
"copies": "12",
"size": "1145",
"license": "bsd-3-clause",
"hash": 5426606612586213000,
"line_mean": 25.0227272727,
"line_max": 80,
"alpha_frac": 0.6410480349,
"autogenerated": false,
"ratio": 3.778877887... |
from django.template import Library
register = Library()
@register.inclusion_tag('includes/pagination.html', takes_context=True)
def pagination_url(context, paginator):
pages = []
if paginator.has_next():
qdict = context['request'].GET.copy()
qdict['page'] = paginator.next_page_number()
... | {
"repo_name": "wm3ndez/realestate",
"path": "realestate/home/templatetags/re_paginator.py",
"copies": "1",
"size": "1401",
"license": "bsd-2-clause",
"hash": -4779143556674207000,
"line_mean": 30.8636363636,
"line_max": 106,
"alpha_frac": 0.5960028551,
"autogenerated": false,
"ratio": 4.014326647... |
from django.template import Library
register = Library()
@register.inclusion_tag('editor-controls/text_input.html', name='text_input', takes_context=True)
def text_input(context, property_name, *args, **kwargs):
context.update({
'property': property_name,
'monospace': kwargs.get('monospace', False... | {
"repo_name": "numbas/editor",
"path": "editor/templatetags/editor_controls.py",
"copies": "1",
"size": "5858",
"license": "apache-2.0",
"hash": 1356415839905019000,
"line_mean": 39.965034965,
"line_max": 103,
"alpha_frac": 0.6282007511,
"autogenerated": false,
"ratio": 3.604923076923077,
"conf... |
from django.template import Library, Node, Context
from django.template.loader import render_to_string, get_template
from site_slider.models import Slider
from site_slider.settings import SLIDER_TEMPLATE_PATH, SLIDE_TEMPLATE_PATH
register = Library()
class SliderNode(Node):
def __init__(self, code):
sel... | {
"repo_name": "wlashell/lyrical_page",
"path": "site_slider/templatetags/slider_tags.py",
"copies": "1",
"size": "1313",
"license": "apache-2.0",
"hash": 2397022677376988700,
"line_mean": 25.7959183673,
"line_max": 74,
"alpha_frac": 0.5704493526,
"autogenerated": false,
"ratio": 4.052469135802469... |
from django.template import Library, Node
from django.conf import settings
from satchmo.contact.models import Contact
from satchmo.configuration import config_value
import sys
register = Library()
def show_tracker(secure=False):
"""
Output the google tracker code.
"""
return({"GOOGLE_CODE": config_val... | {
"repo_name": "sankroh/satchmo",
"path": "satchmo/shop/templatetags/satchmo_google.py",
"copies": "2",
"size": "3091",
"license": "bsd-3-clause",
"hash": -5441750416753509000,
"line_mean": 32.967032967,
"line_max": 183,
"alpha_frac": 0.6515690715,
"autogenerated": false,
"ratio": 4.10491367861885... |
from django.template import Library, Node
from django import forms, template
import re
register = Library()
SPLIT_RE = re.compile(r'[\s,]+')
@register.inclusion_tag('forms/field.html')
def show_field(field, wrap_with_tag='tr', classes=()):
if isinstance(classes, basestring):
classes = classes.split(',')
... | {
"repo_name": "hollow/nepal",
"path": "nepal/contrib/forms/templatetags/forms.py",
"copies": "1",
"size": "2707",
"license": "bsd-3-clause",
"hash": -2217730649692033500,
"line_mean": 31.6144578313,
"line_max": 102,
"alpha_frac": 0.6183967492,
"autogenerated": false,
"ratio": 3.900576368876081,
... |
from django.template import Library, Node
from django.template.base import TemplateSyntaxError
from fluent_contents.admin.contentitems import BaseContentItemInline
from tag_parser import template_tag, parse_as_var, parse_token_kwargs
register = Library()
@register.filter
def only_content_item_inlines(inlines):
re... | {
"repo_name": "pombredanne/django-fluent-contents",
"path": "fluent_contents/templatetags/placeholder_admin_tags.py",
"copies": "1",
"size": "3639",
"license": "apache-2.0",
"hash": 4143095866436121000,
"line_mean": 31.203539823,
"line_max": 105,
"alpha_frac": 0.6441330036,
"autogenerated": false,
... |
from django.template import Library, Node
from django.template.base import TemplateSyntaxError
from future.builtins import str
from tag_parser import parse_as_var, parse_token_kwargs, template_tag
from fluent_contents.admin.contentitems import BaseContentItemInline
register = Library()
@register.filter
def only_con... | {
"repo_name": "django-fluent/django-fluent-contents",
"path": "fluent_contents/templatetags/placeholder_admin_tags.py",
"copies": "2",
"size": "3729",
"license": "apache-2.0",
"hash": -7869773086951520000,
"line_mean": 30.075,
"line_max": 105,
"alpha_frac": 0.6358272995,
"autogenerated": false,
"... |
from django.template import Library, Node
from django.template.defaulttags import token_kwargs
from wagtail.core.models import Site
from ..context_processors import SettingsProxy
register = Library()
class GetSettingsNode(Node):
def __init__(self, kwargs, target_var):
self.kwargs = kwargs
self... | {
"repo_name": "zerolab/wagtail",
"path": "wagtail/contrib/settings/templatetags/wagtailsettings_tags.py",
"copies": "5",
"size": "1269",
"license": "bsd-3-clause",
"hash": -3276191288584460000,
"line_mean": 29.9512195122,
"line_max": 92,
"alpha_frac": 0.6595744681,
"autogenerated": false,
"ratio"... |
from django.template import Library, Node
from django.template import TemplateSyntaxError, TemplateDoesNotExist, Variable
#from django.template.loader import select_template
from django.conf import settings
from django.db.models.loading import get_model
from django.template.defaultfilters import slugify
from django.con... | {
"repo_name": "Krozark/Kraggne",
"path": "Kraggne/contrib/flatblocks/templatetags/flatblocks.py",
"copies": "3",
"size": "10367",
"license": "bsd-2-clause",
"hash": -1524921437572978700,
"line_mean": 36.9743589744,
"line_max": 176,
"alpha_frac": 0.6261213466,
"autogenerated": false,
"ratio": 4.05... |
from django.template import Library, Node
from django.template import Variable
#from django.template.loader import select_template
from django.conf import settings
from django.template.defaultfilters import slugify
from Kraggne.contrib.flatblocks.utils import GetUnknowObjectContent
from Kraggne.contrib.contentblocks.mo... | {
"repo_name": "Krozark/Harpe-v1.0",
"path": "Harpe-server/Harpe-website/Kraggne/contrib/contentblocks/templatetags/contentblocks.py",
"copies": "3",
"size": "4723",
"license": "bsd-2-clause",
"hash": -6154371297596743000,
"line_mean": 32.7357142857,
"line_max": 124,
"alpha_frac": 0.5833156892,
"aut... |
from django.template import Library, Node
from django.template.loader import render_to_string
from django.contrib.sites.models import Site
from django.conf import settings
import os, urlparse
register = Library()
def _absolute_url(url):
if url.startswith('http://') or url.startswith('https://'):
return ur... | {
"repo_name": "acdha/django-sugar",
"path": "sugar/templatetags/media.py",
"copies": "1",
"size": "1413",
"license": "bsd-3-clause",
"hash": -3542264221057082000,
"line_mean": 37.2162162162,
"line_max": 99,
"alpha_frac": 0.6213729653,
"autogenerated": false,
"ratio": 3.5325,
"config_test": fals... |
from django.template import Library, Node
from django.utils.html import format_html
from staff_toolbar.loading import get_toolbar_root
register = Library()
toolbar_root = get_toolbar_root()
@register.simple_tag(takes_context=True)
def staff_toolbar(context):
"""
Display the staff toolbar
:param context... | {
"repo_name": "edoburu/django-staff-toolbar",
"path": "staff_toolbar/templatetags/staff_toolbar_tags.py",
"copies": "1",
"size": "1471",
"license": "apache-2.0",
"hash": -4005346768417463000,
"line_mean": 23.1147540984,
"line_max": 100,
"alpha_frac": 0.6444595513,
"autogenerated": false,
"ratio":... |
from django.template import Library, Node
from g43exercise.models import Article
from django.utils import timezone
import random
register = Library()
@register.assignment_tag
def get_random_article():
# Usage Example: get_random_article as article_preview
# Determine how many articles in the database are not futu... | {
"repo_name": "trenog/g43exercise",
"path": "g43exercise/templatetags/random_article.py",
"copies": "1",
"size": "1068",
"license": "mit",
"hash": 6311118894600932000,
"line_mean": 37.1785714286,
"line_max": 93,
"alpha_frac": 0.7762172285,
"autogenerated": false,
"ratio": 3.5364238410596025,
"c... |
from django.template import Library, Node
from satchmo.product.models import Category
from satchmo.shop.templatetags import get_filter_args
import logging
log = logging.getLogger('shop.templatetags')
try:
from xml.etree.ElementTree import Element, SubElement, tostring
except ImportError:
from elementtree.Elem... | {
"repo_name": "roadhead/satchmo",
"path": "satchmo/shop/templatetags/satchmo_category.py",
"copies": "2",
"size": "4074",
"license": "bsd-3-clause",
"hash": 9049428741124225000,
"line_mean": 29.1777777778,
"line_max": 109,
"alpha_frac": 0.5765832106,
"autogenerated": false,
"ratio": 3.97463414634... |
from django.template import Library, Node
from smart_load_tag.utils import load
register = Library()
class SmartLoadNode(Node):
def render(self, context):
return ''
class ImportNode(Node):
def render(self, context):
return ''
class LoaderTag(object):
"""
Base class to implement im... | {
"repo_name": "codysoyland/django-smart-load-tag",
"path": "smart_load_tag/templatetags/smart_load.py",
"copies": "1",
"size": "4194",
"license": "bsd-3-clause",
"hash": -6384896874383555000,
"line_mean": 25.049689441,
"line_max": 85,
"alpha_frac": 0.4482594182,
"autogenerated": false,
"ratio": 4... |
from django.template import Library, Node
from announcements.models import current_announcements_for_request
register = Library()
class FetchAnnouncementsNode(Node):
def __init__(self, context_var, limit=None):
self.context_var = context_var
self.limit = limit
def render(self, context)... | {
"repo_name": "brosner/django-announcements",
"path": "announcements/templatetags/announcement_tags.py",
"copies": "1",
"size": "1063",
"license": "mit",
"hash": -2812820998645679600,
"line_mean": 28.5277777778,
"line_max": 93,
"alpha_frac": 0.632173095,
"autogenerated": false,
"ratio": 4.1042471... |
from django.template import Library, Node
from ..assets import Asset
from .. import finder, settings
register = Library()
MIMETYPES = {
'javascript': 'application/javascript',
'stylesheet': 'text/css'
}
class AssetNode(Node):
def __init__(self, name, mimetype, nodelist):
self.name = name
... | {
"repo_name": "davidelias/django-staticassets",
"path": "staticassets/templatetags/staticassets.py",
"copies": "1",
"size": "1329",
"license": "mit",
"hash": -7796705895322397000,
"line_mean": 27.8913043478,
"line_max": 88,
"alpha_frac": 0.6290443943,
"autogenerated": false,
"ratio": 3.7648725212... |
from django.template import Library, Node
from partial_ajax import THREAD_LOCAL
register = Library()
@register.tag('partial')
def ajax_partial(parser, token):
"""
Partial ajax template
"""
nodelist = parser.parse(('endpartial'))
parser.delete_first_token()
tokens = token.split_contents()
... | {
"repo_name": "dev360/django-partial-ajax",
"path": "partial_ajax/templatetags/partials.py",
"copies": "1",
"size": "1414",
"license": "mit",
"hash": 5210404570710527000,
"line_mean": 26.1923076923,
"line_max": 141,
"alpha_frac": 0.6357850071,
"autogenerated": false,
"ratio": 4.350769230769231,
... |
from django.template import Library, Node, NodeList, Template, Context, Variable
from django.template import TemplateSyntaxError
from localedb.models import Locale, get_locale
register = Library()
@register.filter
def currency(value, locale_name=None):
if locale_name:
locale = Locale.objects.get(name=loc... | {
"repo_name": "cuker/django-localedb",
"path": "localedb/templatetags/currencies.py",
"copies": "1",
"size": "2228",
"license": "bsd-3-clause",
"hash": -6385063444444622000,
"line_mean": 29.1081081081,
"line_max": 80,
"alpha_frac": 0.5866247756,
"autogenerated": false,
"ratio": 3.992831541218638,... |
from django.template import Library, Node, NodeList, VariableDoesNotExist
from django.core.urlresolvers import NoReverseMatch
from django.templatetags.future import url
from django.template.defaulttags import TemplateIfParser
register = Library()
class ActiveLinkNodeBase(Node):
def __init__(self, urlnode, var,... | {
"repo_name": "kurdd/Oauth",
"path": "activelink/templatetags/activelink.py",
"copies": "1",
"size": "2870",
"license": "apache-2.0",
"hash": -7921344011309742000,
"line_mean": 31.6136363636,
"line_max": 80,
"alpha_frac": 0.6452961672,
"autogenerated": false,
"ratio": 4.177583697234352,
"config... |
from django.template import Library, Node, NodeList, Variable,\
TemplateSyntaxError, VariableDoesNotExist
register = Library()
class RangeNode(Node):
def __init__(self, var_name, start, end, step, nodelist_loop):
self.var_name = var_name
self.nodelist_loop = nodelist_loop
try:
... | {
"repo_name": "vitorh45/django-ecommerce-exemplo1",
"path": "django-cielo-exemplo/apps/produto/templatetags/range_tags.py",
"copies": "1",
"size": "2703",
"license": "apache-2.0",
"hash": -2098348272595868200,
"line_mean": 24.261682243,
"line_max": 74,
"alpha_frac": 0.5375508694,
"autogenerated": f... |
from django.template import Library, Node, NodeList, Variable,\
TemplateSyntaxError, VariableDoesNotExist
register = Library()
class RangeNode(Node):
def __init__(self, var_name, start, end, step, nodelist_loop):
self.var_name = var_name
self.nodelist_loop = nodelist_loop
tr... | {
"repo_name": "crike/crike",
"path": "src/crike_django/crike_django/templatetags/range.py",
"copies": "1",
"size": "2793",
"license": "apache-2.0",
"hash": -4812984286415708000,
"line_mean": 24.1028037383,
"line_max": 74,
"alpha_frac": 0.5162907268,
"autogenerated": false,
"ratio": 4.350467289719... |
from django.template import Library, Node, resolve_variable
register = Library()
"""
A modified version of https://djangosnippets.org/snippets/2428/
"""
class AddGetParameter(Node):
def __init__(self, values):
self.values = values
def render(self, context):
req = resolve_variable('request',... | {
"repo_name": "lm-tools/situational",
"path": "situational/apps/sectors/templatetags/add_get_parameter.py",
"copies": "2",
"size": "1034",
"license": "bsd-3-clause",
"hash": 3084373009123360300,
"line_mean": 27.7222222222,
"line_max": 73,
"alpha_frac": 0.582205029,
"autogenerated": false,
"ratio"... |
from django.template import Library, Node, resolve_variable
register = Library()
"""
The tag generates a parameter string in form '?param1=val1¶m2=val2'.
The parameter list is generated by taking all parameters from current
request.GET and optionally overriding them by providing parameters to the tag.
This is a ... | {
"repo_name": "RobinRamael/django-add-get-parameters",
"path": "add_get_param/templatetags/add_get_parameter.py",
"copies": "1",
"size": "1592",
"license": "apache-2.0",
"hash": 5373947133150254000,
"line_mean": 31.5102040816,
"line_max": 79,
"alpha_frac": 0.7079145729,
"autogenerated": false,
"r... |
from django.template import Library, Node, TemplateSyntaxError
from django.contrib.contenttypes.models import ContentType
from django.core.urlresolvers import reverse
from bundestagger.bundestagging.forms import TagsForm
register = Library()
class TagsFormNode(Node):
def __init__(self, context_var):
... | {
"repo_name": "stefanw/Bundestagger",
"path": "bundestagger/bundestagging/templatetags/bundestagging_tags.py",
"copies": "1",
"size": "1252",
"license": "mit",
"hash": -2168087362602720000,
"line_mean": 31.1282051282,
"line_max": 83,
"alpha_frac": 0.6932907348,
"autogenerated": false,
"ratio": 3.... |
from django.template import Library, Node, TemplateSyntaxError
from django.core.cache import cache
from django.conf import settings
from datetime import datetime
from time import mktime, strptime
import urllib
import simplejson
register = Library()
class CachedNode(Node):
"""
Cached template node.
Subcla... | {
"repo_name": "anistark/creativejunkiez",
"path": "django_yaba/templatetags/tweet.py",
"copies": "4",
"size": "3279",
"license": "mit",
"hash": 1716883893352532200,
"line_mean": 30.8349514563,
"line_max": 113,
"alpha_frac": 0.6505032022,
"autogenerated": false,
"ratio": 4.145385587863464,
"conf... |
from django.template import Library, Node, TemplateSyntaxError
from django.core.cache import cache
class InboxOutput(Node):
def __init__(self, varname=None):
self.varname = varname
def render(self, context):
try:
user = context['user']
cache_key = '{0}_{1}'.form... | {
"repo_name": "soad241/django-messages",
"path": "django_messages/templatetags/inbox.py",
"copies": "1",
"size": "1739",
"license": "bsd-3-clause",
"hash": 4521555751619432000,
"line_mean": 32.4423076923,
"line_max": 107,
"alpha_frac": 0.5520414031,
"autogenerated": false,
"ratio": 4.180288461538... |
from django.template import Library, Node, TemplateSyntaxError
from django import template
from comperio.accounts.models import cUser, cGroup
from comperio.accounts.tools import is_manager
from django.contrib.auth.models import Group
from comperio.main.models import Discussion
import datetime
register = Library()
cla... | {
"repo_name": "neutrinog/Comperio",
"path": "comperio/accounts/templatetags/accounts_extras.py",
"copies": "1",
"size": "7946",
"license": "bsd-3-clause",
"hash": 4892095835819988000,
"line_mean": 35.7916666667,
"line_max": 87,
"alpha_frac": 0.613893783,
"autogenerated": false,
"ratio": 4.1536853... |
from django.template import Library, Node, TemplateSyntaxError
from django_messages.models import inbox_count_for
class InboxOutput(Node):
def __init__(self, varname=None):
self.varname = varname
def render(self, context):
try:
user = context['user']
count = inb... | {
"repo_name": "mirumee/django-messages",
"path": "django_messages/templatetags/inbox.py",
"copies": "1",
"size": "1412",
"license": "bsd-3-clause",
"hash": 7125426445642405000,
"line_mean": 29.6956521739,
"line_max": 107,
"alpha_frac": 0.5686968839,
"autogenerated": false,
"ratio": 4.165191740412... |
from django.template import Library, Node, TemplateSyntaxError
from django_messages.models import inbox_count_for
class InboxOutput(Node):
def __init__(self, varname=None):
self.varname = varname
def render(self, context):
try:
user = context['user']
count = inbox_coun... | {
"repo_name": "fpischedda/django-messages",
"path": "django_messages/templatetags/inbox.py",
"copies": "1",
"size": "1362",
"license": "bsd-3-clause",
"hash": -4722077056711717000,
"line_mean": 26.7959183673,
"line_max": 107,
"alpha_frac": 0.5895741557,
"autogenerated": false,
"ratio": 4.06567164... |
from django.template import Library, Node, TemplateSyntaxError
from django.template.defaultfilters import stringfilter
from django.utils.safestring import mark_safe
from django import template
import re
regexes = {
'findSpace' : re.compile("^(\s*)([^$]+)$")
, 'whitespace' : re.compile("^\s+$")
}
reg... | {
"repo_name": "Royce/GammaJS",
"path": "support/APIgen/tags/templatetags/gma.py",
"copies": "1",
"size": "3086",
"license": "mit",
"hash": -5727051440705172000,
"line_mean": 27.5740740741,
"line_max": 73,
"alpha_frac": 0.486066105,
"autogenerated": false,
"ratio": 4.159029649595688,
"config_tes... |
from django.template import Library, Node, TemplateSyntaxError
from django.template import resolve_variable
from django.core.cache import cache
from django.utils.encoding import force_unicode
from django.contrib.contenttypes.models import ContentType
from courant.core.caching.models import CachedObject
from courant.co... | {
"repo_name": "maxcutler/Courant-News",
"path": "courant/core/caching/templatetags/smart_cache.py",
"copies": "1",
"size": "4796",
"license": "bsd-3-clause",
"hash": -5106114218236399000,
"line_mean": 35.9,
"line_max": 96,
"alpha_frac": 0.6267723103,
"autogenerated": false,
"ratio": 4.08866155157... |
from django.template import Library, Node, TemplateSyntaxError
from django.template import resolve_variable
from django.core.cache import cache
from django.utils.encoding import force_unicode
register = Library()
class CacheNode(Node):
def __init__(self, nodelist, expire_time, fragment_name, vary_on):
sel... | {
"repo_name": "rawwell/django",
"path": "django/templatetags/cache.py",
"copies": "3",
"size": "1979",
"license": "bsd-3-clause",
"hash": 29799506204489280,
"line_mean": 33.7192982456,
"line_max": 116,
"alpha_frac": 0.630621526,
"autogenerated": false,
"ratio": 3.997979797979798,
"config_test":... |
from django.template import Library, Node, TemplateSyntaxError
from django.template import Variable, resolve_variable
from django.utils.translation import ugettext as _
from django.contrib.contenttypes.models import ContentType
from django.core.urlresolvers import reverse
from books.models import Book
register = Libra... | {
"repo_name": "dongguangming/django-books",
"path": "templatetags/book_tags.py",
"copies": "1",
"size": "3246",
"license": "bsd-3-clause",
"hash": 9034067572997698000,
"line_mean": 30.8235294118,
"line_max": 62,
"alpha_frac": 0.6355514479,
"autogenerated": false,
"ratio": 4.221066319895969,
"co... |
from django.template import Library, Node, TemplateSyntaxError
from django.utils import formats
from django.utils.encoding import force_text
register = Library()
@register.filter(is_safe=False)
def localize(value):
"""
Forces a value to be rendered as a localized value,
regardless of the value of ``secur... | {
"repo_name": "bretlowery/snakr",
"path": "lib/django/templatetags/l10n.py",
"copies": "1",
"size": "1729",
"license": "bsd-3-clause",
"hash": 2387509758059018000,
"line_mean": 26.015625,
"line_max": 82,
"alpha_frac": 0.6310005784,
"autogenerated": false,
"ratio": 3.521384928716904,
"config_tes... |
from django.template import Library, Node, TemplateSyntaxError
from django.utils import formats
register = Library()
@register.filter(is_safe=False)
def localize(value):
"""
Force a value to be rendered as a localized value,
regardless of the value of ``settings.USE_L10N``.
"""
return str(formats... | {
"repo_name": "reinout/django",
"path": "django/templatetags/l10n.py",
"copies": "89",
"size": "1723",
"license": "bsd-3-clause",
"hash": -3993003234666983400,
"line_mean": 26.3492063492,
"line_max": 82,
"alpha_frac": 0.6227510157,
"autogenerated": false,
"ratio": 3.516326530612245,
"config_tes... |
from django.template import Library, Node, TemplateSyntaxError
from django.utils import formats
register = Library()
@register.filter(is_safe=False)
def localize(value):
"""
Forces a value to be rendered as a localized value,
regardless of the value of ``settings.USE_L10N``.
"""
return str(format... | {
"repo_name": "bak1an/django",
"path": "django/templatetags/l10n.py",
"copies": "1",
"size": "1692",
"license": "bsd-3-clause",
"hash": -1121313139099322500,
"line_mean": 25.8571428571,
"line_max": 82,
"alpha_frac": 0.6199763593,
"autogenerated": false,
"ratio": 3.5176715176715176,
"config_test... |
from django.template import Library, Node, TemplateSyntaxError
from django.utils import six
register = Library()
class BreadcrumbScope(Node):
def __init__(self, base_opts, nodelist):
self.base_opts = base_opts
# Note, takes advantage of Node.child_nodelists:
self.nodelist = nodelist
... | {
"repo_name": "hobarrera/django-polymorphic-ng",
"path": "polymorphic/templatetags/polymorphic_admin_tags.py",
"copies": "1",
"size": "1859",
"license": "bsd-3-clause",
"hash": 4924848872364876000,
"line_mean": 31.6140350877,
"line_max": 78,
"alpha_frac": 0.5944055944,
"autogenerated": false,
"ra... |
from django.template import Library, Node, TemplateSyntaxError
from django.utils import six
register = Library()
class BreadcrumbScope(Node):
def __init__(self, base_opts, nodelist):
self.base_opts = base_opts
self.nodelist = nodelist # Note, takes advantage of Node.child_nodelists
@class... | {
"repo_name": "pombredanne/django_polymorphic",
"path": "polymorphic/templatetags/polymorphic_admin_tags.py",
"copies": "5",
"size": "1803",
"license": "bsd-3-clause",
"hash": 455819350423450700,
"line_mean": 33.0188679245,
"line_max": 118,
"alpha_frac": 0.6128674432,
"autogenerated": false,
"rat... |
from django.template import Library, Node, TemplateSyntaxError
from django.utils.safestring import mark_safe
import re
from ..backends import detect_backend, VideoBackend
register = Library()
@register.tag('video')
class VideoNode(Node):
"""
Template tag ``video``. It gives access to all
:py:class:`~emb... | {
"repo_name": "orlenko/bccf",
"path": "src/embed_video/templatetags/embed_video_tags.py",
"copies": "1",
"size": "4631",
"license": "unlicense",
"hash": 2732398208696262000,
"line_mean": 25.7687861272,
"line_max": 82,
"alpha_frac": 0.5361692939,
"autogenerated": false,
"ratio": 4.0339721254355405... |
from django.template import Library, Node, TemplateSyntaxError
from django.utils.safestring import mark_safe
from ..backends import detect_backend, VideoBackend
register = Library()
@register.tag('video')
class VideoNode(Node):
"""
Template tag ``video``. It gives access to all
:py:class:`~embed_video.b... | {
"repo_name": "sariyanidi/academics-webpage",
"path": "packages/embed_video/templatetags/embed_video_tags.py",
"copies": "1",
"size": "2861",
"license": "mit",
"hash": -939291238973630000,
"line_mean": 22.6446280992,
"line_max": 72,
"alpha_frac": 0.5249912618,
"autogenerated": false,
"ratio": 3.8... |
from django.template import Library, Node, TemplateSyntaxError
from simplemenu.models import MenuItem, Menu
register = Library()
class SimplemenuNode(Node):
def __init__(self, varname):
self.varname = varname
def render(self, context):
context[self.varname] = MenuItem.objects.all()
re... | {
"repo_name": "elpaso/django-simplemenu",
"path": "simplemenu/templatetags/simplemenu_tags.py",
"copies": "1",
"size": "1989",
"license": "bsd-3-clause",
"hash": -8638001019914711000,
"line_mean": 26.625,
"line_max": 76,
"alpha_frac": 0.5987933635,
"autogenerated": false,
"ratio": 3.8771929824561... |
from django.template import Library, Node, TemplateSyntaxError
from threaded_messages.models import cached_inbox_count_for
class InboxOutput(Node):
def __init__(self, varname=None):
self.varname = varname
def render(self, context):
try:
user = context['user']
count = c... | {
"repo_name": "GreatBizTools/django-threaded-messages",
"path": "threaded_messages/templatetags/inbox.py",
"copies": "2",
"size": "1378",
"license": "mit",
"hash": -1752033704145689300,
"line_mean": 27.1224489796,
"line_max": 107,
"alpha_frac": 0.5928882438,
"autogenerated": false,
"ratio": 4.064... |
from django.template import Library, Node, TemplateSyntaxError
from threaded_messages.models import inbox_count_for
class InboxOutput(Node):
def __init__(self, varname=None):
self.varname = varname
def render(self, context):
try:
user = context['user']
count = i... | {
"repo_name": "philippWassibauer/django-threaded-messages",
"path": "threaded_messages/templatetags/inbox.py",
"copies": "1",
"size": "1406",
"license": "mit",
"hash": 8601466467326748000,
"line_mean": 29.5652173913,
"line_max": 107,
"alpha_frac": 0.5725462304,
"autogenerated": false,
"ratio": 4.... |
from django.template import Library, Node, TemplateSyntaxError
class InboxOutput(Node):
def __init__(self, varname=None):
self.varname = varname
def render(self, context):
try:
user = context['user']
count = user.received_messages.filter(read_at__isnull=True, recipient_... | {
"repo_name": "aldenjenkins/foobargamingwebsite",
"path": "django_messages/templatetags/inbox.py",
"copies": "16",
"size": "1381",
"license": "bsd-3-clause",
"hash": 4810346409561559000,
"line_mean": 29.6888888889,
"line_max": 114,
"alpha_frac": 0.5923244026,
"autogenerated": false,
"ratio": 4.06... |
from django.template import Library, Node, TemplateSyntaxError
class InboxOutput(Node):
def __init__(self, varname=None):
self.varname = varname
def render(self, context):
try:
user = context['user']
count = user.received_messages.filter(read_at__isnull=True, re... | {
"repo_name": "jgroszko/django-messages",
"path": "django_messages/templatetags/inbox.py",
"copies": "19",
"size": "1434",
"license": "bsd-3-clause",
"hash": 4908792905316195000,
"line_mean": 30.8666666667,
"line_max": 114,
"alpha_frac": 0.570432357,
"autogenerated": false,
"ratio": 4.16860465116... |
from django.template import Library, Node, TemplateSyntaxError
from polymorphic import compat
register = Library()
class BreadcrumbScope(Node):
def __init__(self, base_opts, nodelist):
self.base_opts = base_opts
self.nodelist = nodelist # Note, takes advantage of Node.child_nodelists
@clas... | {
"repo_name": "chrisglass/django_polymorphic",
"path": "polymorphic/templatetags/polymorphic_admin_tags.py",
"copies": "1",
"size": "1791",
"license": "bsd-3-clause",
"hash": 1464469918873861000,
"line_mean": 33.4423076923,
"line_max": 118,
"alpha_frac": 0.6203238414,
"autogenerated": false,
"rat... |
from django.template import Library, Node, TemplateSyntaxError
class InboxOutput(Node):
def __init__(self, varname=None):
self.varname = varname
def render(self, context):
try:
user = context['user']
count = user.received_messages.filter(read_at__isnull=True, recipient... | {
"repo_name": "LinDA-tools/LindaWorkbench",
"path": "linda/messages/templatetags/inbox.py",
"copies": "1",
"size": "1408",
"license": "mit",
"hash": -6819684310990665000,
"line_mean": 28.3333333333,
"line_max": 114,
"alpha_frac": 0.5809659091,
"autogenerated": false,
"ratio": 4.141176470588236,
... |
from django.template import Library, Node, TemplateSyntaxError
register = Library()
class RangeNode(Node):
def __init__(self, num, context_name):
self.num, self.context_name = num, context_name
def render(self, context):
context[self.context_name] = range(int(self.num))
return ""
... | {
"repo_name": "tijptjik/mycroft",
"path": "mycroft/base/templatetags/tags.py",
"copies": "1",
"size": "1452",
"license": "bsd-3-clause",
"hash": 4240812162862740000,
"line_mean": 27.4705882353,
"line_max": 77,
"alpha_frac": 0.6287878788,
"autogenerated": false,
"ratio": 3.8210526315789473,
"con... |
from django.template import Library, Node, TemplateSyntaxError
register = Library()
class BreadcrumbScope(Node):
def __init__(self, base_opts, nodelist):
self.base_opts = base_opts
self.nodelist = nodelist # Note, takes advantage of Node.child_nodelists
@classmethod
def parse(cls, pars... | {
"repo_name": "sdelements/django_polymorphic",
"path": "polymorphic/templatetags/polymorphic_admin_tags.py",
"copies": "1",
"size": "1768",
"license": "bsd-3-clause",
"hash": 6429859030741784000,
"line_mean": 33,
"line_max": 118,
"alpha_frac": 0.6091628959,
"autogenerated": false,
"ratio": 4.1995... |
from django.template import Library, Node, TemplateSyntaxError
register = Library()
@register.tag(name="sneak_peek")
def sneak_peek(parser, token):
tag = None
style = '"default"'
try:
tag, style = token.split_contents()
except ValueError:
pass
if not (style[0] == style[-1] and styl... | {
"repo_name": "teddywing/django-sneak-peek",
"path": "sneak_peek_tag/templatetags/sneak_peek.py",
"copies": "1",
"size": "1131",
"license": "mit",
"hash": -150744885971862620,
"line_mean": 30.4166666667,
"line_max": 80,
"alpha_frac": 0.5968169761,
"autogenerated": false,
"ratio": 3.72039473684210... |
from django.template import Library, Node, TemplateSyntaxError
# @see http://djangosnippets.org/snippets/2877/
register = Library()
class _SlicedPaginator:
def __init__(self, curpage, npages, maxpages_items):
"""Contructor.
Example:
>>> _SlicedPaginator(1, 3, 3)
_SlicedPa... | {
"repo_name": "alexhayes/django-toolkit",
"path": "django_toolkit/templatetags/sliced_pagination.py",
"copies": "1",
"size": "7752",
"license": "mit",
"hash": 2292377591405004300,
"line_mean": 38.556122449,
"line_max": 123,
"alpha_frac": 0.5256707946,
"autogenerated": false,
"ratio": 3.2571428571... |
from django.template import Library, Node, TemplateSyntaxError
from django.utils import formats
from django.utils.encoding import force_text
register = Library()
@register.filter(is_safe=False)
def localize(value):
"""
Forces a value to be rendered as a localized value,
regardless of the value of ``setti... | {
"repo_name": "letouriste001/SmartForest_2.0",
"path": "python3.4Smartforest/lib/python3.4/site-packages/django/templatetags/l10n.py",
"copies": "1",
"size": "1735",
"license": "mit",
"hash": -7027147303157405000,
"line_mean": 26.109375,
"line_max": 82,
"alpha_frac": 0.6322766571,
"autogenerated": ... |
from django.template import Library, Node, TemplateSyntaxError
from django.utils.encoding import force_unicode
from convert.base import MediaFile, EmptyMediaFile, convert_solo
from convert.conf import settings
register = Library()
class ConvertBaseNode(Node):
def error(self, context):
if sett... | {
"repo_name": "aino/aino-convert",
"path": "convert/templatetags/convert_tags.py",
"copies": "1",
"size": "3278",
"license": "bsd-3-clause",
"hash": 5902594937855053000,
"line_mean": 29.8252427184,
"line_max": 72,
"alpha_frac": 0.5713849908,
"autogenerated": false,
"ratio": 3.944645006016847,
"... |
from django.template import Library, Node, TemplateSyntaxError
from django.utils import formats
from django.utils.encoding import force_text
register = Library()
@register.filter(is_safe=False)
def localize(value):
"""
Forces a value to be rendered as a localized value,
regardless of the value... | {
"repo_name": "diego-d5000/MisValesMd",
"path": "env/lib/python2.7/site-packages/django/templatetags/l10n.py",
"copies": "1",
"size": "1801",
"license": "mit",
"hash": -2640637850465595400,
"line_mean": 25.7076923077,
"line_max": 82,
"alpha_frac": 0.6091060522,
"autogenerated": false,
"ratio": 3.... |
from django.template import Library, Node, TemplateSyntaxError
from stats.views import get_next_rank_title_and_exp_points
register = Library()
class SetVariable(Node):
def __init__(self, varname, nodelist):
self.varname = varname
self.nodelist = nodelist
def render(self,context):
... | {
"repo_name": "Kami/sgrstats.com",
"path": "sgrstats/stats/templatetags/tags.py",
"copies": "1",
"size": "1515",
"license": "apache-2.0",
"hash": -735948207727543200,
"line_mean": 29.6041666667,
"line_max": 140,
"alpha_frac": 0.6415841584,
"autogenerated": false,
"ratio": 3.8946015424164524,
"c... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.