text stringlengths 0 1.05M | meta dict |
|---|---|
from django import template
from django.utils import html
from django.utils.safestring import mark_safe
from ngw.core import perms
register = template.Library()
@register.filter
def nav_is_active(navbar, tabname):
if navbar == '': # Undefined
return ''
if len(navbar.components) < 2:
activet... | {
"repo_name": "nirgal/ngw",
"path": "core/templatetags/ngwtags.py",
"copies": "1",
"size": "2456",
"license": "bsd-2-clause",
"hash": -2503026595979327000,
"line_mean": 24.3195876289,
"line_max": 79,
"alpha_frac": 0.6596091205,
"autogenerated": false,
"ratio": 3.406380027739251,
"config_test": ... |
from django import template
from django.utils import html
from django.utils.safestring import mark_safe
register = template.Library()
LANG_BUTTON = ' <span style="color: #FFFFFF; text-decoration:none;" class="btn btn-mini btn-inverse btn-langcode-preprocessed%(extra_class)s">%(lang)s</span>'
EMPTY_LABEL = '<span clas... | {
"repo_name": "puttarajubr/commcare-hq",
"path": "corehq/apps/app_manager/templatetags/xforms_extras.py",
"copies": "2",
"size": "2332",
"license": "bsd-3-clause",
"hash": 4262202467601430500,
"line_mean": 32.3285714286,
"line_max": 158,
"alpha_frac": 0.6110634648,
"autogenerated": false,
"ratio"... |
from django import template
from django.utils import html
register = template.Library()
def _collect(context, name):
if not context[name]:
return ''
res = ''
for node in context[name]():
res += node
return res
class DeferHtml(template.Node):
def __init__(self, nodelist):
s... | {
"repo_name": "IT-PM-OpenAdaptronik/Webapp",
"path": "apps/utils/templatetags/defer.py",
"copies": "1",
"size": "1285",
"license": "mit",
"hash": 4934462836158136000,
"line_mean": 25.2244897959,
"line_max": 67,
"alpha_frac": 0.6692607004,
"autogenerated": false,
"ratio": 3.6505681818181817,
"co... |
from django import template
from django.utils import http
from common.util import create_nonce, safe
from common import api
from common import exception
import settings
def safe_avatar(f):
def _wrapper(*args, **kwargs):
try:
return f(*args, **kwargs)
except:
exception.log_exception()
if set... | {
"repo_name": "AloneRoad/Inforlearn",
"path": "common/templatetags/avatar.py",
"copies": "1",
"size": "3321",
"license": "apache-2.0",
"hash": -6695826447099974000,
"line_mean": 26.675,
"line_max": 82,
"alpha_frac": 0.6564287865,
"autogenerated": false,
"ratio": 3.4237113402061854,
"config_test... |
from django import template
from django.utils.importlib import import_module
from django.contrib.auth.models import User
from news.models import News, NewsWatches, NewsPortal, NewsCategory, RssPortals, RssNewsCovers, Companies, \
UserRssNewsReading, RssNews
from userprofile.models import UserSettings
from django.co... | {
"repo_name": "eprivalov/sendec",
"path": "news/templatetags/my.py",
"copies": "1",
"size": "5561",
"license": "apache-2.0",
"hash": -597611277423688700,
"line_mean": 28.743315508,
"line_max": 139,
"alpha_frac": 0.7236108614,
"autogenerated": false,
"ratio": 3.161455372370665,
"config_test": fa... |
from django import template
from django.utils import safestring
import re
try:
import markdown
except ImportError:
print u"Requires Markdown library to use Markdown tag."
try:
import pygments
from pygments import lexers
from pygments import formatters
except ImportError:
print u"Requires Pygme... | {
"repo_name": "lethain/resume-interactivity-provider",
"path": "aym_tags/templatetags/aym.py",
"copies": "1",
"size": "1801",
"license": "mit",
"hash": -2178097546929361400,
"line_mean": 25.1014492754,
"line_max": 71,
"alpha_frac": 0.6801776791,
"autogenerated": false,
"ratio": 3.9067245119305856... |
from django import template
from django.utils import safestring
import hashlib
register = template.Library()
@register.tag(name="textile")
def textileParser(parser, token):
nodelist = parser.parse(('endtextile',))
parser.delete_first_token()
return TextileNode(nodelist)
class TextileNode(template.Node):... | {
"repo_name": "lachenmayer/hyde",
"path": "hydeengine/templatetags/aym.py",
"copies": "4",
"size": "2696",
"license": "mit",
"hash": -5431007708731724000,
"line_mean": 27.3789473684,
"line_max": 79,
"alpha_frac": 0.640578635,
"autogenerated": false,
"ratio": 4.166924265842349,
"config_test": fa... |
from django import template
from django.utils import safestring
import hashlib
try:
import pygments
from pygments import lexers
from pygments import formatters
except ImportError:
pygments = False
register = template.Library()
@register.tag(name="textile")
def textileParser(parser, token):
n... | {
"repo_name": "tvon/hyde",
"path": "hydeengine/templatetags/aym.py",
"copies": "1",
"size": "2711",
"license": "mit",
"hash": 4854922451442130000,
"line_mean": 26.6632653061,
"line_max": 79,
"alpha_frac": 0.6466248617,
"autogenerated": false,
"ratio": 4.126331811263318,
"config_test": false,
... |
from django import template
from django.utils import safestring
import md5
try:
import markdown
except ImportError:
print u"Requires Markdown library to use Markdown tag."
try:
import pygments
from pygments import lexers
from pygments import formatters
except ImportError:
print u"Requires Pyg... | {
"repo_name": "lethain/aym-cms",
"path": "aym_tags/templatetags/aym.py",
"copies": "1",
"size": "2035",
"license": "mit",
"hash": -8837319826348334000,
"line_mean": 26.1333333333,
"line_max": 78,
"alpha_frac": 0.6702702703,
"autogenerated": false,
"ratio": 3.943798449612403,
"config_test": fals... |
from django import template
from django.utils import simplejson as json
from django.conf import settings
register = template.Library()
@register.simple_tag(takes_context=True)
def get_admin_context(context):
ctx = {'location':None, 'param1':None, 'param2':None, 'static':settings.STATIC_URL}
try:
conte... | {
"repo_name": "asmedrano/django-radmin-console",
"path": "radmin/templatetags/radmin_extras.py",
"copies": "1",
"size": "1400",
"license": "bsd-2-clause",
"hash": -3932255728547628000,
"line_mean": 28.7872340426,
"line_max": 87,
"alpha_frac": 0.58,
"autogenerated": false,
"ratio": 3.8356164383561... |
from django import template
from django.utils import simplejson
register = template.Library()
@register.filter()
def remaining_capacity_by_flavors(obj):
flavors = obj.list_flavors
decorated_obj = " ".join(
[("<p><strong>{0}</strong> {1}</p>").format(
str(flavor.used_instances),
... | {
"repo_name": "tuskar/tuskar-ui",
"path": "openstack_dashboard/dashboards/infrastructure/templatetags/chart_helpers.py",
"copies": "1",
"size": "1042",
"license": "apache-2.0",
"hash": -3926884671505285000,
"line_mean": 25.05,
"line_max": 65,
"alpha_frac": 0.5873320537,
"autogenerated": false,
"r... |
from django import template
from django.utils import six
from django.utils.html import conditional_escape
from django.utils.encoding import force_text
from django.utils.safestring import mark_safe
register = template.Library()
@register.filter
def semanticui(form):
top_errors = form.non_field_errors() # Errors ... | {
"repo_name": "dpitkevics/Django-Semantic-UI-Forms",
"path": "semanticui_forms/templatetags/semanticui.py",
"copies": "1",
"size": "4715",
"license": "mit",
"hash": 6115003541352211000,
"line_mean": 43.0747663551,
"line_max": 170,
"alpha_frac": 0.5213149523,
"autogenerated": false,
"ratio": 4.064... |
from django import template
from django.utils import timezone
from django.contrib.sites.models import Site
from django.contrib.contenttypes.models import ContentType
from dogood.models import Blog, Post
import re
import datetime
register = template.Library()
def user_blog(user):
"""
Returns a given user's bl... | {
"repo_name": "MidwestCommunications/django-dogood",
"path": "dogood/templatetags/blog_tags.py",
"copies": "1",
"size": "7533",
"license": "mit",
"hash": -3571584875566908400,
"line_mean": 29.7469387755,
"line_max": 153,
"alpha_frac": 0.6221956724,
"autogenerated": false,
"ratio": 3.6303614457831... |
from django import template
from django.utils import timezone
from django.utils.translation import ugettext_lazy as _
from users.models import CommunityMembership
register = template.Library()
@register.filter
def display_upcoming_time(committee):
""" display only date if hour information if not set (remains at ... | {
"repo_name": "yaniv14/OpenCommunity",
"path": "src/communities/templatetags/community_tags.py",
"copies": "1",
"size": "2155",
"license": "bsd-3-clause",
"hash": -218392707040772220,
"line_mean": 28.5205479452,
"line_max": 85,
"alpha_frac": 0.580974478,
"autogenerated": false,
"ratio": 3.9907407... |
from django import template
from django.utils import timezone
from django.utils.translation import ugettext_lazy as _
from users.models import Membership
register = template.Library()
@register.filter
def display_upcoming_time(community):
""" display only date if hour information if not set (remains at default '... | {
"repo_name": "hasadna/OpenCommunity",
"path": "src/communities/templatetags/community_tags.py",
"copies": "1",
"size": "2017",
"license": "bsd-3-clause",
"hash": -1467106074719102700,
"line_mean": 29.1044776119,
"line_max": 84,
"alpha_frac": 0.574615766,
"autogenerated": false,
"ratio": 4.099593... |
from django import template
from django.utils import timezone
from django.utils.translation import ugettext_lazy as _
from users.models import Membership
register = template.Library()
@register.filter
def display_upcoming_time(committee):
""" display only date if hour information if not set (remains at default '... | {
"repo_name": "nonZero/OpenCommunity",
"path": "src/communities/templatetags/community_tags.py",
"copies": "1",
"size": "2137",
"license": "bsd-3-clause",
"hash": -4812580025147124000,
"line_mean": 28.2739726027,
"line_max": 85,
"alpha_frac": 0.5774450164,
"autogenerated": false,
"ratio": 3.98694... |
from django import template
from django.utils import timezone
from issues.models import Issue
from issues.model_issue_status import IssueStatus
from lessons.models import Lesson
from tasks.models import Task
register = template.Library()
@register.filter(name='score')
def task_taken_score(d, task):
if task.id in... | {
"repo_name": "znick/anytask",
"path": "anytask/courses/templatetags/task_taken_func.py",
"copies": "1",
"size": "2950",
"license": "mit",
"hash": 5522714148985160000,
"line_mean": 30.7204301075,
"line_max": 101,
"alpha_frac": 0.5955932203,
"autogenerated": false,
"ratio": 3.678304239401496,
"c... |
from django import template
from django.utils import timezone
import time
from django.conf import settings
register = template.Library()
try:
monit_update_period = settings.MONIT_UPDATE_PERIOD
except:
monit_update_period = 60
@register.filter
def timestamp_to_date(timestamp):
if not isinstance(timestamp, ... | {
"repo_name": "nleng/django-monit-collector",
"path": "src/monitcollector/templatetags/monitcollector_tags.py",
"copies": "1",
"size": "2267",
"license": "bsd-3-clause",
"hash": -2352637511891984400,
"line_mean": 27.3375,
"line_max": 137,
"alpha_frac": 0.6224084693,
"autogenerated": false,
"ratio... |
from django import template
from django.utils import timezone
import time
import settings
register = template.Library()
update_period = getattr(settings, 'UPDATE_PERIOD', 60)
@register.filter
def timestamp_to_date(timestamp):
if not isinstance(timestamp, int):
return ""
return timezone.datetime.fromti... | {
"repo_name": "nleng/djangovisor",
"path": "djangovisor/templatetags/djangovisor_tags.py",
"copies": "1",
"size": "2046",
"license": "bsd-3-clause",
"hash": 2880186854911533000,
"line_mean": 24.2592592593,
"line_max": 59,
"alpha_frac": 0.6251221896,
"autogenerated": false,
"ratio": 3.438655462184... |
from django import template
from django.utils import timezone
from ultimate.leagues.models import League
register = template.Library()
@register.filter
def sort_by_league_start_date_weekday(league_divisions):
divisions = [d for d in league_divisions if d.type == League.LEAGUE_TYPE_LEAGUE]
divisions.sort(ke... | {
"repo_name": "rdonnelly/ultimate-league-app",
"path": "src/ultimate/templatetags/leagues.py",
"copies": "2",
"size": "1866",
"license": "bsd-3-clause",
"hash": 8218892917998255000,
"line_mean": 24.5616438356,
"line_max": 91,
"alpha_frac": 0.7540192926,
"autogenerated": false,
"ratio": 3.25087108... |
from django import template
from django.utils import translation
from livesettings import config_get_group
from payment.modules.google import CHECKOUT_BUTTON_SIZES
from django.utils.http import urlencode
register = template.Library()
def _truefalse(val, t="1", f="0"):
if val:
return t
else:
re... | {
"repo_name": "thoreg/satchmo",
"path": "satchmo/apps/payment/templatetags/satchmo_googlecheckout.py",
"copies": "12",
"size": "2405",
"license": "bsd-3-clause",
"hash": 926412699408247400,
"line_mean": 31.0666666667,
"line_max": 143,
"alpha_frac": 0.6203742204,
"autogenerated": false,
"ratio": 3... |
from django import template
from django.utils import translation
from satchmo.configuration import config_get_group
from satchmo.payment.modules.google import CHECKOUT_BUTTON_SIZES
from urllib import urlencode
register = template.Library()
def _truefalse(val, t="1", f="0"):
if val:
return t
else:
... | {
"repo_name": "sankroh/satchmo",
"path": "satchmo/payment/templatetags/satchmo_googlecheckout.py",
"copies": "2",
"size": "2411",
"license": "bsd-3-clause",
"hash": 3489717964204345000,
"line_mean": 31.1466666667,
"line_max": 143,
"alpha_frac": 0.6213189548,
"autogenerated": false,
"ratio": 3.945... |
from django import template
from django.utils import translation
import locale
locale.setlocale(locale.LC_ALL, translation.to_locale(translation.get_language()) + '.UTF-8')
register = template.Library()
@register.filter_function
def truncatechars(value, l):
if len(value) > l:
return value[:l] + '...'
return valu... | {
"repo_name": "sunlightlabs/upwardly",
"path": "src/movingup/templatetags/movingup_tags.py",
"copies": "1",
"size": "1196",
"license": "bsd-3-clause",
"hash": -3072561554403973000,
"line_mean": 22.92,
"line_max": 93,
"alpha_frac": 0.7081939799,
"autogenerated": false,
"ratio": 3.090439276485788,
... |
from django import template
from django.utils.safestring import mark_safe as safe
from django.utils.html import escape
from dojo.models import Product_Type, Alerts
from dojo.utils import get_alerts
register = template.Library()
@register.inclusion_tag('alert_nav_items.html')
def alert_nav_items(user):
alerts = ... | {
"repo_name": "yan99uic/django-DefectDojo",
"path": "dojo/templatetags/navigation_tags.py",
"copies": "1",
"size": "4470",
"license": "bsd-3-clause",
"hash": -8913498653759678000,
"line_mean": 28.8,
"line_max": 115,
"alpha_frac": 0.5941834452,
"autogenerated": false,
"ratio": 3.7281067556296916,
... |
from django import template
from django.utils.safestring import mark_safe as safe
from django.utils.html import escape
from dojo.models import Product_Type, Alerts
register = template.Library()
@register.simple_tag(takes_context=True)
def alert_count(context):
count = Alerts.objects.filter(user_id=context['requ... | {
"repo_name": "Prakhash/security-tools",
"path": "external/django-DefectDojo-1.2.1/dojo/templatetags/navigation_tags.py",
"copies": "4",
"size": "4294",
"license": "apache-2.0",
"hash": 8409639428150644000,
"line_mean": 29.027972028,
"line_max": 115,
"alpha_frac": 0.5896599907,
"autogenerated": fal... |
from django import template
from django.utils.safestring import mark_safe as safe
from django.utils.html import escape
from dojo.models import Product_Type
from dojo.utils import get_alerts
register = template.Library()
@register.inclusion_tag('alert_nav_items.html')
def alert_nav_items(user):
alerts = get_aler... | {
"repo_name": "grendel513/django-DefectDojo",
"path": "dojo/templatetags/navigation_tags.py",
"copies": "1",
"size": "4441",
"license": "bsd-3-clause",
"hash": -2783437842431439400,
"line_mean": 28.6066666667,
"line_max": 115,
"alpha_frac": 0.5924341365,
"autogenerated": false,
"ratio": 3.7350714... |
from django import template
from django.utils.safestring import mark_safe as safe
from dojo.models import Product_Type
register = template.Library()
@register.inclusion_tag('alert_nav_items.html')
def alert_nav_items(user):
from dojo.views import get_alerts
alerts = get_alerts(user)
return {'alerts': ... | {
"repo_name": "ksmaheshkumar/django-DefectDojo",
"path": "dojo/templatetags/navigation_tags.py",
"copies": "1",
"size": "2676",
"license": "bsd-3-clause",
"hash": 5924507989450764000,
"line_mean": 27.4680851064,
"line_max": 74,
"alpha_frac": 0.6401345291,
"autogenerated": false,
"ratio": 3.660738... |
from django import template
from django.utils.safestring import mark_safe
from banana.convert import deg_to_dms, deg_to_hms, deg_to_asec
from collections import OrderedDict
register = template.Library()
# Handling unicode in an URL string is tricky (damn you, mu!).
# So we use a map of ascii_key -> ((optionally unic... | {
"repo_name": "bartscheers/banana",
"path": "banana/templatetags/units.py",
"copies": "1",
"size": "3033",
"license": "bsd-3-clause",
"hash": 1540268372381875500,
"line_mean": 27.3457943925,
"line_max": 83,
"alpha_frac": 0.6033630069,
"autogenerated": false,
"ratio": 3.275377969762419,
"config_... |
from django import template
from django.utils.safestring import mark_safe
from basic_newsletter.models import TemplateMediaFile, TemplateAttribute
import re
register = template.Library()
@register.filter
def media_url(template, media_name):
template_media_files = TemplateMediaFile.objects.filter(template=templat... | {
"repo_name": "CIGIHub/newsletter_generator",
"path": "basic_newsletter/templatetags/paths.py",
"copies": "1",
"size": "3040",
"license": "mit",
"hash": -225589475106241250,
"line_mean": 35.1904761905,
"line_max": 84,
"alpha_frac": 0.5763157895,
"autogenerated": false,
"ratio": 3.5806831566548882... |
from django import template
from django.utils.safestring import mark_safe
from django.contrib.humanize.templatetags.humanize import intcomma
import json as json_lib
from collections import OrderedDict
from ..models import Harvest
from .. import auth
register = template.Library()
@register.filter
def json(value, nam... | {
"repo_name": "gwu-libraries/sfm",
"path": "sfm/ui/templatetags/ui_extras.py",
"copies": "2",
"size": "4718",
"license": "mit",
"hash": -6379789023535513000,
"line_mean": 24.0957446809,
"line_max": 103,
"alpha_frac": 0.5919881306,
"autogenerated": false,
"ratio": 3.539384846211553,
"config_test... |
from django import template
from django.utils.safestring import mark_safe
from django.core.exceptions import ObjectDoesNotExist
from advancedsearch.models import *
from problems.models import *
from browseNet.models import Path
register = template.Library()
class DeleteNode(template.Node):
def __init... | {
"repo_name": "HM2MC/Webfront",
"path": "m2m/advancedsearch/templatetags/advancedsearch_extras.py",
"copies": "2",
"size": "1265",
"license": "mit",
"hash": 8307302316690571000,
"line_mean": 29.119047619,
"line_max": 125,
"alpha_frac": 0.6434782609,
"autogenerated": false,
"ratio": 4.041533546325... |
from django import template
from django.utils.safestring import mark_safe
from django.core.urlresolvers import reverse
#from django.template.defaultfilters import stringfilter
register = template.Library()
@register.simple_tag(takes_context=True, name='ii')
def inline_image(context, param, position=None):
reques... | {
"repo_name": "mihow/footer",
"path": "footer/magic/templatetags/footer_magic.py",
"copies": "1",
"size": "1351",
"license": "mit",
"hash": -8983885313954092000,
"line_mean": 37.6,
"line_max": 95,
"alpha_frac": 0.666173205,
"autogenerated": false,
"ratio": 3.5,
"config_test": false,
"has_no_k... |
from django import template
from django.utils.safestring import mark_safe
from django.core.urlresolvers import reverse
from wp_frontman.blog import Blog
from wp_frontman.lib.utils import make_tree, OrderedDict
register = template.Library()
class WPFrontmanComments(template.Node):
def __init__(self, post, ... | {
"repo_name": "ludoo/wpkit",
"path": "attic/wpfrontman/wp_frontman/templatetags/wpf_comments.py",
"copies": "1",
"size": "8821",
"license": "bsd-3-clause",
"hash": -8440773487727919000,
"line_mean": 39.0954545455,
"line_max": 188,
"alpha_frac": 0.491894343,
"autogenerated": false,
"ratio": 4.6183... |
from django import template
from django.utils.safestring import mark_safe
from django.core.urlresolvers import reverse
register = template.Library()
@register.simple_tag(takes_context=True)
def order_th(context, name, field):
order_by = context['pager'].params.get('order_by')
desc = False
if order_by == ... | {
"repo_name": "beastbikes/django-adminlte",
"path": "adminlte/templatetags/adminlte_extras.py",
"copies": "1",
"size": "1708",
"license": "mit",
"hash": -2360870849062820000,
"line_mean": 33.16,
"line_max": 120,
"alpha_frac": 0.6639344262,
"autogenerated": false,
"ratio": 3.478615071283096,
"co... |
from django import template
from django.utils.safestring import mark_safe
from django.template.base import Node
register = template.Library()
from tag_parser import template_tag
from tag_parser.basetags import BaseNode
@template_tag(register, 'asset')
class JsCssAssetNode(BaseNode):
"""
Implement asset filte... | {
"repo_name": "lsc20051426/cdn-asserts",
"path": "cdn_assets/templatetags/cdn_assets.py",
"copies": "1",
"size": "3436",
"license": "bsd-2-clause",
"hash": 9111330487828724000,
"line_mean": 27.6333333333,
"line_max": 94,
"alpha_frac": 0.5908032596,
"autogenerated": false,
"ratio": 3.4463390170511... |
from django import template
from django.utils.safestring import mark_safe
from django.template.loader import render_to_string
register = template.Library()
@register.filter
def render_field(field, template=None):
"""
Renders the specified Form field.
Example::
{{ form.first_name|render_f... | {
"repo_name": "kylefox/django-form-helpers",
"path": "form_helpers/templatetags/form_helpers.py",
"copies": "1",
"size": "3106",
"license": "bsd-3-clause",
"hash": -9165940922016108000,
"line_mean": 29.4607843137,
"line_max": 99,
"alpha_frac": 0.6155827431,
"autogenerated": false,
"ratio": 3.8728... |
from django import template
from django.utils.safestring import mark_safe
from django.utils.encoding import force_unicode
import markdown_deux
from markdown_deux.conf import settings
register = template.Library()
@register.filter(name="markdown")
def markdown_filter(value, style="default"):
"""Processes the gi... | {
"repo_name": "sariyanidi/academics-webpage",
"path": "lib/python2.7/site-packages/markdown_deux/templatetags/markdown_deux_tags.py",
"copies": "1",
"size": "2365",
"license": "mit",
"hash": -3850056845965025000,
"line_mean": 30.9594594595,
"line_max": 89,
"alpha_frac": 0.6549682875,
"autogenerated... |
from django import template
from django.utils.safestring import mark_safe
from django.utils.encoding import force_unicode
import markdown
from markitup.fields import render_func
register = template.Library()
@register.filter(name="markdown")
def markdown_filter(value):
"""Processes the given value as Markdown, ... | {
"repo_name": "Iv/django-markiup-filebrowser",
"path": "markitup_filebrowser/templatetags/markdown_tags.py",
"copies": "1",
"size": "1361",
"license": "bsd-3-clause",
"hash": 7337332009003946000,
"line_mean": 28.5869565217,
"line_max": 79,
"alpha_frac": 0.6627479794,
"autogenerated": false,
"rati... |
from django import template
from django.utils.safestring import mark_safe
from django.utils.encoding import force_unicode
register = template.Library()
@register.filter()
def tag_tree(value, autoescape=None):
"""
Portions of this function are taken from django/template/defaultfilters.py
Based on the djang... | {
"repo_name": "trickv/fspot_browser",
"path": "browser/templatetags/tag_tree.py",
"copies": "1",
"size": "1953",
"license": "bsd-3-clause",
"hash": 1072484892694438300,
"line_mean": 35.1666666667,
"line_max": 91,
"alpha_frac": 0.5309779826,
"autogenerated": false,
"ratio": 4.077244258872652,
"c... |
from django import template
from django.utils.safestring import mark_safe
from django.utils.html import conditional_escape
register = template.Library()
@register.filter(name='bootstrapcheck')
def bootstrapcheck(value):
if value:
text = '<span class="badge badge-success"><i class="icon-ok icon-white"></i... | {
"repo_name": "Bionetbook/bionetbook",
"path": "bnbapp/core/templatetags/core_tags.py",
"copies": "1",
"size": "6048",
"license": "mit",
"hash": -2386089384489451500,
"line_mean": 27.261682243,
"line_max": 209,
"alpha_frac": 0.5110780423,
"autogenerated": false,
"ratio": 3.5513799177921315,
"co... |
from django import template
from django.utils.safestring import mark_safe
from django.utils.html import escape
from django.utils.text import capfirst
from django_easyfilters.filters import FILTER_ADD, FILTER_REMOVE, FILTER_DISPLAY, \
ValuesFilter, ChoicesFilter, ForeignKeyFilter, ManyToManyFilter, DateTimeFilter, ... | {
"repo_name": "georgemarshall/django-easyfilters",
"path": "django_easyfilters/filterset.py",
"copies": "1",
"size": "4916",
"license": "mit",
"hash": -2899023969067636000,
"line_mean": 34.8832116788,
"line_max": 141,
"alpha_frac": 0.5673311635,
"autogenerated": false,
"ratio": 4.0561056105610565... |
from django import template
from django.utils.safestring import mark_safe
from django.utils.html import escape
from django.utils.translation import ugettext as _
from django.contrib.admin.views.main import PAGE_VAR, ALL_VAR
from django.conf import settings
from django.contrib.sites.models import Site
from BeautifulSou... | {
"repo_name": "quinode/django-admintools-bootstrap",
"path": "admintools_bootstrap/templatetags/admintools_bootstrap.py",
"copies": "2",
"size": "6117",
"license": "mit",
"hash": -1135944729832153700,
"line_mean": 33.5593220339,
"line_max": 109,
"alpha_frac": 0.5669445807,
"autogenerated": false,
... |
from django import template
from django.utils.safestring import mark_safe
from django.utils.html import escape
import re
from django.template import Node
from django.utils.encoding import smart_str, smart_unicode
from django.template.defaultfilters import stringfilter
register = template.Library()
rx = re.compile(r'(%... | {
"repo_name": "rchand31/django-rosetta",
"path": "rosetta/templatetags/rosetta.py",
"copies": "3",
"size": "2126",
"license": "mit",
"hash": -1476945325567814100,
"line_mean": 26.9736842105,
"line_max": 91,
"alpha_frac": 0.6782690499,
"autogenerated": false,
"ratio": 3.407051282051282,
"config_... |
from django import template
from django.utils.safestring import mark_safe
from django.utils.html import escape
import re
from django.template import Node
import six
register = template.Library()
rx = re.compile(r'(%(\([^\s\)]*\))?[sd])')
def format_message(message):
return mark_safe(rx.sub('<code>\\1</code>', e... | {
"repo_name": "fladi/django-rosetta",
"path": "rosetta/templatetags/rosetta.py",
"copies": "4",
"size": "2036",
"license": "mit",
"hash": -358358387940585300,
"line_mean": 23.8292682927,
"line_max": 92,
"alpha_frac": 0.6596267191,
"autogenerated": false,
"ratio": 3.370860927152318,
"config_test... |
from django import template
from django.utils.safestring import mark_safe
from django.utils.html import escape
import re
from django.template import Node,TemplateSyntaxError
from django.utils.encoding import smart_unicode
register = template.Library()
rx = re.compile(r'(%(\([^\s\)]*\))?[sd])')
def format_message(mess... | {
"repo_name": "20tab/upy",
"path": "upy/contrib/rosetta/templatetags/rosetta.py",
"copies": "1",
"size": "2084",
"license": "bsd-3-clause",
"hash": 2878142087348645000,
"line_mean": 26.7866666667,
"line_max": 91,
"alpha_frac": 0.6732245681,
"autogenerated": false,
"ratio": 3.4108019639934533,
"... |
from django import template
from django.utils.safestring import mark_safe
from django.utils.html import escape
import re
import six
from rosetta.access import can_translate
register = template.Library()
rx = re.compile(r'(%(\([^\s\)]*\))?[sd]|\{[\w\d_]+?\})')
can_translate = register.filter(can_translate)
def for... | {
"repo_name": "mbi/django-rosetta",
"path": "rosetta/templatetags/rosetta.py",
"copies": "1",
"size": "1699",
"license": "mit",
"hash": -6179616644006322000,
"line_mean": 22.9295774648,
"line_max": 92,
"alpha_frac": 0.6492054149,
"autogenerated": false,
"ratio": 3.2547892720306515,
"config_test... |
from django import template
from django.utils.safestring import mark_safe
from django.utils import formats
import math
register = template.Library()
@register.filter
def format_number(amount):
return formats.number_format(
amount, decimal_pos=2, use_l10n=True, force_grouping=True)
@register.filter
def ... | {
"repo_name": "curaloucura/money-forecast",
"path": "moneyforecast/records/templatetags/record_tags.py",
"copies": "1",
"size": "1378",
"license": "unlicense",
"hash": -3689194120436101600,
"line_mean": 24.0545454545,
"line_max": 88,
"alpha_frac": 0.6981132075,
"autogenerated": false,
"ratio": 3.... |
from django import template
from django.utils.safestring import mark_safe
from django.utils import timezone
from django.templatetags import tz
register = template.Library()
from functools import partial
from datetime import datetime
import qutils.time
import qbase.time
def clear_cache():
pass
@register.simple_... | {
"repo_name": "gzqichang/wa",
"path": "qbase/qbase/templatetags/qbase.py",
"copies": "1",
"size": "1465",
"license": "mit",
"hash": -5236263290761980000,
"line_mean": 28.5869565217,
"line_max": 90,
"alpha_frac": 0.6987509184,
"autogenerated": false,
"ratio": 3.0044150110375276,
"config_test": f... |
from django import template
from django.utils.safestring import mark_safe
from expedient.common.permissions.shortcuts import has_permission
from django.contrib.auth.models import User
register = template.Library()
@register.filter
def is_super_user(user):
"""
Checks if the given user is superuser.
@p... | {
"repo_name": "ict-felix/stack",
"path": "expedient/src/python/expedient/common/utils/templatetags/ch_extras.py",
"copies": "3",
"size": "1873",
"license": "apache-2.0",
"hash": -345697157809342800,
"line_mean": 23.6447368421,
"line_max": 71,
"alpha_frac": 0.661505606,
"autogenerated": false,
"ra... |
from django import template
from django.utils.safestring import mark_safe
from ..fullcalendar import css_url, print_css_url, javascript_url, jquery_url, jquery_ui_url
register = template.Library()
@register.inclusion_tag("fullcalendar/calendar.html")
def calendar():
return {}
@register.inclusion_tag("fullcalend... | {
"repo_name": "TylerRudie/Onsen",
"path": "fullcalendar/templatetags/fullcalendar_tags.py",
"copies": "3",
"size": "1562",
"license": "mit",
"hash": -7930640623378520000,
"line_mean": 25.4915254237,
"line_max": 92,
"alpha_frac": 0.71446863,
"autogenerated": false,
"ratio": 3.403050108932462,
"c... |
from django import template
from django.utils.safestring import mark_safe
from ..modelintegration import (restfulcls_to_extjsmodel, get_extjs_modelname,
restfulcls_to_extjscomboboxmodel)
from ..storeintegration import (restfulcls_to_extjsstore, get_extjs_storeid)
from ..formintegration i... | {
"repo_name": "vegarang/devilry-django",
"path": "devilry/apps/extjshelpers/templatetags/extjs.py",
"copies": "1",
"size": "3844",
"license": "bsd-3-clause",
"hash": 4582408256898437000,
"line_mean": 36.6862745098,
"line_max": 125,
"alpha_frac": 0.6997918835,
"autogenerated": false,
"ratio": 3.32... |
from django import template
from django.utils.safestring import mark_safe
from ..models import GALLERY_SETTINGS
register = template.Library()
@register.simple_tag(takes_context=True)
def gallery_as_html(context, gallery):
return mark_safe(gallery.as_html(thumber=context.get('thumber')))
@register.simple_tag(take... | {
"repo_name": "codefisher/djangopress",
"path": "djangopress/gallery/templatetags/gallery_tags.py",
"copies": "1",
"size": "1056",
"license": "mit",
"hash": -893487215994347100,
"line_mean": 34.2333333333,
"line_max": 142,
"alpha_frac": 0.6174242424,
"autogenerated": false,
"ratio": 3.81227436823... |
from django import template
from django.utils.safestring import mark_safe
from ..models import Phase
register = template.Library()
@register.filter
def first_p(value):
paras = value.split('</p>')
if len(paras):
return paras[0] + '</p>'
return ''
def is_active_phase(this_phase, current_phase):
... | {
"repo_name": "terotic/digihel",
"path": "digi/templatetags/digi_tags.py",
"copies": "1",
"size": "1476",
"license": "mit",
"hash": 5781024890284912000,
"line_mean": 38.9189189189,
"line_max": 106,
"alpha_frac": 0.6456639566,
"autogenerated": false,
"ratio": 3.464788732394366,
"config_test": fa... |
from django import template
from django.utils.safestring import mark_safe
from numpy import array
register = template.Library()
COMPARISON_PHRASE_MAP = {
206: ["more than double", ""],
195: ["about double", ""],
180: ["nearly double", ""],
161: ["more than 1.5 times", ""],
145: ["about 1.5 times",... | {
"repo_name": "sseguku/simplecensusug",
"path": "censusreporter/apps/census/templatetags/madlibs.py",
"copies": "4",
"size": "2459",
"license": "mit",
"hash": -3170113856694402600,
"line_mean": 34.6376811594,
"line_max": 80,
"alpha_frac": 0.6250508337,
"autogenerated": false,
"ratio": 3.527977044... |
from django import template
from django.utils.safestring import mark_safe
from pygments import highlight
from pygments.formatters.html import HtmlFormatter
from pygments.lexers import get_lexer_by_name
from ..forms import DocSearchForm
from ..models import DocumentRelease
from ..utils import get_doc_path, get_doc_root... | {
"repo_name": "xavierdutreilh/djangoproject.com",
"path": "docs/templatetags/docs.py",
"copies": "1",
"size": "2606",
"license": "bsd-3-clause",
"hash": 1688413784366885400,
"line_mean": 29.3023255814,
"line_max": 80,
"alpha_frac": 0.6542594014,
"autogenerated": false,
"ratio": 3.9129129129129128... |
from django import template
from django.utils.safestring import mark_safe
from reversion_compare.helpers import SEMANTIC, html_diff
register = template.Library()
@register.simple_tag
def semantic_diff(left, right, field):
left_txt = left.field_dict[field] or ""
right_txt = right.field_dict[field] or ""
r... | {
"repo_name": "pbanaszkiewicz/amy",
"path": "amy/workshops/templatetags/diff.py",
"copies": "1",
"size": "2841",
"license": "mit",
"hash": -3311460925677843500,
"line_mean": 37.3918918919,
"line_max": 84,
"alpha_frac": 0.5902851109,
"autogenerated": false,
"ratio": 3.5780856423173804,
"config_t... |
from django import template
from django.utils.safestring import mark_safe
from satchmo.configuration import config_value
from satchmo.l10n.utils import moneyfmt
from satchmo.tax.templatetags.satchmo_tax import CartitemLineTaxedTotalNode, CartTaxedTotalNode
from satchmo.utils import trunc_decimal
import logging
import m... | {
"repo_name": "sankroh/satchmo",
"path": "satchmo/shop/templatetags/satchmo_cart.py",
"copies": "2",
"size": "5174",
"license": "bsd-3-clause",
"hash": 4340499663225623600,
"line_mean": 30.1686746988,
"line_max": 122,
"alpha_frac": 0.6293003479,
"autogenerated": false,
"ratio": 3.9617151607963246... |
from django import template
from django.utils.safestring import mark_safe
from talks.models import SurveyScore
register = template.Library()
@register.filter
def histogram_svg(scores):
if not scores:
return ""
max_count = max(scores.values())
if not max_count:
return ""
data = {}
... | {
"repo_name": "WebCampZg/conference-web",
"path": "dashboard/templatetags/dashboard.py",
"copies": "1",
"size": "1742",
"license": "bsd-3-clause",
"hash": 5239339408397731000,
"line_mean": 31.8679245283,
"line_max": 108,
"alpha_frac": 0.5361653272,
"autogenerated": false,
"ratio": 3.2867924528301... |
from django import template
from django.utils.safestring import mark_safe
import dndproject.settings
from dnd.utilities import int_with_commas
register = template.Library()
BOOLEAN_MAPPING = {True: 'yes', False: 'no', None: 'unknown', 1: 'yes',
0: 'no', '1': 'yes', '0': 'no', u'1': 'yes'}
def _b... | {
"repo_name": "dndtoolsnet/dndtools",
"path": "dndtools/dnd/templatetags/custom_filters.py",
"copies": "1",
"size": "1685",
"license": "mit",
"hash": -3500634900491445000,
"line_mean": 22.7323943662,
"line_max": 97,
"alpha_frac": 0.5916913947,
"autogenerated": false,
"ratio": 3.203422053231939,
... |
from django import template
from django.utils.safestring import mark_safe
import dndtools2.settings
from dnd.utilities import int_with_commas
register = template.Library()
BOOLEAN_MAPPING = {True: 'yes', False: 'no', None: 'unknown', 1: 'yes',
0: 'no', '1': 'yes', '0': 'no', u'1': 'yes'}
def _bo... | {
"repo_name": "dndtools2/dndtools2",
"path": "dnd/templatetags/custom_filters.py",
"copies": "1",
"size": "1683",
"license": "mit",
"hash": 6634860609006700000,
"line_mean": 22.7042253521,
"line_max": 97,
"alpha_frac": 0.5912061794,
"autogenerated": false,
"ratio": 3.1875,
"config_test": false,... |
from django import template
from django.utils.safestring import mark_safe
from bible import Passage # python-bible module.
from bibletext.models import KJV
register = template.Library()
@register.inclusion_tag('bibletext/verse.html')
def verse(reference, bible=KJV):
"""
Renders a verse from :model:`biblete... | {
"repo_name": "richardbolt/django-bibletext",
"path": "bibletext/templatetags/bibletext_verses.py",
"copies": "1",
"size": "2132",
"license": "bsd-3-clause",
"hash": 1111682967187711600,
"line_mean": 30.3676470588,
"line_max": 110,
"alpha_frac": 0.6224202627,
"autogenerated": false,
"ratio": 3.58... |
from django import template
from django.utils.safestring import mark_safe
from cms.toolbar.utils import get_toolbar_from_request
from cms.utils.plugins import downcast_plugins, build_plugin_tree
register = template.Library()
@register.simple_tag(takes_context=True)
def render_alias_plugin(context, instance):
r... | {
"repo_name": "rsalmaso/django-cms",
"path": "cms/templatetags/cms_alias_tags.py",
"copies": "2",
"size": "1701",
"license": "bsd-3-clause",
"hash": 6899242719611847000,
"line_mean": 35.1914893617,
"line_max": 83,
"alpha_frac": 0.6796002352,
"autogenerated": false,
"ratio": 4.241895261845387,
"... |
from django import template
from django.utils.safestring import mark_safe
from datetime import datetime
import re
from basic.blog.models import Post
import urllib2
register = template.Library()
@register.filter
def order_by(queryset, args):
'''
Orders a queryset
Arguments:
queryset
... | {
"repo_name": "blampe/M2M",
"path": "m2m/search/templatetags/search_extras.py",
"copies": "1",
"size": "9741",
"license": "mit",
"hash": -3393270702482227700,
"line_mean": 31.3621262458,
"line_max": 176,
"alpha_frac": 0.5246894569,
"autogenerated": false,
"ratio": 4.127542372881356,
"config_tes... |
from django import template
from django.utils.safestring import mark_safe
from .. import core
register = template.Library()
@register.simple_tag
def statustype(format_string):
BADGE = {core.StatusType.UNDEFINED : "default",
core.StatusType.OK : "success",
core.StatusTy... | {
"repo_name": "volzotan/django-howl",
"path": "howl/howlcore/templatetags/howlcore.py",
"copies": "1",
"size": "1687",
"license": "mit",
"hash": -8346326551306199000,
"line_mean": 42.2564102564,
"line_max": 162,
"alpha_frac": 0.6141078838,
"autogenerated": false,
"ratio": 3.5,
"config_test": fa... |
from django import template
from django.utils.safestring import mark_safe
from machina.core.db.models import get_model
from machina.core.loading import get_class
Forum = get_model('forum', 'Forum')
PermissionHandler = get_class('forum_permission.handler', 'PermissionHandler')
TrackingHandler = get_class('forum_trac... | {
"repo_name": "ellmetha/django-machina",
"path": "machina/templatetags/forum_tags.py",
"copies": "1",
"size": "2609",
"license": "bsd-3-clause",
"hash": 9213023182674053000,
"line_mean": 31.6125,
"line_max": 96,
"alpha_frac": 0.6818704484,
"autogenerated": false,
"ratio": 3.8594674556213016,
"c... |
from django import template
from django.utils.safestring import mark_safe
from ..models import GuideFrontPage
register = template.Library()
def list_children(page, target_page):
if page.specific == target_page:
is_me = True
else:
is_me = False
if target_page.is_descendant_of(page):
... | {
"repo_name": "terotic/digihel",
"path": "digi/templatetags/guide_tags.py",
"copies": "2",
"size": "1246",
"license": "mit",
"hash": -3232004674330522000,
"line_mean": 23.431372549,
"line_max": 81,
"alpha_frac": 0.6027287319,
"autogenerated": false,
"ratio": 3.664705882352941,
"config_test": fa... |
from django import template
from django.utils.safestring import mark_safe
from ..models import KehmetFrontPage
register = template.Library()
def list_children(page, target_page):
if getattr(page.specific, 'show_in_submenus', True):
if page.specific == target_page:
is_me = True
else:... | {
"repo_name": "terotic/digihel",
"path": "kehmet/templatetags/kehmet_tags.py",
"copies": "2",
"size": "1445",
"license": "mit",
"hash": 1076861123131625000,
"line_mean": 25.2727272727,
"line_max": 82,
"alpha_frac": 0.5591695502,
"autogenerated": false,
"ratio": 3.8844086021505375,
"config_test"... |
from django import template
from django.utils.safestring import mark_safe
from monocle.consumers import devour
register = template.Library()
def _args_to_dim(args):
"""Converts args list to width, height if it exists"""
if len(args) >= 2:
return _value_to_dim(args[1])
return None, None
def _v... | {
"repo_name": "shaunduncan/django-monocle",
"path": "monocle/templatetags/oembed_tags.py",
"copies": "1",
"size": "2730",
"license": "mit",
"hash": 5706297894696846000,
"line_mean": 28.0425531915,
"line_max": 103,
"alpha_frac": 0.6681318681,
"autogenerated": false,
"ratio": 3.6693548387096775,
... |
from django import template
from django.utils.safestring import mark_safe
from omblog.forms import CreatePostForm
register = template.Library()
@register.inclusion_tag('omblog/_create_form.html', takes_context=True)
def create_form(context):
return{
'form': CreatePostForm(),
'context': context}
... | {
"repo_name": "dubu/python_temp",
"path": "omblog/templatetags/omblog_tags.py",
"copies": "2",
"size": "2249",
"license": "bsd-3-clause",
"hash": 3657233894725518000,
"line_mean": 27.1125,
"line_max": 73,
"alpha_frac": 0.6273899511,
"autogenerated": false,
"ratio": 3.392156862745098,
"config_te... |
from django import template
from django.utils.safestring import mark_safe
from site_content.models import SiteBlock, SitePage, SitePosition, SitePagePositionBlock
register = template.Library()
@register.simple_tag
def get_block(code):
try:
block = SiteBlock.objects.get(code=code)
retval = block.... | {
"repo_name": "wlashell/lyrical_page",
"path": "site_content/templatetags/page_block.py",
"copies": "1",
"size": "1077",
"license": "apache-2.0",
"hash": -4867577758412146000,
"line_mean": 28.9166666667,
"line_max": 116,
"alpha_frac": 0.7233054782,
"autogenerated": false,
"ratio": 3.9888888888888... |
from django import template
from django.utils.safestring import mark_safe
from wagtail.wagtailcore.models import Page
from wagtail.wagtailcore.rich_text import expand_db_html
from wagtail.wagtailcore import __version__
register = template.Library()
@register.simple_tag(takes_context=True)
def pageurl(context, page)... | {
"repo_name": "taedori81/wagtail",
"path": "wagtail/wagtailcore/templatetags/wagtailcore_tags.py",
"copies": "4",
"size": "1099",
"license": "bsd-3-clause",
"hash": -8362694803148455000,
"line_mean": 24.5581395349,
"line_max": 84,
"alpha_frac": 0.6851683348,
"autogenerated": false,
"ratio": 3.712... |
from django import template
from django.utils.safestring import mark_safe
from wagtail.wagtailcore.models import Page
from wagtail.wagtailcore.rich_text import expand_db_html, RichText
from wagtail.wagtailcore import __version__
register = template.Library()
@register.simple_tag(takes_context=True)
def pageurl(cont... | {
"repo_name": "inonit/wagtail",
"path": "wagtail/wagtailcore/templatetags/wagtailcore_tags.py",
"copies": "30",
"size": "1250",
"license": "bsd-3-clause",
"hash": 8265892545824246000,
"line_mean": 26.1739130435,
"line_max": 85,
"alpha_frac": 0.6872,
"autogenerated": false,
"ratio": 3.834355828220... |
from django import template
from django.utils.safestring import mark_safe
from webpack_loader.templatetags.webpack_loader import get_files
from normandy.base.utils import sri_hash
register = template.Library()
@register.simple_tag
def render_bundle(bundle_name, extension=None, config='DEFAULT', attrs=''):
"""... | {
"repo_name": "Osmose/normandy",
"path": "recipe-server/normandy/base/templatetags/normandy_webpack_loader.py",
"copies": "1",
"size": "1192",
"license": "mpl-2.0",
"hash": 5415952379594789000,
"line_mean": 35.1212121212,
"line_max": 99,
"alpha_frac": 0.6082214765,
"autogenerated": false,
"ratio"... |
from django import template
from django.utils.safestring import mark_safe
from workshops.models import TrainingProgress
register = template.Library()
@register.simple_tag
def progress_label(progress):
assert isinstance(progress, TrainingProgress)
if progress.discarded:
additional_label = 'default'
... | {
"repo_name": "vahtras/amy",
"path": "workshops/templatetags/training_progress.py",
"copies": "1",
"size": "1321",
"license": "mit",
"hash": -7131653918061577000,
"line_mean": 29.7209302326,
"line_max": 88,
"alpha_frac": 0.623012869,
"autogenerated": false,
"ratio": 3.943283582089552,
"config_t... |
from django import template
from django.utils.safestring import mark_safe
from ..wp import content as content_lib
register = template.Library()
@register.filter(is_safe=True)
def wpkit_balance_tags(content):
"""Does not texturize text blocks"""
return mark_safe(content_lib.balance_tags(content))
@registe... | {
"repo_name": "ludoo/wpkit",
"path": "wpkit/templatetags/wpkit_content.py",
"copies": "1",
"size": "1635",
"license": "bsd-3-clause",
"hash": -4665792446551385000,
"line_mean": 25.8032786885,
"line_max": 71,
"alpha_frac": 0.7400611621,
"autogenerated": false,
"ratio": 3.0733082706766917,
"confi... |
from django import template
from django.utils.safestring import mark_safe
import bleach
from bleach.sanitizer import BleachSanitizer
from bleach.encoding import force_unicode
from bootstrap3.renderers import FieldRenderer
from bootstrap3.text import text_value
import html5lib
import re
register = template.Library()
... | {
"repo_name": "agepoly/truffe2",
"path": "truffe2/generic/templatetags/generic_extras.py",
"copies": "2",
"size": "4141",
"license": "bsd-2-clause",
"hash": -3059523803902415400,
"line_mean": 25.5448717949,
"line_max": 157,
"alpha_frac": 0.6283506399,
"autogenerated": false,
"ratio": 3.3859362224... |
from django import template
from django.utils.safestring import mark_safe
import markdown2
from courses.models import Course
register = template.Library()
@register.simple_tag
def newest_course():
'''Gets the most recent course that was added to the library'''
return Course.objects.filter(published=True).... | {
"repo_name": "davejlin/treehouse",
"path": "python/django/learning_site_ORM/courses/templatetags/course_extras.py",
"copies": "2",
"size": "1059",
"license": "unlicense",
"hash": -5471596628781010000,
"line_mean": 27.6486486486,
"line_max": 101,
"alpha_frac": 0.7233238905,
"autogenerated": false,
... |
from django import template
from django.utils.safestring import mark_safe
#
# Contains simple filters that may be useful within messages processing.
#
def multiply(input, property):
"""
Just multiplies two values together. Surprisingly this isn't possible in normal templates.
"""
return "%.2f" % (fl... | {
"repo_name": "unicefuganda/edtrac",
"path": "edtrac_project/rapidsms_xforms_src/rapidsms_xforms/templatetags/messages.py",
"copies": "1",
"size": "1794",
"license": "bsd-3-clause",
"hash": -6375428279989014000,
"line_mean": 27.935483871,
"line_max": 95,
"alpha_frac": 0.6538461538,
"autogenerated":... |
from django import template
from django.utils.safestring import mark_safe
register = template.Library()
###############################################################################
# For producing boilerplate code
@register.simple_tag
def code_doc(component, count=0):
'''
Format the description field o... | {
"repo_name": "ktonon/GameSoup",
"path": "gamesoup/library/templatetags/library.py",
"copies": "1",
"size": "6363",
"license": "mit",
"hash": -981465934946152100,
"line_mean": 28.3225806452,
"line_max": 102,
"alpha_frac": 0.6346063178,
"autogenerated": false,
"ratio": 4.019583070120025,
"config... |
from django import template
from django.utils.safestring import mark_safe
register = template.Library()
@register.simple_tag
def alert_messages(messages):
message_html_list = []
for message in messages:
if message.tags == 'success':
tags = 'success'
icon = 'fas fa-check'
... | {
"repo_name": "panuta/django-startup",
"path": "{{cookiecutter.project_slug}}/app/common/templatetags/common.py",
"copies": "2",
"size": "1818",
"license": "mit",
"hash": 5234885555551088000,
"line_mean": 29.3,
"line_max": 81,
"alpha_frac": 0.5715071507,
"autogenerated": false,
"ratio": 3.8598726... |
from django import template
from django.utils.safestring import mark_safe
register = template.Library()
class RecurseConfigTree(template.Node):
def __init__(self, template_nodes, config_var):
self.template_nodes = template_nodes
self.config_var = config_var
def _render_node(self, context, nod... | {
"repo_name": "sigma-random/FuzzManager",
"path": "server/ec2spotmanager/templatetags/recursetags.py",
"copies": "3",
"size": "1145",
"license": "mpl-2.0",
"hash": 2441893125361957400,
"line_mean": 31.7428571429,
"line_max": 96,
"alpha_frac": 0.6698689956,
"autogenerated": false,
"ratio": 3.98954... |
from django import template
from django.utils.safestring import mark_safe
register = template.Library()
class YouTube:
style = """
<style>
.embed-container {
position: relative;
padding-bottom: 56.25%;
height: 0;
overflow: hidden;... | {
"repo_name": "life-in-messiah/django-youtube-tags",
"path": "django-youtube-tags/templatetags/youtube.py",
"copies": "1",
"size": "1505",
"license": "mit",
"hash": 2557414887984640000,
"line_mean": 28.5098039216,
"line_max": 96,
"alpha_frac": 0.561461794,
"autogenerated": false,
"ratio": 3.90909... |
from django import template
from django.utils.safestring import mark_safe
register = template.Library()
COMPARISON_PHRASE_MAP = {
206: ["more than double", ""],
195: ["about double", ""],
180: ["nearly double", ""],
161: ["more than 1.5 times", ""],
145: ["about 1.5 times", ""],
135: ["about 1... | {
"repo_name": "censusreporter/censusreporter",
"path": "censusreporter/apps/census/templatetags/madlibs.py",
"copies": "1",
"size": "2414",
"license": "mit",
"hash": -5158645576764175000,
"line_mean": 34.5,
"line_max": 78,
"alpha_frac": 0.6251035626,
"autogenerated": false,
"ratio": 3.47838616714... |
from django import template
from django.utils.safestring import mark_safe
register = template.Library()
# http://www.soyoucode.com/2011/set-variable-django-template
# http://djangosnippets.org/snippets/861/
# http://stackoverflow.com/questions/4183252/what-django-resolve-variable-do-template-variable
# https://docs.d... | {
"repo_name": "registerguard/django-dox",
"path": "dox/templatetags/allow_tags.py",
"copies": "2",
"size": "1281",
"license": "apache-2.0",
"hash": -6146666769159359000,
"line_mean": 33.6486486486,
"line_max": 128,
"alpha_frac": 0.6846213895,
"autogenerated": false,
"ratio": 3.9054878048780486,
... |
from django import template
from django.utils.safestring import mark_safe
register = template.Library()
"""
Easily create responsive Bootstrap 3 grids in Django.
Usage
=====
<div class="container">
{% for obj in mylist %}
{% grid_clearfix xs=1 lg=6 %}
<div class="{% grid_classes xs=1 lg=6 %}... | {
"repo_name": "lamby/musicdb",
"path": "musicdb/utils/templatetags/bootstrap.py",
"copies": "1",
"size": "1971",
"license": "bsd-3-clause",
"hash": -8464299885523657000,
"line_mean": 24.2692307692,
"line_max": 79,
"alpha_frac": 0.6067985794,
"autogenerated": false,
"ratio": 3.3463497453310698,
... |
from django import template
from django.utils.safestring import mark_safe
register = template.Library()
@register.filter(name='hoursmins')
def hoursmins(value):
if value == None or value == "":
return ""
s = int(value) * 60
hours, remainder = divmod(s, 3600)
minutes, seconds = di... | {
"repo_name": "xurble/FeedThing",
"path": "ft/templatetags/ft_tags.py",
"copies": "1",
"size": "1074",
"license": "mit",
"hash": -1350687933259792400,
"line_mean": 20.0588235294,
"line_max": 56,
"alpha_frac": 0.573556797,
"autogenerated": false,
"ratio": 3.6161616161616164,
"config_test": false... |
from django import template
from django.utils.safestring import mark_safe
register = template.Library()
@register.filter
def active(name, request):
"""TODO: change that!"""
if name in request.path and 'papers' not in request.path:
return 'active'
return ''
@register.filter
def icon_active(name,... | {
"repo_name": "jfouca/confucius",
"path": "confucius/templatetags/extra.py",
"copies": "1",
"size": "2567",
"license": "bsd-3-clause",
"hash": -1870573159562805800,
"line_mean": 24.67,
"line_max": 73,
"alpha_frac": 0.6291390728,
"autogenerated": false,
"ratio": 3.682926829268293,
"config_test":... |
from django import template
from django.utils.safestring import mark_safe
register = template.Library()
@register.simple_tag
def upload_js():
return mark_safe("""
<!-- 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... | {
"repo_name": "pcecconi/mapground",
"path": "fileupload/templatetags/upload_tags.py",
"copies": "1",
"size": "2739",
"license": "mit",
"hash": 2552104697671553000,
"line_mean": 39.8805970149,
"line_max": 214,
"alpha_frac": 0.5082146769,
"autogenerated": false,
"ratio": 3.502557544757033,
"confi... |
from django import template
from django.utils.safestring import mark_safe
register = template.Library()
@register.filter
def cat(obj1, obj2):
return "%s%s" % (obj1, obj2)
@register.filter
def check_in_set(value, arg):
'''returns "checked" if the value is in QuerySet arg else ""'''
if arg.filter(pk=v... | {
"repo_name": "avlach/univbris-ocf",
"path": "expedient/src/python/expedient/common/utils/templatetags/ch_extras.py",
"copies": "1",
"size": "1424",
"license": "bsd-3-clause",
"hash": 6292281628786738000,
"line_mean": 22.7333333333,
"line_max": 69,
"alpha_frac": 0.6537921348,
"autogenerated": false... |
from django import template
from django.utils.safestring import mark_safe
register = template.Library()
@register.filter
def check_in_set(value, arg):
'''returns "checked" if the value is in QuerySet arg else ""'''
if arg.filter(pk=value.pk).count():
return "checked"
else:
return ""
... | {
"repo_name": "ict-felix/stack",
"path": "vt_manager/src/python/vt_manager/common/utils/templatetags/ch_extras.py",
"copies": "9",
"size": "1298",
"license": "apache-2.0",
"hash": 8018181289945287000,
"line_mean": 23.037037037,
"line_max": 69,
"alpha_frac": 0.6664098613,
"autogenerated": false,
"... |
from django import template
from django.utils.safestring import mark_safe
register = template.Library()
@register.simple_tag
def upload_js():
return mark_safe("""
<!-- 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+... | {
"repo_name": "Skeletrox/usb-backend-pinut",
"path": "file_upload/fileupload/templatetags/upload_tags.py",
"copies": "1",
"size": "2972",
"license": "apache-2.0",
"hash": 7619597351169588000,
"line_mean": 37.5974025974,
"line_max": 217,
"alpha_frac": 0.5020188425,
"autogenerated": false,
"ratio":... |
from django import template
from django.utils.safestring import mark_safe
register = template.Library()
@register.assignment_tag
def form_tag(body):
"""
tag usage {% form_tag id %}
"""
if '[totc-form' in body:
start_index = body.find('totc-form id=')
start_id_index = start_index + 13
... | {
"repo_name": "MotherNatureNetwork/django-dynamic-forms",
"path": "dynamic_forms/templatetags/form_tag.py",
"copies": "1",
"size": "2477",
"license": "bsd-3-clause",
"hash": 4869863668516068000,
"line_mean": 39.606557377,
"line_max": 123,
"alpha_frac": 0.4650787243,
"autogenerated": false,
"ratio... |
from django import template
from django.utils.safestring import mark_safe
register = template.Library()
@register.simple_tag(takes_context=True)
def grid(context):
g = context.get('css-grid', None)
wrapper = g.get('grid_wrapper', None)
gap = g.get('grid-gap', None)
template_columns = get_columns(g)
... | {
"repo_name": "raiderrobert/django-css-grid",
"path": "css_grid/templatetags/css_grid.py",
"copies": "1",
"size": "1696",
"license": "mit",
"hash": -735209703910549800,
"line_mean": 22.2328767123,
"line_max": 71,
"alpha_frac": 0.5843160377,
"autogenerated": false,
"ratio": 3.533333333333333,
"c... |
from django import template
from django.utils.safestring import mark_safe
register = template.Library()
@register.tag('get_related_content_type')
def do_get_related_content_type(parser, token):
"""
Gets relations to a story based on the content type
{% get_related_content_type item content_type as var... | {
"repo_name": "callowayproject/django-viewpoint",
"path": "viewpoint/templatetags/viewpoint.py",
"copies": "1",
"size": "5430",
"license": "apache-2.0",
"hash": -3076072292728443400,
"line_mean": 43.5163934426,
"line_max": 134,
"alpha_frac": 0.614732965,
"autogenerated": false,
"ratio": 4.0192450... |
from django import template
from django.utils.safestring import mark_safe
try:
from django.utils.encoding import force_text
except ImportError:
from django.utils.encoding import force_unicode as force_text
import markdown_deux
from markdown_deux.conf import settings
register = template.Library()
@register... | {
"repo_name": "gogobook/django-markdown-deux",
"path": "lib/markdown_deux/templatetags/markdown_deux_tags.py",
"copies": "3",
"size": "2452",
"license": "mit",
"hash": 6075542801428036000,
"line_mean": 30.4358974359,
"line_max": 89,
"alpha_frac": 0.6574225122,
"autogenerated": false,
"ratio": 4.1... |
from django import template
from django.utils.safestring import mark_safe
try:
from django.utils.html import format_html
except ImportError:
# support django < 1.5. Taken from django.utils.html
from sorting_bootstrap.compat import format_html
from sorting_bootstrap.sort import sort_queryset
from sorting_bo... | {
"repo_name": "KymRakoczy/django-sorting-bootstrap",
"path": "sorting_bootstrap/templatetags/sorting_tags.py",
"copies": "2",
"size": "6971",
"license": "mit",
"hash": -4281505071204738600,
"line_mean": 32.8398058252,
"line_max": 118,
"alpha_frac": 0.5613254913,
"autogenerated": false,
"ratio": 4... |
from django import template
from django.utils.safestring import SafeUnicode
from django.template import Node, NodeList, Template, Context, Variable
from django.template import TemplateSyntaxError, VariableDoesNotExist
from django.template import Library
import re
register=template.Library()
class IfRegexNode(Node):
... | {
"repo_name": "jawr/kontrolvm",
"path": "apps/shared/templatetags/shared_filters.py",
"copies": "1",
"size": "2682",
"license": "mit",
"hash": 7989785471840346000,
"line_mean": 36.25,
"line_max": 108,
"alpha_frac": 0.5615212528,
"autogenerated": false,
"ratio": 4.600343053173241,
"config_test":... |
from django import template
from django.utils.text import mark_safe
# https://docs.djangoproject.com/en/1.8/howto/custom-template-tags/
register = template.Library()
@register.inclusion_tag(
'blog/includes/partial_post_list.html',
takes_context=True)
def format_post_list(
context, detail_object, *ar... | {
"repo_name": "jambonrose/DjangoUnleashed-1.8",
"path": "blog/templatetags/partial_post_list.py",
"copies": "1",
"size": "1118",
"license": "bsd-2-clause",
"hash": -5672779962828161000,
"line_mean": 30.0555555556,
"line_max": 67,
"alpha_frac": 0.6216457961,
"autogenerated": false,
"ratio": 3.5948... |
from django import template
from django.utils.timesince import timesince
from datetime import datetime, date
import json
register = template.Library()
@register.filter(name="utctimesince")
def utctimesince(value):
if not value:
return ""
return timesince(value, now=datetime.utcnow())
@register.filter(... | {
"repo_name": "dmschreiber/tapiriik",
"path": "tapiriik/web/templatetags/displayutils.py",
"copies": "1",
"size": "2388",
"license": "apache-2.0",
"hash": -7001419299763126000,
"line_mean": 26.1477272727,
"line_max": 108,
"alpha_frac": 0.6628978224,
"autogenerated": false,
"ratio": 3.470930232558... |
from django import template
from django.utils.timesince import timesince
register = template.Library()
@register.filter
def timesince_days(value):
"""
Takes a datetime object and returns the time between d and now
as a nicely formatted string, e.g. "10 minutes". If d occurs after now,
then "0 minut... | {
"repo_name": "drx/archfinch",
"path": "main/templatetags/timesince_days.py",
"copies": "1",
"size": "1171",
"license": "mit",
"hash": -4809671970625734000,
"line_mean": 25.0222222222,
"line_max": 76,
"alpha_frac": 0.6199829206,
"autogenerated": false,
"ratio": 3.814332247557003,
"config_test":... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.