text stringlengths 0 1.05M | meta dict |
|---|---|
from django import template
register = template.Library()
# added previous context ...
@register.inclusion_tag('autobreadcrumbs_tag.html', takes_context=True)
def autobreadcrumbs_tag_context(context):
"""
Template tag to output HTML for full breadcrumbs using template
``autobreadcrumbs_tag.html``.
Ex... | {
"repo_name": "mesemus/fedoralink",
"path": "fedoralink_ui/templatetags/oarepo_tags.py",
"copies": "1",
"size": "1123",
"license": "apache-2.0",
"hash": -4060988679383630000,
"line_mean": 26.4146341463,
"line_max": 71,
"alpha_frac": 0.5227070347,
"autogenerated": false,
"ratio": 4.38671875,
"co... |
from django import template
register = template.Library()
class RulezPermsNode(template.Node):
def __init__(self, codename, objname, varname):
self.codename = codename
self.objname = objname
self.varname = varname
def render(self, context):
try:
user_obj = template... | {
"repo_name": "chrisglass/django-rulez",
"path": "rulez/templatetags/rulez_perms.py",
"copies": "1",
"size": "1625",
"license": "bsd-3-clause",
"hash": 5161896103968124000,
"line_mean": 30.25,
"line_max": 69,
"alpha_frac": 0.5815384615,
"autogenerated": false,
"ratio": 4.145408163265306,
"confi... |
from django import template
register = template.Library()
class VarNode(template.Node):
def __init__(self, var_name, var_to_resolve):
self.var_name = var_name
self.var_to_resolve = var_to_resolve
def get_context(self, top_context):
for context in top_context.dicts:
if self.... | {
"repo_name": "ingenieroariel/pinax",
"path": "apps/misc/templatetags/var_tag.py",
"copies": "9",
"size": "1231",
"license": "mit",
"hash": -2805565771230280700,
"line_mean": 31.3947368421,
"line_max": 73,
"alpha_frac": 0.5572705118,
"autogenerated": false,
"ratio": 3.970967741935484,
"config_t... |
from django import template
register = template.Library()
def mostrar_resumen_mapa(context, m, order_by):
# print context
to_return = {
'mapa': m,
'order_by': order_by,
}
return to_return
@register.inclusion_tag('mapas/lista_mapas.html')
def mostrar_mapas(lista_mapas, order_by):
to_return = {
... | {
"repo_name": "pcecconi/mapground",
"path": "maps/templatetags/mapas_tags.py",
"copies": "1",
"size": "1640",
"license": "mit",
"hash": 2533189031838517000,
"line_mean": 22.0985915493,
"line_max": 83,
"alpha_frac": 0.6426829268,
"autogenerated": false,
"ratio": 3.111954459203036,
"config_test":... |
from django import template
register = template.Library()
def prepopulated_fields_js(context):
"""
Creates a list of prepopulated_fields that should render Javascript for
the prepopulated fields for both the admin form and inlines.
"""
prepopulated_fields = []
if context['add'] and 'adminform'... | {
"repo_name": "asedunov/intellij-community",
"path": "python/lib/Lib/site-packages/django/contrib/admin/templatetags/admin_modify.py",
"copies": "157",
"size": "1913",
"license": "apache-2.0",
"hash": -1126793513048717200,
"line_mean": 44.5476190476,
"line_max": 128,
"alpha_frac": 0.6466283325,
"au... |
from django import template
register = template.Library()
def presentation_for_room_and_timeslot(parser, token):
tokens = token.contents.split()
if not len(tokens) >= 5:
raise template.TemplateSyntaxError("%r tag requires a timeslot and room argument in the format 'for timeslot in room'" % tokens[0]... | {
"repo_name": "pombredanne/encampment",
"path": "templatetags/encampment_tags.py",
"copies": "1",
"size": "1803",
"license": "bsd-3-clause",
"hash": 4112026656629979000,
"line_mean": 33.0377358491,
"line_max": 139,
"alpha_frac": 0.6161952302,
"autogenerated": false,
"ratio": 4.116438356164384,
... |
from django import template
register = template.Library()
def submit_row(context):
"""
Displays the row of buttons for delete and save.
"""
opts = context['opts']
change = context['change']
is_popup = context['is_popup']
save_as = context['save_as']
return {
'onclick_attrib': ... | {
"repo_name": "disqus/nexus",
"path": "nexus/templatetags/nexus_admin.py",
"copies": "6",
"size": "1043",
"license": "apache-2.0",
"hash": 9208720762023761000,
"line_mean": 40.72,
"line_max": 99,
"alpha_frac": 0.5944391179,
"autogenerated": false,
"ratio": 3.8345588235294117,
"config_test": fal... |
from django import template
register = template.Library()
def submit_row_resource_popup(context):
"""
Displays the row of buttons for delete and save.
"""
opts = context['opts']
change = context['change']
is_popup = context['is_popup']
save_as = context['save_as']
return {
'onc... | {
"repo_name": "zeehio/META-SHARE",
"path": "metashare/repository/templatetags/submit_row_resource_popup.py",
"copies": "6",
"size": "1085",
"license": "bsd-3-clause",
"hash": 93535943492162700,
"line_mean": 39.1851851852,
"line_max": 123,
"alpha_frac": 0.6,
"autogenerated": false,
"ratio": 3.8612... |
from django import template
register = template.Library()
from classytags.core import Options
from classytags.helpers import InclusionTag
from classytags.arguments import Argument
from dockitcms.widgetblock.common import WidgetBlockScopeDisplay
import collections
class WidgetBlock(InclusionTag):
name = 'widget... | {
"repo_name": "zbyte64/django-dockitcms",
"path": "dockitcms/widgetblock/templatetags/widgetblocks.py",
"copies": "1",
"size": "2138",
"license": "bsd-3-clause",
"hash": -7163136260999890000,
"line_mean": 30.9104477612,
"line_max": 70,
"alpha_frac": 0.6173994387,
"autogenerated": false,
"ratio": ... |
from django import template
register = template.Library()
from django.contrib.contenttypes.models import ContentType
@register.inclusion_tag('files/tags/add.html')
def add_file_to(model_instance, css_id):
''' Tag instance with an file with dialog widget
{% add_file_to myModel 'css_id' %}
This is a javas... | {
"repo_name": "skyl/django-files",
"path": "templatetags/files_tags.py",
"copies": "1",
"size": "2049",
"license": "mit",
"hash": -6449613348032674000,
"line_mean": 25.6103896104,
"line_max": 72,
"alpha_frac": 0.6774036115,
"autogenerated": false,
"ratio": 3.520618556701031,
"config_test": fals... |
from django import template
register = template.Library()
from django.utils.html import conditional_escape
from django.utils.safestring import mark_safe
import re
@register.filter(needs_autoescape=True)
def allow_special(text, autoescape=None):
"""This filter turns any http(s)://www.* or www.* into a link,
... | {
"repo_name": "RacingTadpole/cmsplugin-rt",
"path": "cmsplugin_rt/text_minimal_markup/templatetags/allow_special.py",
"copies": "2",
"size": "1703",
"license": "bsd-3-clause",
"hash": -7777925162749808000,
"line_mean": 37.7045454545,
"line_max": 109,
"alpha_frac": 0.563123899,
"autogenerated": fals... |
from django import template
register = template.Library()
from django.utils.safestring import mark_safe
from elections.models import Election, Candidate
import json
from django.core.urlresolvers import reverse
@register.simple_tag
def elections_json():
expected_elections = []
for election in Election.object... | {
"repo_name": "yank07/votai-theme",
"path": "votai_theme/templatetags/yqs_extras.py",
"copies": "2",
"size": "1034",
"license": "bsd-3-clause",
"hash": -5716425056169802000,
"line_mean": 30.3333333333,
"line_max": 103,
"alpha_frac": 0.6750483559,
"autogenerated": false,
"ratio": 3.679715302491103... |
from django import template
register = template.Library()
from notebook.snippets.models import Snippet
from notebook.bookmarks.models import Bookmark
from notebook.scraps.models import Scrap
from notebook.notes.models import Frame, Note
from notebook.notes.constants import *
@register.inclusion_tag('framebook/notes... | {
"repo_name": "yejia/osl_notebook",
"path": "notes/templatetags/tree_view.py",
"copies": "1",
"size": "3636",
"license": "mit",
"hash": 4533989341461029000,
"line_mean": 54.1060606061,
"line_max": 145,
"alpha_frac": 0.6801430143,
"autogenerated": false,
"ratio": 3.65427135678392,
"config_test":... |
from django import template
register = template.Library()
from re import compile, UNICODE
#RUBY_TEXT_MARKUP_TEMPLATE = u'<ruby><rb>{expression}</rb><rp>(</rp><rt>{reading}</rt><rp>)</rp></ruby>'
RUBY_TEXT_MARKUP_TEMPLATE = '<span class="ezRuby" title="{reading}">{expression}</span>'
#_LEFT_CARET = u'\<'
#_RIGH... | {
"repo_name": "aehlke/manabi",
"path": "manabi/apps/utils/templatetags/japanese.py",
"copies": "1",
"size": "2789",
"license": "mit",
"hash": -1474368221438581500,
"line_mean": 31.8117647059,
"line_max": 168,
"alpha_frac": 0.6267479383,
"autogenerated": false,
"ratio": 3.2094361334867663,
"conf... |
from django import template
register = template.Library()
from suave.models import ContentBlock
class ContentNode(template.Node):
def __init__(self, nodelist, parser, token):
bits = token.split_contents()
if len(bits) != 4 or bits[-2] != 'as':
raise template.TemplateSyntaxError(self.... | {
"repo_name": "radiosilence/django-suave",
"path": "suave/templatetags/content.py",
"copies": "1",
"size": "1174",
"license": "mit",
"hash": 5510316352036549000,
"line_mean": 29.1025641026,
"line_max": 69,
"alpha_frac": 0.601362862,
"autogenerated": false,
"ratio": 4.380597014925373,
"config_te... |
from django import template
register = template.Library()
import libvoikko
voikot = {}
# https://github.com/voikko/corevoikko/blob/master/libvoikko/doc/morphological-analysis.txt
ACCEPTABLE_WORD_CLASSES = [
"nimisana",
"laatusana",
"nimi",
"etunimi",
"paikannimi",
"sukunimi",
"teonsana",... | {
"repo_name": "okffi/decisions",
"path": "web/decisions/subscriptions/templatetags/voikko_tags.py",
"copies": "1",
"size": "1468",
"license": "bsd-3-clause",
"hash": -4297377193424323000,
"line_mean": 25.6909090909,
"line_max": 91,
"alpha_frac": 0.6185286104,
"autogenerated": false,
"ratio": 3.69... |
from django import template
register = template.Library()
LEADING_PAGE_RANGE_DISPLAYED = TRAILING_PAGE_RANGE_DISPLAYED = 5
LEADING_PAGE_RANGE = TRAILING_PAGE_RANGE = 3
NUM_PAGES_OUTSIDE_RANGE = 2
ADJACENT_PAGES = 3
def digg_paginator(context, base_url):
if (context["is_paginated"]):
in_leading_range ... | {
"repo_name": "jonge-democraten/hellios",
"path": "hellios/templatetags/digg_paginator.py",
"copies": "1",
"size": "2494",
"license": "mit",
"hash": 1606674708763339800,
"line_mean": 47.9019607843,
"line_max": 135,
"alpha_frac": 0.606255012,
"autogenerated": false,
"ratio": 3.2945838837516512,
... |
from django import template
register = template.Library()
MINUTES_IN_HOUR = 60
# This is the sub-hour resolution that the user will be exposed to. For example, if this value is 4, then the
# resolution will be MINUTES_IN_HOUR/4 = 15 minutes. This means that 2 hours and 16 minutes will be rounded to
# 2 hours and 15 ... | {
"repo_name": "Uberlearner/uberlearner",
"path": "uberlearner/humanize/templatetags/humanize.py",
"copies": "1",
"size": "1491",
"license": "mit",
"hash": -9124806107424267000,
"line_mean": 39.3243243243,
"line_max": 123,
"alpha_frac": 0.6914822267,
"autogenerated": false,
"ratio": 3.584134615384... |
from django import template
register = template.Library()
class AllowedNode(template.base.Node):
def __init__(self, *perms, ifnodes=None, elsenodes=None, user=None, obj=None):
self.perms = perms
self.ifnodes = ifnodes
self.elsenodes = elsenodes
self.user = user
... | {
"repo_name": "misli/softwarecollections",
"path": "softwarecollections/auth/templatetags/auth.py",
"copies": "1",
"size": "2588",
"license": "bsd-3-clause",
"hash": -2136855478927178500,
"line_mean": 30.5609756098,
"line_max": 86,
"alpha_frac": 0.5660741886,
"autogenerated": false,
"ratio": 3.98... |
from django import template
register = template.Library()
class AuthorListingNode(template.Node):
def __init__(self, obj_var, count, var_name, omit_var=None):
self.obj_var = obj_var
self.count = int(count)
self.var_name = var_name
self.omit_var = omit_var
def render(self, con... | {
"repo_name": "WhiskeyMedia/ella",
"path": "ella/core/templatetags/authors.py",
"copies": "6",
"size": "2517",
"license": "bsd-3-clause",
"hash": -4496138398043404300,
"line_mean": 32.56,
"line_max": 93,
"alpha_frac": 0.5025824394,
"autogenerated": false,
"ratio": 4.785171102661597,
"config_tes... |
from django import template
register = template.Library()
class FragmentNode(template.Node):
def __init__(self, nodelist, request, identifier, mode='append'):
self.nodelist = nodelist
self.request_var = template.Variable(request)
self.identifier_var = template.Variable(identifier)
... | {
"repo_name": "hgrimelid/feincms",
"path": "feincms/templatetags/fragment_tags.py",
"copies": "2",
"size": "2960",
"license": "bsd-3-clause",
"hash": -2669534278115364400,
"line_mean": 27.1904761905,
"line_max": 94,
"alpha_frac": 0.6263513514,
"autogenerated": false,
"ratio": 4.157303370786517,
... |
from django import template
register = template.Library()
class InContextNode(template.Node):
def __init__(self, nodelist, subcontext_names):
self.nodelist = nodelist
self.subcontext_names = subcontext_names
def render(self, context):
new_context = {}
for field in self.subcon... | {
"repo_name": "grapesmoker/regulations-site",
"path": "regulations/templatetags/in_context.py",
"copies": "5",
"size": "1327",
"license": "cc0-1.0",
"hash": 1357692389165390000,
"line_mean": 27.2340425532,
"line_max": 77,
"alpha_frac": 0.5840241145,
"autogenerated": false,
"ratio": 4.021212121212... |
from django import template
register = template.Library()
class IndentByNode(template.Node):
def __init__(self, nodelist, indent_level, if_statement):
self.nodelist = nodelist
self.indent_level = template.Variable(indent_level)
if if_statement:
self.if_statement = template.Var... | {
"repo_name": "maroux/django-extensions",
"path": "django_extensions/templatetags/indent_text.py",
"copies": "71",
"size": "1743",
"license": "mit",
"hash": 1318294186796576000,
"line_mean": 30.6909090909,
"line_max": 86,
"alpha_frac": 0.6265060241,
"autogenerated": false,
"ratio": 4.15,
"confi... |
from django import template
register = template.Library()
class NavTagItem(template.Node):
def __init__(self, nav_path, nav_displaytext, nav_icon):
self.path = nav_path.strip('"')
self.text = nav_displaytext.strip('"')
self.icon = nav_icon.strip('"')
def render(self, context):
... | {
"repo_name": "zer0Black/zer0Blog",
"path": "blog/templatetags/left_nav.py",
"copies": "1",
"size": "1199",
"license": "apache-2.0",
"hash": 6951539741372639000,
"line_mean": 33.2857142857,
"line_max": 151,
"alpha_frac": 0.5813177648,
"autogenerated": false,
"ratio": 3.61144578313253,
"config_t... |
from django import template
register = template.Library()
class PaginatorHelper(object):
'''
This helper class encapsulates calculations common to all page range filters.
'''
# Common constants (can be redefined globally):
ON_EACH_SIDE = 3 # how many items should be shown at most on each side
... | {
"repo_name": "ivandeex/dz",
"path": "dz/templatetags/dz_paginator.py",
"copies": "1",
"size": "4023",
"license": "mit",
"hash": 8024196692811239000,
"line_mean": 40.0510204082,
"line_max": 84,
"alpha_frac": 0.6863037534,
"autogenerated": false,
"ratio": 3.4651162790697674,
"config_test": false... |
from django import template
register = template.Library()
class RecurseNode(template.Node):
def __init__(self, var, name, child, nodeList):
self.var = var
self.name = name
self.child = child
self.nodeList = nodeList
def __repr__(self):
return '<RecurseNode>'
def ... | {
"repo_name": "MicroPyramid/micro-blog",
"path": "django_blog_it/django_blog_it/templatetags/recurse.py",
"copies": "1",
"size": "2348",
"license": "mit",
"hash": -1592959719628160800,
"line_mean": 33.5294117647,
"line_max": 127,
"alpha_frac": 0.5536626917,
"autogenerated": false,
"ratio": 4.0905... |
from django import template
register = template.Library()
"""
Decorator to facilitate template tag creation
"""
def easy_tag(func):
"""deal with the repetitive parts of parsing template tags"""
def inner(parser, token):
#print token
try:
return func(*token.split_contents())
... | {
"repo_name": "orlenko/sfpirg",
"path": "sfpirgapp/templatetags/append_to_get.py",
"copies": "1",
"size": "1322",
"license": "bsd-2-clause",
"hash": 2025540046105139500,
"line_mean": 26.5625,
"line_max": 104,
"alpha_frac": 0.5824508321,
"autogenerated": false,
"ratio": 3.745042492917847,
"confi... |
from django import template
register = template.Library()
"""
Decorator to facilitate template tag creation
"""
def easy_tag(func):
"""deal with the repetitive parts of parsing template tags"""
def inner(parser, token):
try:
return func(*token.split_contents())
except TypeError:
... | {
"repo_name": "brandonw/meal_planner",
"path": "meal_planner/recipes/templatetags/recipe_extras.py",
"copies": "1",
"size": "1276",
"license": "bsd-3-clause",
"hash": -6182395376226438000,
"line_mean": 25.5833333333,
"line_max": 73,
"alpha_frac": 0.5619122257,
"autogenerated": false,
"ratio": 3.9... |
from django import template
register = template.Library()
def get_macros(parser):
if not hasattr(parser, '_macros'):
parser._macros = {}
return parser._macros
class DefineNode(template.Node):
def __init__(self, nodes):
self.nodes = nodes
def render(self, context):
return ''... | {
"repo_name": "entwanne/Rodolphe",
"path": "rodolphe/utils/templatetags/macros.py",
"copies": "2",
"size": "1072",
"license": "bsd-2-clause",
"hash": -7738044119276340000,
"line_mean": 22.3043478261,
"line_max": 57,
"alpha_frac": 0.6082089552,
"autogenerated": false,
"ratio": 3.856115107913669,
... |
from django import template
register = template.Library()
def is_document_file_image(ext):
image_ext_list = [
"bmp",
"dds",
"gif",
"jpg",
"jpeg",
"png",
"psd",
"pspimage",
"tga",
"thm",
"tif",
"tiff",
"yuv",
... | {
"repo_name": "MicroPyramid/Django-CRM",
"path": "common/templatetags/common_tags.py",
"copies": "1",
"size": "9805",
"license": "mit",
"hash": -2827934946913117000,
"line_mean": 14.8656957929,
"line_max": 84,
"alpha_frac": 0.2733299337,
"autogenerated": false,
"ratio": 3.24239417989418,
"confi... |
from django import template
register = template.Library()
def render_table_filtered(context, table_data=None, filter_data=None, can_add_new=True):
if table_data is not None:
filter_qs = table_data
else:
filter_qs = context["filter_qs"]
if filter_data is not None:
filter1 = filter_... | {
"repo_name": "matuu/sgk",
"path": "sgk/tables_filters/templatetags/tables_filters.py",
"copies": "1",
"size": "1582",
"license": "apache-2.0",
"hash": -2580036250339635700,
"line_mean": 30.64,
"line_max": 88,
"alpha_frac": 0.5922882427,
"autogenerated": false,
"ratio": 3.886977886977887,
"conf... |
from django import template
register = template.Library()
def submit_alert_row(context):
"""
Displays the row of buttons for delete and save.
"""
opts = context['opts']
change = context['change']
is_popup = context['is_popup']
save_as = context['save_as']
return {
'onclick_att... | {
"repo_name": "instituteofdesign/django-lms",
"path": "apps/alerts/templatetags/alerts.py",
"copies": "1",
"size": "1059",
"license": "bsd-3-clause",
"hash": -115980371428545920,
"line_mean": 39.7307692308,
"line_max": 111,
"alpha_frac": 0.5996222852,
"autogenerated": false,
"ratio": 3.8231046931... |
from django import template
register = template.Library()
def uniqify(*collections):
sets = [set(c) for c in collections]
remaining = set(v for s in sets for v in s)
results = []
for s in sets:
results.append(list(s & remaining))
remaining = remaining - s
return results
@regis... | {
"repo_name": "praekelt/molo-iogt",
"path": "iogt/templatetags/pagination.py",
"copies": "1",
"size": "1044",
"license": "bsd-2-clause",
"hash": 5903293934617011000,
"line_mean": 25.1,
"line_max": 72,
"alpha_frac": 0.6149425287,
"autogenerated": false,
"ratio": 3.6890459363957597,
"config_test"... |
from django import template
register = template.Library()
from os.path import exists, join
from django.template.loader import render_to_string
from django.contrib.staticfiles.storage import staticfiles_storage
from common.generic_template_tag import (
GenericTemplateTag,
split_into_variables
)
class Modul... | {
"repo_name": "Mause/pyalp",
"path": "pyalp/cl_module/templatetags/module.py",
"copies": "1",
"size": "2919",
"license": "mit",
"hash": 9216168875987822000,
"line_mean": 27.0673076923,
"line_max": 78,
"alpha_frac": 0.52004111,
"autogenerated": false,
"ratio": 4.230434782608696,
"config_test": f... |
from django import template
register = template.Library()
# returns the a dictioary's value from it's key.
@register.filter(name='lookup')
def lookup(dict, index):
if index in dict:
return dict[index]
return ''
@register.filter(name='get_id')
def get_id(room,day):
date = ""
print "getid"
... | {
"repo_name": "mcr/ietfdb",
"path": "ietf/meeting/templatetags/agenda_custom_tags.py",
"copies": "1",
"size": "1924",
"license": "bsd-3-clause",
"hash": 4294495213454178300,
"line_mean": 26.884057971,
"line_max": 142,
"alpha_frac": 0.6169438669,
"autogenerated": false,
"ratio": 3.217391304347826,... |
from django import template
register = template.Library()
# region Helpers
def get_wagtail_children_live_in_menu_all(root_page, active_page):
"""
Recursively find all live pages that have attribute In Menu flipped on.
:param root_page: The root_page page to start the search
:param active_page: The ... | {
"repo_name": "Mandelbrew/cookiecutter-django",
"path": "{{cookiecutter.project_slug}}/application/core/templatetags/core_tags.py",
"copies": "1",
"size": "3024",
"license": "mit",
"hash": -377677305967053700,
"line_mean": 29.24,
"line_max": 85,
"alpha_frac": 0.7126322751,
"autogenerated": false,
... |
from django import template
register = template.Library()
@register.assignment_tag(takes_context=True)
def get_site_root(context):
return context['request'].site.root_page
def has_menu_children(page):
return page.get_children().live().in_menu().exists()
def get_menu_order(page):
ret = 1
options =... | {
"repo_name": "baylee-d/cos.io",
"path": "common/templatetags/menu.py",
"copies": "1",
"size": "2119",
"license": "apache-2.0",
"hash": 4091161729485871600,
"line_mean": 33.737704918,
"line_max": 79,
"alpha_frac": 0.6672958943,
"autogenerated": false,
"ratio": 3.9830827067669174,
"config_test":... |
from django import template
register = template.Library()
@register.assignment_tag(takes_context=True)
def get_site_root(context):
return context['request'].site.root_page
@register.inclusion_tag("home/navbar/navbar.html", takes_context=True)
def display_navbar(context):
parent = get_site_root(context)
... | {
"repo_name": "taedori81/stylishclothing",
"path": "home/templatetags/stylish_tags.py",
"copies": "1",
"size": "1449",
"license": "bsd-3-clause",
"hash": 506341684865183100,
"line_mean": 18.8493150685,
"line_max": 96,
"alpha_frac": 0.6611456177,
"autogenerated": false,
"ratio": 3.8232189973614776... |
from django import template
register = template.Library()
@register.filter('break')
def break_(loop):
'''Breaks from a loop.
The 'break' filter is used within a loop and takes as input a loop variable,
e.g. 'forloop' in case of a for loop. For example, to display the items
from list ``items`` up to ... | {
"repo_name": "jrutila/django-filer",
"path": "filer/templatetags/looptags.py",
"copies": "1",
"size": "9318",
"license": "bsd-3-clause",
"hash": -259598008005875600,
"line_mean": 36.5725806452,
"line_max": 98,
"alpha_frac": 0.6042069114,
"autogenerated": false,
"ratio": 4.344055944055944,
"con... |
from django import template
register = template.Library()
@register.filter(name='ellipses_page_range')
def ellipses_page_range(page, args="1,2"):
"""
Creates digg-style page_range for pagination
Paginator.page_range returns range of all page numbers. For very long
lists it isn't suitable (displaying... | {
"repo_name": "nickpack/django-oscar",
"path": "src/oscar/templatetags/ellipses_pagination.py",
"copies": "58",
"size": "2678",
"license": "bsd-3-clause",
"hash": 6719889307644103000,
"line_mean": 34.2368421053,
"line_max": 79,
"alpha_frac": 0.6747572816,
"autogenerated": false,
"ratio": 3.766526... |
from django import template
register = template.Library()
@register.filter(name='getkey')
def getkey(value, arg):
try:
return value[arg]
except:
return
@register.filter(name='gettotal')
def gettotal(value, arg):
total = 0
try:
for result in value[arg]:
if result.r... | {
"repo_name": "jzahedieh/django-tennis-ladder",
"path": "ladder/templatetags/ladder_extras.py",
"copies": "1",
"size": "1353",
"license": "mit",
"hash": -1100551429578440800,
"line_mean": 22.7543859649,
"line_max": 69,
"alpha_frac": 0.5543237251,
"autogenerated": false,
"ratio": 3.899135446685878... |
from django import template
register = template.Library()
@register.filter(name='konversi_simbol')
def konversi_simbol(value):
if value == 'IJZ':
return 'Ijazah'
elif value == 'SRF':
return 'Sertifikat'
elif value == 'LK':
return 'Lembar kerja'
elif value == 'LKL':
... | {
"repo_name": "akbarpn136/logapp-dj",
"path": "logapp/templatetags/konversi_simbol.py",
"copies": "1",
"size": "2815",
"license": "mit",
"hash": -4981077276334313000,
"line_mean": 18.9645390071,
"line_max": 65,
"alpha_frac": 0.5520426288,
"autogenerated": false,
"ratio": 3.545340050377834,
"con... |
from django import template
register = template.Library()
@register.filter(name='list_parents_id')
def list_parents_id(component):
"""
:param component: instance of ComponentModel
:return: list of parents' id values
"""
result = ''
for parent in component.parents.all():
result += str(... | {
"repo_name": "jkachika/columbus",
"path": "pyedf/templatetags/edf_filters.py",
"copies": "1",
"size": "3365",
"license": "mit",
"hash": -4648916746472200000,
"line_mean": 24.6946564885,
"line_max": 74,
"alpha_frac": 0.6457652303,
"autogenerated": false,
"ratio": 3.734739178690344,
"config_test... |
from django import template
register = template.Library()
@register.filter(name='percentage')
def percentage(value):
"""Returns the number as percentage with two-digit precision"""
try:
value = float(value)
except (ValueError, TypeError, UnicodeEncodeError):
return ''
return '{0:.2%}'... | {
"repo_name": "dbinetti/captable",
"path": "project/apps/captable/templatetags/captabletags.py",
"copies": "1",
"size": "1637",
"license": "bsd-2-clause",
"hash": -1791496365715101700,
"line_mean": 24.578125,
"line_max": 67,
"alpha_frac": 0.6444715944,
"autogenerated": false,
"ratio": 3.982968369... |
from django import template
register = template.Library()
@register.filter(name='user_location')
def parse_location(user):
"""
Returns a formatted string of user location data.
Adds a comma if the city is present, adds a space is the region is present
Returns empty if no location data is present
... | {
"repo_name": "demvher/pythondotorg",
"path": "users/templatetags/users_tags.py",
"copies": "1",
"size": "1033",
"license": "apache-2.0",
"hash": -8937968843111636000,
"line_mean": 23.5952380952,
"line_max": 78,
"alpha_frac": 0.5905130687,
"autogenerated": false,
"ratio": 4.395744680851064,
"co... |
from django import template
register = template.Library()
@register.filter
def divide_by(value, arg):
"""
Returns the result of the division of value with arg.
"""
result = 0
try:
result = value / arg
except:
# error in division
pass
return result
@register.filte... | {
"repo_name": "danrg/RGT-tool",
"path": "src/RGT/gridMng/templatetags/wizard_extras.py",
"copies": "1",
"size": "3137",
"license": "mit",
"hash": -8696185899644102000,
"line_mean": 25.1416666667,
"line_max": 103,
"alpha_frac": 0.6330889385,
"autogenerated": false,
"ratio": 3.940954773869347,
"c... |
from django import template
register = template.Library()
@register.filter
def format_import_error(error):
if error.get('type') == 'wrong_main_language_exist_in_wagtail':
message = (
"The main language for the account is `%(lang)s`, "
"while the selected main language for this sit... | {
"repo_name": "praekelt/molo",
"path": "molo/core/templatetags/core_import_tags.py",
"copies": "1",
"size": "2137",
"license": "bsd-2-clause",
"hash": 6903941911089380000,
"line_mean": 35.2203389831,
"line_max": 77,
"alpha_frac": 0.5067852129,
"autogenerated": false,
"ratio": 4.07824427480916,
... |
from django import template
register = template.Library()
@register.filter
def getattr(obj, attr_name):
try:
assert obj is not None
return obj.__getattribute__(attr_name)
except AttributeError:
return obj.__dict__.get(attr_name, '')
except:
return ''
# TODO:
# Remove the... | {
"repo_name": "Naeka/wagtailmodelchooser",
"path": "wagtailmodelchooser/templatetags/wagtailmodelchooser_tags.py",
"copies": "1",
"size": "1114",
"license": "bsd-2-clause",
"hash": 6957138228598403000,
"line_mean": 26.1707317073,
"line_max": 88,
"alpha_frac": 0.6669658887,
"autogenerated": false,
... |
from django import template
register = template.Library()
@register.filter
def get_range(value):
if value:
return range(value)
else:
return 0
@register.filter
def absolute(value):
return abs(value)
@register.filter
def subtract(value, arg):
return value - arg
@register.filter
de... | {
"repo_name": "porksmash/swarfarm",
"path": "herders/templatetags/utils.py",
"copies": "1",
"size": "1277",
"license": "apache-2.0",
"hash": -8962662420442662000,
"line_mean": 22.2181818182,
"line_max": 90,
"alpha_frac": 0.5974941269,
"autogenerated": false,
"ratio": 3.4607046070460705,
"config... |
from django import template
register = template.Library()
@register.filter
def is_in(var, obj):
return var in obj
@register.filter
def humanize_list(value):
"""
Represents a list in a humanized way with commas and ending with ", and ..."
@param value: list of values
@type value: list
@retu... | {
"repo_name": "sunlightlabs/emailcongress",
"path": "emailcongress/templatetags/emailcongress_filters.py",
"copies": "1",
"size": "2529",
"license": "mit",
"hash": 9066058231639502000,
"line_mean": 23.0857142857,
"line_max": 113,
"alpha_frac": 0.6200079083,
"autogenerated": false,
"ratio": 3.6758... |
from django import template
register = template.Library()
@register.filter
def paginator(context, adjacent_pages=2):
"""
To be used in conjunction with the object_list generic view.
Adds pagination context variables for use in displaying first, adjacent and
last page links in addition to those creat... | {
"repo_name": "raonyguimaraes/mendelmd",
"path": "files/templatetags/paginate_tag.py",
"copies": "2",
"size": "1114",
"license": "bsd-3-clause",
"hash": 4317492758976800000,
"line_mean": 32.7878787879,
"line_max": 99,
"alpha_frac": 0.6104129264,
"autogenerated": false,
"ratio": 4.11070110701107,
... |
from django import template
register = template.Library()
@register.filter
def permissions(obj, user):
return user.get_all_permissions(obj=obj)
class RulezPermsNode(template.Node):
def __init__(self, codename, objname, varname):
self.codename = codename
self.objname = objname
self.v... | {
"repo_name": "vosi/django-xadditions",
"path": "xadditions/templatetags/xperms.py",
"copies": "1",
"size": "1629",
"license": "bsd-3-clause",
"hash": -4200796790821161500,
"line_mean": 28.6181818182,
"line_max": 69,
"alpha_frac": 0.6046654389,
"autogenerated": false,
"ratio": 4.113636363636363,
... |
from django import template
register = template.Library()
@register.filter
def result_of(fight, user):
"""Returns result of a fight relative to the user.
So this:
User {{ entry.user }}
{% if fight.x.user == entry.user %}
{{ fight.result_of_x }}
{% else %}
... | {
"repo_name": "Motiejus/tictactoe",
"path": "tictactoe/contest/templatetags/contest_extras.py",
"copies": "1",
"size": "1162",
"license": "mit",
"hash": 6196742187981983000,
"line_mean": 26.023255814,
"line_max": 73,
"alpha_frac": 0.5335628227,
"autogenerated": false,
"ratio": 3.057894736842105,
... |
from django import template
register = template.Library()
@register.inclusion_tag('admin/custom_activity_submit_line.html', takes_context=True)
def custom_activity_submit_row(context):
"""
Displays the row of buttons for delete and save.
"""
opts = context['opts']
change = context['change']
i... | {
"repo_name": "elin-moco/ffclub",
"path": "ffclub/event/templatetags/custom_activity_admin_modify.py",
"copies": "1",
"size": "1043",
"license": "bsd-3-clause",
"hash": 5028406437251013000,
"line_mean": 39.1153846154,
"line_max": 85,
"alpha_frac": 0.5992329818,
"autogenerated": false,
"ratio": 3.... |
from django import template
register = template.Library()
@register.inclusion_tag('admin/prepopulated_fields_js.html', takes_context=True)
def prepopulated_fields_js(context):
"""
Creates a list of prepopulated_fields that should render Javascript for
the prepopulated fields for both the admin form and i... | {
"repo_name": "skirsdeda/django",
"path": "django/contrib/admin/templatetags/admin_modify.py",
"copies": "139",
"size": "2353",
"license": "bsd-3-clause",
"hash": -7460511115068559000,
"line_mean": 34.6515151515,
"line_max": 85,
"alpha_frac": 0.6349341266,
"autogenerated": false,
"ratio": 3.97466... |
from django import template
register = template.Library()
@register.inclusion_tag('admin/submit_line.html', takes_context=True)
def submit_row_extended_save_continue(context, add_confirmation=False):
"""
Displays the row of buttons for delete and save.
"""
opts = context['opts']
change = context[... | {
"repo_name": "globocom/database-as-a-service",
"path": "dbaas/dbaas/templatetags/dbaas_tags.py",
"copies": "1",
"size": "2357",
"license": "bsd-3-clause",
"hash": -159015597432862140,
"line_mean": 37.0161290323,
"line_max": 78,
"alpha_frac": 0.6134917268,
"autogenerated": false,
"ratio": 3.83252... |
from django import template
register = template.Library()
@register.inclusion_tag('admin/templatetags/change_form/prepopulated_fields_js.html', takes_context=True)
def prepopulated_fields_js(context):
"""
Creates a list of prepopulated_fields that should render Javascript for
the prepopulated fields for ... | {
"repo_name": "commite/django-foundation-admin",
"path": "foundation_admin/templatetags/foundation_admin_modify.py",
"copies": "1",
"size": "2685",
"license": "apache-2.0",
"hash": -3716057398265151500,
"line_mean": 36.2916666667,
"line_max": 111,
"alpha_frac": 0.6405959032,
"autogenerated": false,... |
from django import template
register = template.Library()
@register.inclusion_tag('client/map_view.html')
def client_map_view_html(options=None):
"""
Client Map View html template tag.
"""
return dict()
@register.inclusion_tag('client/map_detail.html')
def client_map_detail_view_html(options=None):
... | {
"repo_name": "GeoNode/geonode-client",
"path": "geonode-client/templatetags/client_templatetags.py",
"copies": "1",
"size": "1066",
"license": "mit",
"hash": -7608539365431292000,
"line_mean": 22.1739130435,
"line_max": 58,
"alpha_frac": 0.6688555347,
"autogenerated": false,
"ratio": 3.529801324... |
from django import template
register = template.Library()
@register.inclusion_tag('collective_blog/tags/member.html')
def render_membership(membership, self_membership, render_rating=True, render_karma=True):
return dict(
membership=membership,
self_membership=self_membership,
render_karm... | {
"repo_name": "AmatanHead/collective-blog",
"path": "collective_blog/templatetags/members.py",
"copies": "1",
"size": "1237",
"license": "mit",
"hash": -1147560033306579200,
"line_mean": 41.6551724138,
"line_max": 90,
"alpha_frac": 0.6127728375,
"autogenerated": false,
"ratio": 4.164983164983165,... |
from django import template
register = template.Library()
@register.inclusion_tag('geonode-client/map_view.html', takes_context=True)
def client_map_view_html(context, options=None):
"""
Client Map View html template tag.
"""
return context
@register.inclusion_tag('geonode-client/map_detail.html', t... | {
"repo_name": "GeoNode/geonode-client",
"path": "geonode-client/templatetags/geonode_client_tags.py",
"copies": "1",
"size": "1295",
"license": "mit",
"hash": -8119299372518366000,
"line_mean": 27.152173913,
"line_max": 86,
"alpha_frac": 0.705019305,
"autogenerated": false,
"ratio": 3.56749311294... |
from django import template
register = template.Library()
@register.inclusion_tag('groups/_badge.html', takes_context=True)
def invites_badge(context, invite_type):
if context['user'].is_authenticated:
if invite_type == 'family':
return {
'invite_count': context['user'].family... | {
"repo_name": "treehouse/livestream-django-feelings",
"path": "feelings/groups/templatetags/group_tags.py",
"copies": "1",
"size": "1048",
"license": "mit",
"hash": 6382664102760439000,
"line_mean": 29.8235294118,
"line_max": 78,
"alpha_frac": 0.5391221374,
"autogenerated": false,
"ratio": 4.3127... |
from django import template
register = template.Library()
@register.inclusion_tag(
'admin/nudge/batch/submit_line.html', takes_context=True)
def submit_batch_row(context):
"""
Displays the row of buttons for delete and save.
"""
opts = context['opts']
change = context['change']
is_popup =... | {
"repo_name": "cfpb/django-nudge",
"path": "src/nudge/templatetags/nudge_admin_helpers.py",
"copies": "1",
"size": "1095",
"license": "cc0-1.0",
"hash": -7623097558242874000,
"line_mean": 36.7586206897,
"line_max": 78,
"alpha_frac": 0.5415525114,
"autogenerated": false,
"ratio": 4.055555555555555... |
from django import template
register = template.Library()
@register.inclusion_tag('pagination.html', takes_context=True)
def pagination(context, page, begin_pages=2, end_pages=2, before_current_pages=2, after_current_pages=2):
# Digg-like pages
before = max(page.number - before_current_pages - 1, 0)
afte... | {
"repo_name": "javipalanca/ojoalplato",
"path": "ojoalplato/blog/templatetags/pagination.py",
"copies": "1",
"size": "1581",
"license": "mit",
"hash": 1950312941630635500,
"line_mean": 31.2653061224,
"line_max": 105,
"alpha_frac": 0.6122707147,
"autogenerated": false,
"ratio": 3.6344827586206896,... |
from django import template
register = template.Library()
@register.inclusion_tag('resort/sort_link_frag.html', takes_context=True)
def sort_link(context, link_text, sort_field, visible_name=None):
"""Usage: {% sort_link "link text" "field_name" %}
Usage: {% sort_link "link text" "field_name" "Visible name" ... | {
"repo_name": "alixedi/django_resort",
"path": "resort/templatetags/resort.py",
"copies": "1",
"size": "3595",
"license": "bsd-3-clause",
"hash": -4878258806126673000,
"line_mean": 34.2450980392,
"line_max": 78,
"alpha_frac": 0.5379694019,
"autogenerated": false,
"ratio": 3.9988876529477198,
"c... |
from django import template
register = template.Library()
@register.inclusion_tag('scrumboard/extras/item_form.html')
def scrumboard_item_form(form):
return {'form': form}
@register.inclusion_tag('scrumboard/extras/item_full.html')
def scrumboard_item_full(item):
return {'item': item}
@register.inclusion... | {
"repo_name": "bodzio528/bagile",
"path": "scrumboard/templatetags/scrumboard_extras.py",
"copies": "1",
"size": "3707",
"license": "mit",
"hash": -3881697038115589600,
"line_mean": 31.8053097345,
"line_max": 149,
"alpha_frac": 0.6833018613,
"autogenerated": false,
"ratio": 3.2689594356261025,
... |
from django import template
register = template.Library()
@register.inclusion_tag('show_navigator.html', takes_context=True)
def show_navigator(context):
"""Show navigator"""
page = context['page']
index_begin = context['index_begin']
index_end = context['index_end']
index_total = context['index_... | {
"repo_name": "genonfire/bbgo",
"path": "core/templatetags/navigator.py",
"copies": "1",
"size": "1273",
"license": "mit",
"hash": -7765948636316782000,
"line_mean": 27.2888888889,
"line_max": 66,
"alpha_frac": 0.6150824823,
"autogenerated": false,
"ratio": 3.4592391304347827,
"config_test": fa... |
from django import template
register = template.Library()
@register.inclusion_tag('sorting/sort_link_frag.html', takes_context=True)
def sort_link(context, link_text, sort_field, visible_name=None):
"""Usage: {% sort_link "link text" "field_name" %}
Usage: {% sort_link "link text" "field_name" "Visible name"... | {
"repo_name": "agiliq/django-sorting",
"path": "sorting/templatetags/sorting.py",
"copies": "1",
"size": "3596",
"license": "bsd-3-clause",
"hash": -8992025071573378000,
"line_mean": 34.2549019608,
"line_max": 78,
"alpha_frac": 0.5380978865,
"autogenerated": false,
"ratio": 4.00445434298441,
"c... |
from django import template
register = template.Library()
@register.inclusion_tag('templatetags/tagbox.html')
def tagbox(input_dict, is_disabled=False):
"""
Renders tagbox widget
Takes the following keywords:
name: the name that corresponds to the input, will be in form when submitted
label: the... | {
"repo_name": "amberlallen/qipr_approver",
"path": "qipr_approver/approver/templatetags/tagbox.py",
"copies": "1",
"size": "1099",
"license": "apache-2.0",
"hash": 8699893972041515000,
"line_mean": 33.34375,
"line_max": 95,
"alpha_frac": 0.6942675159,
"autogenerated": false,
"ratio": 3.8159722222... |
from django import template
register = template.Library()
@register.inclusion_tag('tournament/extras/bots_in_match.html')
def order_bots_by_results(match, bot=None):
results = match.results.order_by('rank').all()
return {
'results': results,
'bot': bot,
}
@register.inclusion_tag('tournam... | {
"repo_name": "nmalaguti/mini-halite",
"path": "tournament/templatetags/tournament_extras.py",
"copies": "1",
"size": "1052",
"license": "mit",
"hash": 7228174511237278000,
"line_mean": 28.2222222222,
"line_max": 93,
"alpha_frac": 0.6273764259,
"autogenerated": false,
"ratio": 3.393548387096774,
... |
from django import template
register = template.Library()
@register.inclusion_tag('wagtailusers/groups/includes/formatted_permissions.html')
def format_permissions(permission_bound_field):
"""
Given a bound field with a queryset of Permission objects, constructs a
list of dictionaries for 'object... | {
"repo_name": "rjsproxy/wagtail",
"path": "wagtail/wagtailusers/templatetags/wagtailusers_tags.py",
"copies": "35",
"size": "2076",
"license": "bsd-3-clause",
"hash": -3278050853162705000,
"line_mean": 36.7454545455,
"line_max": 82,
"alpha_frac": 0.6112716763,
"autogenerated": false,
"ratio": 4.2... |
from django import template
register = template.Library()
@register.simple_tag
def dynamicform_js():
return '''
<script type="text/javascript">
$('form.dynamic-form button.validate-button').click(function(e) {
var $form = $(e).parent('form');
$.ajax({
url: $form.attr('action'),
type: "GET"... | {
"repo_name": "cdgagne/django-dynamicform",
"path": "dynamicform/templatetags/dynamicform.py",
"copies": "1",
"size": "1392",
"license": "mit",
"hash": 9032032730041275000,
"line_mean": 27.4081632653,
"line_max": 97,
"alpha_frac": 0.5316091954,
"autogenerated": false,
"ratio": 3.5692307692307694,... |
from django import template
register = template.Library()
@register.simple_tag
def get_order_by_querystring(ordering, current_order=None, remove=False):
"""
Using the ordering parameter (a list), returns a query string with the
orders of the columns
The parameter current_order can be passed along to... | {
"repo_name": "magnet-cl/django-project-template-py3",
"path": "base/templatetags/order_by_querystring.py",
"copies": "1",
"size": "1399",
"license": "mit",
"hash": -1912156175341253600,
"line_mean": 32.3095238095,
"line_max": 79,
"alpha_frac": 0.644031451,
"autogenerated": false,
"ratio": 4.3179... |
from django import template
register = template.Library()
@register.simple_tag
def get_order_by_querytring(ordering, current_order=None, remove=False):
"""
Using the ordering parameter (a list), returns a query string with the
orders of the columns
The parameter current_order can be passed along to ... | {
"repo_name": "Angoreher/xcero",
"path": "base/templatetags/order_by_querystring.py",
"copies": "1",
"size": "1398",
"license": "mit",
"hash": -4801668560322287000,
"line_mean": 32.2857142857,
"line_max": 79,
"alpha_frac": 0.643776824,
"autogenerated": false,
"ratio": 4.314814814814815,
"config... |
from django import template
register = template.Library()
@register.simple_tag
def is_selected(value, arr):
if str(value) in arr:
return 'selected'
return ''
@register.simple_tag
def show_restrict(rules, category):
if rules:
if str(category.id) in rules:
if rules[str(categor... | {
"repo_name": "nagyistoce/geokey",
"path": "geokey/users/templatetags/filter_tags.py",
"copies": "1",
"size": "1502",
"license": "apache-2.0",
"hash": -9146079040236316000,
"line_mean": 21.4179104478,
"line_max": 76,
"alpha_frac": 0.5599201065,
"autogenerated": false,
"ratio": 3.63680387409201,
... |
from django import template
register = template.Library()
@register.simple_tag
def upload_js():
return """
<!-- The template to display files available for upload -->
<script id="template-upload" type="text/x-tmpl">
{% for (var i=0, file; file=o.files[i]; i++) { %}
<tr class="template-upload fade">
<... | {
"repo_name": "stahlnow/stahlnow",
"path": "website/apps/fileupload/templatetags/upload_tags.py",
"copies": "1",
"size": "2978",
"license": "mit",
"hash": 3547984176561939500,
"line_mean": 35.3170731707,
"line_max": 215,
"alpha_frac": 0.4768300873,
"autogenerated": false,
"ratio": 3.4871194379391... |
from django import template
register = template.Library()
@register.simple_tag(takes_context=True)
def format_float(context, *args):
""" To use this tag, put {% load frontend_extras %} in your template. """
value = args[0]
trailing_numbers = args[1]
return "{0:.{1}f}".format(value, trailing_numbers)
... | {
"repo_name": "rryanburton/PicobrewServerDjango",
"path": "frontend/templatetags/frontend_extras.py",
"copies": "1",
"size": "1161",
"license": "mit",
"hash": 2574189594885166600,
"line_mean": 27.3414634146,
"line_max": 77,
"alpha_frac": 0.6020671835,
"autogenerated": false,
"ratio": 3.2160664819... |
from django import template
register = template.Library()
@register.simple_tag(takes_context=True)
def get_values(context, attribute_path, set_index='*', index='*'):
if set_index == '*' and index == '*':
try:
return context['values'][attribute_path]
except KeyError:
return... | {
"repo_name": "DMPwerkzeug/DMPwerkzeug",
"path": "rdmo/views/templatetags/view_tags.py",
"copies": "1",
"size": "3289",
"license": "apache-2.0",
"hash": 793115845920594600,
"line_mean": 30.0283018868,
"line_max": 83,
"alpha_frac": 0.6509577379,
"autogenerated": false,
"ratio": 3.691358024691358,
... |
from django import template
register = template.Library()
@register.simple_tag(takes_context=True)
def glitter_head(context):
"""
Template tag which renders the glitter CSS and JavaScript. Any resources
which need to be loaded should be added here. This is only shown to users
with permission to edit ... | {
"repo_name": "developersociety/django-glitter",
"path": "glitter/templatetags/glitter.py",
"copies": "2",
"size": "1593",
"license": "bsd-3-clause",
"hash": 1717526311370279400,
"line_mean": 31.5102040816,
"line_max": 77,
"alpha_frac": 0.6679221594,
"autogenerated": false,
"ratio": 3.84782608695... |
from django import template
register = template.Library()
@register.simple_tag(takes_context=True)
def query_string(context):
""" This template tag will return Query String used for this request.
Examples: if Query String was page=1&sort_by=occupation
{% query_string %} will produce page=3&sort_by=occup... | {
"repo_name": "Macainian/BaseDjangoProject",
"path": "website/templatetags/query_string.py",
"copies": "1",
"size": "1315",
"license": "mit",
"hash": -204742612132082530,
"line_mean": 28.2222222222,
"line_max": 101,
"alpha_frac": 0.7079847909,
"autogenerated": false,
"ratio": 3.8905325443786984,
... |
from django import template
register = template.Library()
@register.simple_tag(takes_context=True)
def render(context, obj, args):
"""
Try to render an attribute from an object. It will first look for a function called 'render_<attr_name>' on the
view, If this doesnt exist it will look for an attribute w... | {
"repo_name": "wildfish/django-directory",
"path": "directory/templatetags/directory_utils.py",
"copies": "1",
"size": "2245",
"license": "mit",
"hash": 7402723927675280000,
"line_mean": 35.8032786885,
"line_max": 125,
"alpha_frac": 0.6610244989,
"autogenerated": false,
"ratio": 4.001782531194296... |
from django import template
register = template.Library()
@register.tag(name='linkto')
def do_linkto(parser, token):
nodelist = parser.parse(('endlinkto',))
args = token.split_contents()[1:]
if not args:
raise template.TemplateSyntaxError("{0} tag requires at least one argument".format(token.cont... | {
"repo_name": "scardine/django-ember-tag",
"path": "ember.py",
"copies": "1",
"size": "1057",
"license": "mit",
"hash": -6134182057563050000,
"line_mean": 26.1025641026,
"line_max": 118,
"alpha_frac": 0.6338694418,
"autogenerated": false,
"ratio": 3.546979865771812,
"config_test": false,
"has... |
from django import template
register = template.Library()
@register.tag(name="wishlists_containing_product")
def do_basket_form(parse, token):
"""
Template tag for adding the user's wishlists form to the
template context so it can be rendered.
"""
tokens = token.split_contents()
if len(tokens... | {
"repo_name": "canhhs91/greenpointtrees",
"path": "src/oscar/templatetags/wishlist_tags.py",
"copies": "29",
"size": "1278",
"license": "mit",
"hash": -7354637180485432000,
"line_mean": 32.6315789474,
"line_max": 74,
"alpha_frac": 0.6424100156,
"autogenerated": false,
"ratio": 3.8963414634146343,... |
from django import template
register = template.Library()
@register.tag
def percentage(parser, token):
try:
# split_contents() knows not to split quoted strings.
tag_name, part, total = token.split_contents()
except ValueError:
t = token.contents.split()[0]
raise template.Temp... | {
"repo_name": "honza/wishlist-app",
"path": "web/templatetags/wishlist_extras.py",
"copies": "1",
"size": "1103",
"license": "bsd-2-clause",
"hash": -8862868770085750000,
"line_mean": 29.6388888889,
"line_max": 64,
"alpha_frac": 0.6282864914,
"autogenerated": false,
"ratio": 4.429718875502008,
... |
from django import template
register = template.Library()
@register.tag
def switch(parser, token):
"""
Switch tag. Usage::
{% switch meal %}
{% case "spam" %}...{% endcase %}
{% case "eggs" %}...{% endcase %}
{% default %}
No case matched.
{% enddefault %}
... | {
"repo_name": "lamby/django-switch-templatetag",
"path": "switch_templatetag/templatetags/switch.py",
"copies": "1",
"size": "3122",
"license": "bsd-3-clause",
"hash": -6743792879272222000,
"line_mean": 25.6837606838,
"line_max": 79,
"alpha_frac": 0.5893657912,
"autogenerated": false,
"ratio": 4.... |
from django import template
register = template.Library()
SORT_DIRECTIONS = {
"asc": {
"icon": "sort-by-attributes",
"inverse": "desc",
"inverse_icon": "sort-by-attributes-alt"
},
"desc": {
"icon": "sort-by-attributes-alt",
"inverse": "",
"inverse_icon": "r... | {
"repo_name": "aniversarioperu/django-manolo",
"path": "visitors/templatetags/visitors_tags.py",
"copies": "2",
"size": "3476",
"license": "bsd-3-clause",
"hash": -2134680547729486600,
"line_mean": 26.5873015873,
"line_max": 78,
"alpha_frac": 0.5883199079,
"autogenerated": false,
"ratio": 3.75377... |
from django import template
register = template.Library()
# TODO: Currently this is a complete copy of selector(which copies paginator I think) tag with another query param
# Hopefully this could refactored using a base class (something like django-classy-tags) to be just different by param
@register.inclusion_tag('... | {
"repo_name": "MeirKriheli/Open-Knesset",
"path": "ok_tag/templatetags/knesset_selection.py",
"copies": "6",
"size": "2185",
"license": "bsd-3-clause",
"hash": 1814943032841904600,
"line_mean": 59.6944444444,
"line_max": 118,
"alpha_frac": 0.5881006865,
"autogenerated": false,
"ratio": 3.38235294... |
from django import template
register = template.Library()
@register.assignment_tag(takes_context=True)
def get_site_root(context):
# NB this returns a core.Page, not the implementation-specific model used
# so object-comparison to self will return false as objects would differ
return context['request'].si... | {
"repo_name": "StratoBallooning/website",
"path": "sba/templatetags/sba_tags.py",
"copies": "1",
"size": "1939",
"license": "mit",
"hash": -399865646221582300,
"line_mean": 40.2553191489,
"line_max": 88,
"alpha_frac": 0.7003610108,
"autogenerated": false,
"ratio": 4.006198347107438,
"config_tes... |
from django import template
register = template.Library()
@register.filter(is_safe=False)
def add_string(value, arg):
try:
return str(value) + str(arg)
except (TypeError):
return ''
@register.simple_tag
def upload_js():
return """
<!-- The template to display files available for upload --... | {
"repo_name": "Irrialite/YouTune",
"path": "youtune/fileupload/templatetags/upload_tags.py",
"copies": "1",
"size": "2994",
"license": "bsd-3-clause",
"hash": -1715476116188872000,
"line_mean": 41.1690140845,
"line_max": 174,
"alpha_frac": 0.5160320641,
"autogenerated": false,
"ratio": 3.40227272... |
from django import template
register = template.Library()
@register.filter(name='ellipses_page_range')
def ellipses_page_range(page, args="1,2"):
"""
Creates digg-style page_range for pagination
Paginator.page_range returns range of all page numbers. For very long
lists it isn't suitable (displaying ... | {
"repo_name": "ruddra/django-oscar",
"path": "oscar/templatetags/ellipses_pagination.py",
"copies": "4",
"size": "2688",
"license": "bsd-3-clause",
"hash": 7266976095056842000,
"line_mean": 34.84,
"line_max": 80,
"alpha_frac": 0.6722470238,
"autogenerated": false,
"ratio": 3.7752808988764044,
"... |
from django import template
register = template.Library()
@register.filter(name = 'implode')
def implode(lst, sep = ' - '):
return str(sep).join("%s" % (v) for v in lst)
"""
Tag que devuelve un atributo class con el texto pasado
"""
@register.tag(name = 'css_classes')
def css_classes(parser, token):
try:
... | {
"repo_name": "MERegistro/meregistro",
"path": "meregistro/custom_tags_filters/templatetags/tags_filters.py",
"copies": "1",
"size": "1119",
"license": "bsd-3-clause",
"hash": 9191512097686536000,
"line_mean": 23.3260869565,
"line_max": 54,
"alpha_frac": 0.6112600536,
"autogenerated": false,
"rat... |
from django import template
register = template.Library()
@register.filter(name='std_level_prompt')
def std_level_prompt(doc):
"""
Returns the name from the std level names table corresponding
to the object's intended_std_level (with the word RFC appended in some
cases), or a prompt requesting that th... | {
"repo_name": "wpjesus/codematch",
"path": "ietf/doc/templatetags/mail_filters.py",
"copies": "2",
"size": "1232",
"license": "bsd-3-clause",
"hash": -3496819081224697000,
"line_mean": 33.2222222222,
"line_max": 97,
"alpha_frac": 0.6737012987,
"autogenerated": false,
"ratio": 3.74468085106383,
... |
from django import template
register = template.Library()
@register.filter
def formatTaskType(value):
if value == "vzcreate":
return "Created Container"
elif value == "vzstart":
return "Started Container"
elif value == "vzshutdown":
return "Shutdown Container"
elif value == "vzstop":
return "Stopped Conta... | {
"repo_name": "Tomcuzz/OctaHomeAutomation",
"path": "OctaHomeProxmox/templatetags/proxmox_name_convertion.py",
"copies": "1",
"size": "1100",
"license": "mit",
"hash": -6834069979232282000,
"line_mean": 22.4255319149,
"line_max": 47,
"alpha_frac": 0.6909090909,
"autogenerated": false,
"ratio": 3.... |
from django import template
register = template.Library()
@register.filter
def get_range(value):
"""
Filter - returns a list containing range made from given value
Usage (in template):
<ul>{% for i in 3|get_range %}
<li>{{ i }}. Do something</li>
{% endfor %}</ul>
Results with the HTML... | {
"repo_name": "mattr555/AtYourService",
"path": "main/templatetags/mytags.py",
"copies": "1",
"size": "1669",
"license": "mit",
"hash": 4297748385858151400,
"line_mean": 20.3974358974,
"line_max": 66,
"alpha_frac": 0.6273217496,
"autogenerated": false,
"ratio": 3.259765625,
"config_test": false... |
from django import template
register = template.Library()
@register.filter
def list_to_int(value):
ans = []
for i in value:
ans.append(int(i))
return ans
@register.filter
def to_int(value):
return int(value)
@register.filter
def get_item0(value, arg):
return value[arg-1]
@register.filte... | {
"repo_name": "fosslabs/django-school",
"path": "src/school/templatetags/school_extras.py",
"copies": "1",
"size": "1259",
"license": "bsd-3-clause",
"hash": -5749236999827244000,
"line_mean": 18.3692307692,
"line_max": 39,
"alpha_frac": 0.6250992851,
"autogenerated": false,
"ratio": 3.1163366336... |
from django import template
register = template.Library()
@register.filter
def truncatewords_by_chars(value, limit):
"""
Truncates a string after a given number of chars keeping whole words.
Usage:
{{ string|truncatesmart }}
{{ string|truncatesmart:50 }}
"""
try:
... | {
"repo_name": "vLj2/docman",
"path": "app/templatetags/truncatewords_by_chars.py",
"copies": "1",
"size": "1033",
"license": "bsd-2-clause",
"hash": 1890841557599184400,
"line_mean": 23.023255814,
"line_max": 73,
"alpha_frac": 0.5750242014,
"autogenerated": false,
"ratio": 4.08300395256917,
"co... |
from django import template
register = template.Library()
@register.inclusion_tag('admin/prepopulated_fields_js.html', takes_context=True)
def prepopulated_fields_js(context):
"""
Creates a list of prepopulated_fields that should render Javascript for
the prepopulated fields for both the admin form and in... | {
"repo_name": "ericholscher/django",
"path": "django/contrib/admin/templatetags/admin_modify.py",
"copies": "1",
"size": "2309",
"license": "bsd-3-clause",
"hash": 5946702079773373000,
"line_mean": 38.8103448276,
"line_max": 120,
"alpha_frac": 0.6470333478,
"autogenerated": false,
"ratio": 3.9605... |
from django import template
register = template.Library()
@register.inclusion_tag('jslibs.html')
def load_js_libs(*args):
js_libs = {'jquery' : '//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js',
'jquery-ui': '//ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js',
... | {
"repo_name": "pellagic-puffbomb/django-mapfiles",
"path": "djangomapfiles/templatetags/jslibs.py",
"copies": "1",
"size": "1236",
"license": "bsd-3-clause",
"hash": 2468902818279722500,
"line_mean": 44.7777777778,
"line_max": 107,
"alpha_frac": 0.5566343042,
"autogenerated": false,
"ratio": 3.31... |
from django import template
register = template.Library()
@register.inclusion_tag('paginator.html', takes_context=True)
def paginator(context, adjacent_pages=2):
"""
To be used in conjunction with the object_list generic view.
Adds pagination context variables for use in displaying first, adjacent and
... | {
"repo_name": "gdoermann/django-limbo",
"path": "limbo/templatetags/pagination.py",
"copies": "1",
"size": "1084",
"license": "mit",
"hash": -8784239888636481000,
"line_mean": 36.3793103448,
"line_max": 99,
"alpha_frac": 0.6060885609,
"autogenerated": false,
"ratio": 4.106060606060606,
"config_... |
from django import template
register = template.Library()
@register.inclusion_tag('searchutil/pagination.html')
def pagination_links(paginator_page, show_pages, url_params=None,
first_page_label=None, last_page_label=None,
page_url=''):
'''Django template tag to display p... | {
"repo_name": "emory-libraries/eulcommon",
"path": "eulcommon/searchutil/templatetags/search_utils.py",
"copies": "1",
"size": "1442",
"license": "apache-2.0",
"hash": 4171089707036587000,
"line_mean": 35.05,
"line_max": 70,
"alpha_frac": 0.6463245492,
"autogenerated": false,
"ratio": 4.096590909... |
from django import template
register = template.Library()
@register.simple_tag
def generate_feed_list(feed, amount=None, list_class=None, li_class=None, list_type='ul'):
"""Generates a HTML list with items from a feed
:param feed: The feed to generate the list from.
:type feed: Feed
:param amount: Th... | {
"repo_name": "rschroen/django-xfeed",
"path": "xfeed/templatetags/xfeed_tags.py",
"copies": "1",
"size": "1842",
"license": "isc",
"hash": -7024086270184632000,
"line_mean": 38.1914893617,
"line_max": 127,
"alpha_frac": 0.5537459283,
"autogenerated": false,
"ratio": 3.5766990291262135,
"config... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.