text stringlengths 0 1.05M | meta dict |
|---|---|
from django import template
from django.utils.timezone import now
from code.syntaxhighlighter import Syntaxhighlighter
import re
from easydata.constant import LANGUAGE_DICT
from code.models import Code
from article.models import Article
from easydata.category.models import category
register = template.Library()
from dj... | {
"repo_name": "ehomeshasha/easydata",
"path": "easydata/templatetags/custom_tags.py",
"copies": "1",
"size": "4610",
"license": "mit",
"hash": 258859543285426700,
"line_mean": 27.81875,
"line_max": 123,
"alpha_frac": 0.6078091106,
"autogenerated": false,
"ratio": 3.460960960960961,
"config_test... |
from django import template
from django.utils.timezone import now
from django.template.defaultfilters import stringfilter
register = template.Library()
@register.simple_tag(takes_context=True)
def querystring_replace(context, **kwargs):
'''Template tag to simplify retaining querystring parameters
when pagin... | {
"repo_name": "Princeton-CDH/derrida-django",
"path": "derrida/common/templatetags/derrida_tags.py",
"copies": "1",
"size": "1323",
"license": "apache-2.0",
"hash": -8009025233850000000,
"line_mean": 35.75,
"line_max": 109,
"alpha_frac": 0.7210884354,
"autogenerated": false,
"ratio": 4.134375,
... |
from django import template
from django.utils.timezone import now
from .. import models
register = template.Library()
class ShowEventsToken(template.Node):
def __init__(self, num, tmpl):
self.tmpl = 'events/object_list.html'
self.num = 8
if num is not None:
try:
... | {
"repo_name": "django-de/django-de-v3",
"path": "django_de/events/templatetags/events_tags.py",
"copies": "1",
"size": "2120",
"license": "bsd-3-clause",
"hash": 1572669900362455800,
"line_mean": 24.8536585366,
"line_max": 104,
"alpha_frac": 0.5613207547,
"autogenerated": false,
"ratio": 4.257028... |
from django import template
from django.utils.timezone import now
register = template.Library()
MOMENT = 120 # duration in seconds within which the time difference
# will be rendered as 'a moment ago'
@register.filter
def naturaltimediff(value):
"""
Finds the difference between the dat... | {
"repo_name": "nikdoof/test-auth",
"path": "app/eve_api/templatetags/naturaltimediff.py",
"copies": "2",
"size": "1202",
"license": "bsd-3-clause",
"hash": -3595497412786275000,
"line_mean": 34.3529411765,
"line_max": 78,
"alpha_frac": 0.5557404326,
"autogenerated": false,
"ratio": 4.640926640926... |
from django import template
from django.utils.translation import get_language, activate
from translations.models import Translatable, Language
register = template.Library()
@register.inclusion_tag('language_switcher.html', takes_context=True)
def translation_urls(context, object_=None):
"""
This simple tag ... | {
"repo_name": "yawd/yawd-translations",
"path": "translations/templatetags/translations_tags.py",
"copies": "1",
"size": "1739",
"license": "bsd-3-clause",
"hash": 2334920257614105000,
"line_mean": 36,
"line_max": 79,
"alpha_frac": 0.6543990799,
"autogenerated": false,
"ratio": 4.3475,
"config_... |
from django import template
from django.utils.translation import get_language, activate
from ..models import Translatable, Language
register = template.Library()
@register.inclusion_tag('language_switcher.html', takes_context=True)
def translation_urls(context, object_=None):
"""
This simple tag returns all... | {
"repo_name": "egemsoft/esef-yawd-translation",
"path": "translations/templatetags/translations_tags.py",
"copies": "1",
"size": "1721",
"license": "bsd-3-clause",
"hash": -375323052544314000,
"line_mean": 35.6170212766,
"line_max": 79,
"alpha_frac": 0.6542707728,
"autogenerated": false,
"ratio":... |
from django import template
from django.utils.translation import get_language
from tekis.flatpages.models import LocalFlatpage, Sponsor, PAGE
register = template.Library()
@register.inclusion_tag("flatpages/menu.html")
def menu_for_category(category_id):
"""Render a `<li>` menu for the given category. This will... | {
"repo_name": "hylje/tekis",
"path": "tekis/flatpages/templatetags/flatpage_tags.py",
"copies": "1",
"size": "2218",
"license": "bsd-3-clause",
"hash": 8330947224622218000,
"line_mean": 28.5733333333,
"line_max": 76,
"alpha_frac": 0.6361587015,
"autogenerated": false,
"ratio": 3.9820466786355477,... |
from django import template
from django.utils.translation import gettext_lazy as _
import re
register = template.Library()
class ExprNode(template.Node):
def __init__(self, expr_string, var_name):
self.expr_string = expr_string
self.var_name = var_name
def render(self, context):
try:
... | {
"repo_name": "itavor/itavor_lib",
"path": "itavor_lib/templatetags/expr.py",
"copies": "1",
"size": "1304",
"license": "bsd-3-clause",
"hash": -9161802179283929000,
"line_mean": 29.3255813953,
"line_max": 97,
"alpha_frac": 0.5651840491,
"autogenerated": false,
"ratio": 3.7257142857142855,
"con... |
from django import template
from django.utils.translation import gettext_lazy as _
register = template.Library()
class PyIfNode(template.Node):
def __init__(self, nodeslist):
self.nodeslist = nodeslist
def __repr__(self):
return "<PyIf node>"
def render(self, context):
for e, nod... | {
"repo_name": "mop/twit-miner",
"path": "twit_miner/crits/templatetags/pyif.py",
"copies": "1",
"size": "1268",
"license": "mit",
"hash": -4955057611226999000,
"line_mean": 27.1777777778,
"line_max": 101,
"alpha_frac": 0.523659306,
"autogenerated": false,
"ratio": 3.7514792899408285,
"config_te... |
from django import template
from django.utils.translation import gettext_lazy
from django.template.defaultfilters import stringfilter
from devilry.devilry_gradingsystem.models import FeedbackDraft
register = template.Library()
@register.filter(name='formatted_status')
@stringfilter
def formatted_status(value):
i... | {
"repo_name": "devilry/devilry-django",
"path": "devilry/devilry_examiner/templatetags/devilry_examiner_tags.py",
"copies": "1",
"size": "3024",
"license": "bsd-3-clause",
"hash": 7073994589511996000,
"line_mean": 28.6470588235,
"line_max": 93,
"alpha_frac": 0.6994047619,
"autogenerated": false,
... |
from django import template
from django.utils.translation import ugettext as _
from django.utils.importlib import import_module
from django.core.urlresolvers import reverse
from django.contrib.auth.models import User
from avatar import AVATAR_LOADERS
from avatar.util import get_default_avatar_url
register = template... | {
"repo_name": "dgouldin/django-avatar",
"path": "avatar/templatetags/avatar_tags.py",
"copies": "1",
"size": "2081",
"license": "bsd-3-clause",
"hash": -5521122092332903000,
"line_mean": 34.2711864407,
"line_max": 81,
"alpha_frac": 0.6352715041,
"autogenerated": false,
"ratio": 3.663732394366197,... |
from django import template
from django.utils.translation import ugettext as _
import common.ot_utils
register = template.Library()
@register.filter(name="weekday")
def week_day(dt):
return _(common.ot_utils.get_weekdayname(dt))
@register.filter(name="nicedate")
def nice_date(dt):
import uuid
elemid = '... | {
"repo_name": "oferb/OpenTrains",
"path": "webserver/opentrain/common/templatetags/ot_filters.py",
"copies": "1",
"size": "1547",
"license": "bsd-3-clause",
"hash": -7305962001515561000,
"line_mean": 28.1886792453,
"line_max": 121,
"alpha_frac": 0.6658047835,
"autogenerated": false,
"ratio": 3.27... |
from django import template
from django.utils.translation import ugettext as _
import markdown
from contrib.markdown.extensions.youtube import YouTubeExtension
from contrib.markdown.extensions.mp3player import MP3PlayerExtension
register = template.Library()
@register.filter("post_count")
def thread_post_count(objec... | {
"repo_name": "nonni/fruss",
"path": "dsf/templatetags/thread_filters.py",
"copies": "1",
"size": "1681",
"license": "mit",
"hash": -2914314630763827700,
"line_mean": 24.8615384615,
"line_max": 68,
"alpha_frac": 0.6555621654,
"autogenerated": false,
"ratio": 3.7690582959641254,
"config_test": t... |
from django import template
from django.utils.translation import ugettext as _
register = template.Library()
def get_attribute(obj, attribute):
if not attribute:
return obj
attributes = attribute.split('.')
value = obj
try:
for key in attributes:
value = getattr(value, k... | {
"repo_name": "trustcircleglobal/tcg-gae",
"path": "tcg_gae/templatetags/filters.py",
"copies": "1",
"size": "1368",
"license": "isc",
"hash": 1810023346259225600,
"line_mean": 27.5,
"line_max": 78,
"alpha_frac": 0.5986842105,
"autogenerated": false,
"ratio": 4.071428571428571,
"config_test": f... |
from django import template
from django.utils.translation import ugettext as _
register = template.Library()
@register.inclusion_tag('admin/broadcast/submit_line.html', takes_context=True)
def approve_submit_row(context):
"""
Displays the row of buttons for approve, delete, go back, reject and save.
"""
... | {
"repo_name": "SmartElect/SmartElect",
"path": "bulk_sms/templatetags/broadcast_admin.py",
"copies": "1",
"size": "1402",
"license": "apache-2.0",
"hash": 7460376579609642000,
"line_mean": 39.0571428571,
"line_max": 93,
"alpha_frac": 0.6219686163,
"autogenerated": false,
"ratio": 3.90529247910863... |
from django import template
from django.utils.translation import ugettext as _
register = template.Library()
@register.inclusion_tag('auxiliary/_bar.html')
def bar(quantity, start, end, bar_class=None, show_label=True):
"""
Draws a bar.
:param quantity: The quantity to represent
:param start: Start ... | {
"repo_name": "habeanf/Open-Knesset",
"path": "auxiliary/templatetags/common_visual_elements.py",
"copies": "6",
"size": "1340",
"license": "bsd-3-clause",
"hash": -2059742570799754800,
"line_mean": 28.1304347826,
"line_max": 80,
"alpha_frac": 0.5962686567,
"autogenerated": false,
"ratio": 3.9880... |
from django import template
from django.utils.translation import ugettext_lazy as _
from django.contrib.contenttypes.models import ContentType
from openbudget.apps.interactions.models import Star, Follow
register = template.Library()
@register.inclusion_tag('interactions/partials/_star.html')
def star(obj, user):
... | {
"repo_name": "zbyufei/open-budgets",
"path": "openbudget/apps/interactions/templatetags/interactions.py",
"copies": "2",
"size": "2430",
"license": "bsd-3-clause",
"hash": -7764269583529016000,
"line_mean": 29.7594936709,
"line_max": 136,
"alpha_frac": 0.5312757202,
"autogenerated": false,
"rati... |
from django import template
from django.utils.translation import ugettext_lazy as _
from django.contrib.contenttypes.models import ContentType
from openbudgets.apps.interactions.models import Star, Follow
register = template.Library()
@register.inclusion_tag('interactions/partials/_star.html')
def star(obj, user):
... | {
"repo_name": "openbudgets/openbudgets",
"path": "openbudgets/apps/interactions/templatetags/interactions.py",
"copies": "5",
"size": "2431",
"license": "bsd-3-clause",
"hash": 8095817393093925000,
"line_mean": 29.7721518987,
"line_max": 136,
"alpha_frac": 0.5314685315,
"autogenerated": false,
"r... |
from django import template
from django.utils.translation import ugettext_lazy as _
from django.utils.html import escape
from gamernews.apps.voting.models import Vote
register = template.Library()
possible_votes = {
-1 : _(u"down"),
0 : _(u"blank"),
1 : _(u"up"),
}
#possible_votes = vote_types.copy()
... | {
"repo_name": "underlost/GamerNews",
"path": "gamernews/apps/voting/templatetags/voting_tags.py",
"copies": "1",
"size": "7890",
"license": "mit",
"hash": 4245260284858624000,
"line_mean": 34.3811659193,
"line_max": 98,
"alpha_frac": 0.6372623574,
"autogenerated": false,
"ratio": 3.78235858101629... |
from django import template
from django.utils.translation import ugettext_lazy as _
from django.utils.html import format_html
from daiquiri.core.constants import LICENSE_CHOICES, LICENSE_URLS
from daiquiri.core.utils import get_doi_url
from ..models import Schema
register = template.Library()
@register.inclusion_t... | {
"repo_name": "aipescience/django-daiquiri",
"path": "daiquiri/metadata/templatetags/metadata_tags.py",
"copies": "1",
"size": "1695",
"license": "apache-2.0",
"hash": 5256831918399078000,
"line_mean": 26.7868852459,
"line_max": 98,
"alpha_frac": 0.6395280236,
"autogenerated": false,
"ratio": 3.6... |
from django import template
from django.utils.translation import ugettext_lazy as _
from ..utils import (
get_admin_site_name, get_wpadmin_settings, are_breadcrumbs_enabled)
register = template.Library()
def wpadmin_render_custom_style(context):
custom_style_path = get_wpadmin_settings(get_admin_site_name(c... | {
"repo_name": "benbovy/django-wpadmin-bootstrapped",
"path": "django_wpadmin_bootstrapped/templatetags/wpadmin_tags.py",
"copies": "1",
"size": "1295",
"license": "apache-2.0",
"hash": -8076324528505842000,
"line_mean": 30.5853658537,
"line_max": 80,
"alpha_frac": 0.7088803089,
"autogenerated": fal... |
from django import template
from django.utils.translation import ugettext_lazy as _
from wpadmin.utils import (
get_admin_site_name, get_wpadmin_settings, are_breadcrumbs_enabled)
register = template.Library()
def wpadmin_render_custom_style(context):
custom_style_path = get_wpadmin_settings(get_admin_site_... | {
"repo_name": "barszczmm/django-wpadmin",
"path": "wpadmin/templatetags/wpadmin_tags.py",
"copies": "2",
"size": "1302",
"license": "mit",
"hash": 1864172925952624600,
"line_mean": 30,
"line_max": 80,
"alpha_frac": 0.7104454685,
"autogenerated": false,
"ratio": 3.5,
"config_test": false,
"has... |
from django import template
from django.utils.translation import ugettext_lazy as _
register = template.Library()
# Constants
DOTFIELD = "<i class='fa fa-circle'></i>"
@register.filter()
def next(value, arg):
""" Get next element inside a forloop """
try:
return value[int(arg)+1]
except:
... | {
"repo_name": "n2o/guhema",
"path": "products/templatetags/products_tags.py",
"copies": "1",
"size": "1691",
"license": "mit",
"hash": 7006805603459781000,
"line_mean": 19.3734939759,
"line_max": 71,
"alpha_frac": 0.5777646363,
"autogenerated": false,
"ratio": 3.5155925155925156,
"config_test":... |
from django import template
from django.utils.translation import ugettext_lazy as _
register = template.Library()
def resolve(what, context):
try:
return template.Variable(what).resolve(context)
except template.VariableDoesNotExist:
return what
def get_bits(token):
bits = token.split_cont... | {
"repo_name": "brodie/django-socialregistration",
"path": "socialregistration/templatetags/__init__.py",
"copies": "1",
"size": "1094",
"license": "mit",
"hash": -3743282656223502300,
"line_mean": 32.1515151515,
"line_max": 111,
"alpha_frac": 0.6627056673,
"autogenerated": false,
"ratio": 4.06691... |
from django import template
from django.utils.translation import ugettext_lazy as _
register = template.Library()
@register.simple_tag
def upload_js(container=None):
if container:
container_sources = container.source if container.source else ''
container_tags = container.tags if container.tags el... | {
"repo_name": "williamroot/opps",
"path": "opps/contrib/fileupload/templatetags/upload_tags.py",
"copies": "5",
"size": "4502",
"license": "mit",
"hash": -4883592373851605000,
"line_mean": 39.1964285714,
"line_max": 78,
"alpha_frac": 0.4806752554,
"autogenerated": false,
"ratio": 3.63945028294260... |
from django import template
from django.utils.translation import ugettext_lazy as _, string_concat
from django.utils import timezone
from web.views import findAccount
from web.utils import singlecardurl
from django.forms.fields import NullBooleanField, BooleanField, DateTimeField
from dateutil.relativedelta import rela... | {
"repo_name": "dburr/SchoolIdolAPI",
"path": "web/templatetags/mod.py",
"copies": "3",
"size": "2552",
"license": "apache-2.0",
"hash": 6014537043139375000,
"line_mean": 23.5384615385,
"line_max": 77,
"alpha_frac": 0.710031348,
"autogenerated": false,
"ratio": 3.5395284327323164,
"config_test":... |
from django import template
from django.utils.tzinfo import LocalTimezone
from markdown import markdown
from pygments import highlight
from pygments.lexers import get_lexer_for_mimetype
from pygments.formatters import HtmlFormatter
from bitstructures.substructure.codeblocks import MarkdownCodeblocksParser
def rfc3339(... | {
"repo_name": "simonbates/bitstructures",
"path": "substructure/templatetags/substructure_tags.py",
"copies": "1",
"size": "1576",
"license": "mit",
"hash": -1351281165374357200,
"line_mean": 38.4,
"line_max": 76,
"alpha_frac": 0.6947969543,
"autogenerated": false,
"ratio": 4.236559139784946,
"... |
from django import template
from django.utils.unittest import TestCase
from templatetags import custom
class CustomFilterTests(TestCase):
def test_filter(self):
t = template.Template("{% load custom %}{{ string|trim:5 }}")
self.assertEqual(
t.render(template.Context({"string": "abcdefgh... | {
"repo_name": "disqus/django-old",
"path": "tests/regressiontests/templates/custom.py",
"copies": "1",
"size": "9382",
"license": "bsd-3-clause",
"hash": -8543313256049547000,
"line_mean": 53.2312138728,
"line_max": 128,
"alpha_frac": 0.6581752292,
"autogenerated": false,
"ratio": 4.0457093574816... |
from django import template
from django.utils.unittest import TestCase
class CallableVariablesTests(TestCase):
def test_callable(self):
class Doodad(object):
def __init__(self, value):
self.num_calls = 0
self.value = value
def __call__(self):
... | {
"repo_name": "GinnyN/towerofdimensions-django",
"path": "tests/regressiontests/templates/callables.py",
"copies": "37",
"size": "4088",
"license": "bsd-3-clause",
"hash": -8444183166244762000,
"line_mean": 35.8288288288,
"line_max": 79,
"alpha_frac": 0.560665362,
"autogenerated": false,
"ratio":... |
from django import template
from dss import settings
register = template.Library()
class ShowGoogleAnalyticsJS(template.Node):
def render(self, context):
code = getattr(settings, "GOOGLE_ANALYTICS_CODE", False)
if not code:
return "<!-- Google Analytics not included because you haven'... | {
"repo_name": "fergalmoran/dss",
"path": "core/analytics/google.py",
"copies": "2",
"size": "1088",
"license": "bsd-2-clause",
"hash": 5857842645542515000,
"line_mean": 42.56,
"line_max": 128,
"alpha_frac": 0.6479779412,
"autogenerated": false,
"ratio": 3.37888198757764,
"config_test": false,
... |
from django import template
from dynamic_preferences.registries import global_preferences_registry
register = template.Library()
@register.filter
def get_witnesses(user):
if hasattr(user, 'social_auth'):
socials = user.social_auth.filter(provider="steemconnect")
if all([
"account" in ... | {
"repo_name": "noisy/steemprojects.com",
"path": "social_auth_local/templatetags/witness_tags.py",
"copies": "1",
"size": "2642",
"license": "mit",
"hash": -3544620757578425300,
"line_mean": 27.4086021505,
"line_max": 82,
"alpha_frac": 0.5268735806,
"autogenerated": false,
"ratio": 4.539518900343... |
from django import template
from easy_thumbnails.files import get_thumbnailer
from filer.models import File
register = template.Library()
@register.filter
def dispatch_file(file: File):
"""
Dispatch file by extension.
"""
if file.extension in ["jpg", "png", "svg", "gif"]:
return _prepare_imag... | {
"repo_name": "n2o/dpb",
"path": "archive/templatetags/archive_tags.py",
"copies": "1",
"size": "1505",
"license": "mit",
"hash": -3727618269015304000,
"line_mean": 27.9230769231,
"line_max": 100,
"alpha_frac": 0.5605053191,
"autogenerated": false,
"ratio": 3.4976744186046513,
"config_test": fa... |
from django import template
from easy_thumbnails.files import get_thumbnailer
register = template.Library()
@register.simple_tag(takes_context=True)
def get_fb_image(context):
fb_image = None
# header image?
request = context['request']
current_page = getattr(request, 'current_page', None)
if cu... | {
"repo_name": "benzkji/django-layout",
"path": "apps/project_name/templatetags/project_name_tags.py",
"copies": "1",
"size": "1416",
"license": "mit",
"hash": 5673856721519304000,
"line_mean": 37.2702702703,
"line_max": 67,
"alpha_frac": 0.6052259887,
"autogenerated": false,
"ratio": 4.3703703703... |
from django import template
from easy_thumbnails.files import get_thumbnailer
register = template.Library()
VALID_OPTIONS = ('scale', 'width', 'height', 'max_size')
@register.simple_tag(takes_context=True)
def cropped_thumbnail(context, instance, ratiofieldname, **kwargs):
'''
Syntax:
{% cropped_thumbnai... | {
"repo_name": "pgferretti/wable_test",
"path": "image_cropping/templatetags/cropping.py",
"copies": "1",
"size": "2996",
"license": "mit",
"hash": 7643470325064342000,
"line_mean": 32.6629213483,
"line_max": 77,
"alpha_frac": 0.5914552737,
"autogenerated": false,
"ratio": 3.890909090909091,
"co... |
from django import template
from endless_pagination.utils import get_page_numbers
register = template.Library()
@register.inclusion_tag('dashboard/sessions.html', takes_context=True)
def show_sessions(context, sessions):
return {
'sessions': sessions,
'request': context.get('request')
}
@re... | {
"repo_name": "nwlunatic/vmmaster-frontend",
"path": "dashboard/templatetags/dashboard_tags.py",
"copies": "1",
"size": "1228",
"license": "mit",
"hash": -5934551572542581000,
"line_mean": 27.5813953488,
"line_max": 77,
"alpha_frac": 0.6376221498,
"autogenerated": false,
"ratio": 3.84952978056426... |
from django import template
from eventsfinder.models import Event, Attendee
register = template.Library()
@register.assignment_tag(takes_context=True)
def is_attending(context, event):
user = context['request'].user
attending = False
try:
attendee = Attendee.objects.get(attendee=user, event=event... | {
"repo_name": "axsauze/eventsfinder",
"path": "eventsfinder/templatetags/ef_tags.py",
"copies": "1",
"size": "1039",
"license": "bsd-3-clause",
"hash": -4907699414628088000,
"line_mean": 21.1276595745,
"line_max": 67,
"alpha_frac": 0.6660250241,
"autogenerated": false,
"ratio": 3.658450704225352,... |
from django import template
from feincms.module.medialibrary.models import Category
from feincms.module.page.models import Page, PageManager
try:
from feincms.templatetags.feincms_page_tags import is_equal_or_parent_of
except ImportError:
from feincms.module.page.templatetags.feincms_page_tags import is_equal_o... | {
"repo_name": "incuna/incuna-feincms",
"path": "incunafein/templatetags/incunafein_tags.py",
"copies": "1",
"size": "13387",
"license": "bsd-2-clause",
"hash": -8190181360491595000,
"line_mean": 36.2896935933,
"line_max": 144,
"alpha_frac": 0.5648763726,
"autogenerated": false,
"ratio": 4.0826471... |
from django import template
from ..forms import CommentForm
from django.conf import settings
from django.apps import apps
from django.db.models.aggregates import Count
from django.core.cache import cache
from django.template.loader import render_to_string
register = template.Library()
@register.simple_tag
def generat... | {
"repo_name": "r26zhao/django_blog",
"path": "easy_comment/templatetags/comment_tags.py",
"copies": "1",
"size": "1804",
"license": "mit",
"hash": 7075860289301608000,
"line_mean": 30.649122807,
"line_max": 92,
"alpha_frac": 0.6890243902,
"autogenerated": false,
"ratio": 3.359404096834264,
"con... |
from django import template
from fractions import Fraction
from hyphen import hyphenator, dictools, config
from django.utils.html import conditional_escape
from django.utils.safestring import mark_safe
from django.conf import settings
from kcal.models import Event
import re
import os
register = template.Library()
@re... | {
"repo_name": "ftrain/django-ftrain",
"path": "features/templatetags/ohlih_extras.py",
"copies": "1",
"size": "4106",
"license": "bsd-3-clause",
"hash": -6159967725184228000,
"line_mean": 28.7536231884,
"line_max": 164,
"alpha_frac": 0.5470043838,
"autogenerated": false,
"ratio": 3.15846153846153... |
from django import template
from freemix.permissions import PermissionsRegistry
register = template.Library()
@register.inclusion_tag("dataset/dataset_list_item.html", takes_context=True)
def dataset_list_item(context, dataset):
request = context["request"]
user = request.user
can_edit = user.has_perm("... | {
"repo_name": "zepheira/freemix",
"path": "freemix/dataset/templatetags/dataset_tags.py",
"copies": "1",
"size": "1283",
"license": "apache-2.0",
"hash": -3968461713794236000,
"line_mean": 35.6571428571,
"line_max": 106,
"alpha_frac": 0.6539360873,
"autogenerated": false,
"ratio": 3.6345609065155... |
from django import template
from front.models import *
import re
import logging
log = logging.getLogger(__name__)
log.info("Logging started")
UNLOADED = 'unloaded'
register = template.Library()
# preloads
_FOLLOW_RE = re.compile('follow=(True|False)')
_RATEABLE_TEMPLATE = UNLOADED
def get_RATEABLE_TEMPLATE():
... | {
"repo_name": "flaviodesousa/ratonator",
"path": "front/templatetags/ratonator.py",
"copies": "1",
"size": "2813",
"license": "bsd-3-clause",
"hash": -460017195074508740,
"line_mean": 28.3020833333,
"line_max": 120,
"alpha_frac": 0.6473515819,
"autogenerated": false,
"ratio": 3.8064952638700946,
... |
from django import template
from ghoster import forms
from django.contrib import admin
from django.contrib.admin import helpers
import pprint
import copy
import re
register = template.Library()
def __flatten(fields):
"""Returns a list which is a single level of flattening of the
original list."""
flat = [... | {
"repo_name": "ZuirensGit/django-ghoster",
"path": "ghoster/templatetags/ghoster_tags.py",
"copies": "1",
"size": "3189",
"license": "mit",
"hash": 6555846536091559000,
"line_mean": 28.8037383178,
"line_max": 102,
"alpha_frac": 0.6472248354,
"autogenerated": false,
"ratio": 3.971357409713574,
"... |
from django import template
from google.appengine.api import memcache
register = template.Library()
@register.filter
def filter_media(value):
return value[:3]
@register.filter
def filter_thumbnails(value):
return value[:1]
@register.filter
def summary(value):
services = {
'dailymotion': {
... | {
"repo_name": "bgolub/fftogo",
"path": "fftogo/templatetags/fftogo_tags.py",
"copies": "1",
"size": "3603",
"license": "mit",
"hash": -8223352335268157000,
"line_mean": 26.0902255639,
"line_max": 101,
"alpha_frac": 0.5278934221,
"autogenerated": false,
"ratio": 3.6102204408817635,
"config_test"... |
from django import template
from gpcharts import figure
from django.db import connection
from django.utils.safestring import mark_safe
import datetime
import time
register = template.Library()
@register.filter(name='intcommat')
def intcommat(value):
return value + 1
@register.filter(name='comision')
def comisio... | {
"repo_name": "exildev/AutoLavadox",
"path": "operacion/informes/templatetags/informe_extra.py",
"copies": "2",
"size": "2234",
"license": "mit",
"hash": -5763704591309524000,
"line_mean": 27.2784810127,
"line_max": 510,
"alpha_frac": 0.6195165622,
"autogenerated": false,
"ratio": 3.0271002710027... |
from django import template
from html5base import settings
import re
register = template.Library()
@register.inclusion_tag('html5base/includes/google_analytics.html', takes_context=True)
def google_analytics(context):
context.update({'id': settings.DEFAULT_SETTINGS.get('google_analytics_id'),\
... | {
"repo_name": "42cc/django-html5base",
"path": "html5base/templatetags/html5base_tags.py",
"copies": "1",
"size": "1232",
"license": "bsd-3-clause",
"hash": -4862927110661218000,
"line_mean": 38.7419354839,
"line_max": 87,
"alpha_frac": 0.7491883117,
"autogenerated": false,
"ratio": 3.52,
"conf... |
from django import template
from html_sweatshop.conf import settings
from django.db import models
register = template.Library()
@register.inclusion_tag('one_step_delete/delete_confirm_dialog.html', takes_context = True)
def render_confirm_modal(context, dialog_id = 'confirmation-modal', obj = '', obj_description = ''... | {
"repo_name": "georgema1982/django-html-sweatshop",
"path": "html_sweatshop/templatetags/one_step_delete_tags.py",
"copies": "1",
"size": "1086",
"license": "mit",
"hash": -3897231774425460700,
"line_mean": 59.3333333333,
"line_max": 172,
"alpha_frac": 0.7348066298,
"autogenerated": false,
"ratio... |
from django import template
from icekit.workflow.models import WorkflowState
register = template.Library()
class AssigedToUserNode(template.Node):
def __init__(self, limit, varname, user):
self.limit, self.varname, self.user = limit, varname, user
def __repr__(self):
return "<GetAssigedToUse... | {
"repo_name": "ic-labs/django-icekit",
"path": "icekit/workflow/templatetags/workflow_tags.py",
"copies": "1",
"size": "2222",
"license": "mit",
"hash": -8527924684417919000,
"line_mean": 36.0333333333,
"line_max": 115,
"alpha_frac": 0.6359135914,
"autogenerated": false,
"ratio": 3.89824561403508... |
from django import template
from ietf.person.models import Person
import datetime
register = template.Library()
@register.filter
def abbr_status(value):
"""
Converts RFC Status to a short abbreviation
"""
d = {'Proposed Standard':'PS',
'Draft Standard':'DS',
'Standard':'S',
... | {
"repo_name": "mcr/ietfdb",
"path": "ietf/secr/sreq/templatetags/ams_filters.py",
"copies": "2",
"size": "1764",
"license": "bsd-3-clause",
"hash": -5776186126800212000,
"line_mean": 24.2,
"line_max": 83,
"alpha_frac": 0.5861678005,
"autogenerated": false,
"ratio": 3.7136842105263157,
"config_t... |
from django import template
from ietf.person.models import Person
register = template.Library()
@register.filter
def abbr_status(value):
"""
Converts RFC Status to a short abbreviation
"""
d = {'Proposed Standard':'PS',
'Draft Standard':'DS',
'Standard':'S',
'Historic':'H',... | {
"repo_name": "wpjesus/codematch",
"path": "ietf/secr/sreq/templatetags/ams_filters.py",
"copies": "2",
"size": "1748",
"license": "bsd-3-clause",
"hash": -2485581697295360000,
"line_mean": 23.9714285714,
"line_max": 83,
"alpha_frac": 0.5829519451,
"autogenerated": false,
"ratio": 3.7033898305084... |
from django import template
from image.models import Image
from django.db.models import Q
register = template.Library()
# Custom filter, return all images that are:
# public, shared, or belong to a logged in user
@register.filter
def viewable_all_users(self, user):
query = Image.objects.filter(
Q(user... | {
"repo_name": "henry808/mod_drops",
"path": "image/templatetags/image_extras.py",
"copies": "1",
"size": "1135",
"license": "mit",
"hash": 2061487932166881500,
"line_mean": 23.6739130435,
"line_max": 50,
"alpha_frac": 0.6317180617,
"autogenerated": false,
"ratio": 3.6378205128205128,
"config_te... |
from django import template
from imagequery import ImageQuery, formats
from imagequery.utils import get_imagequery
from django.db.models.fields.files import ImageFieldFile
from django.utils.encoding import smart_unicode
from imagequery.settings import ALLOW_LAZY_FORMAT, LAZY_FORMAT_DEFAULT
register = template.Library(... | {
"repo_name": "team23/django_imagequery",
"path": "imagequery/templatetags/imagequery_tags.py",
"copies": "1",
"size": "5802",
"license": "bsd-3-clause",
"hash": 8030210179171859000,
"line_mean": 30.8791208791,
"line_max": 111,
"alpha_frac": 0.6344364012,
"autogenerated": false,
"ratio": 3.993117... |
from django import template
from .. import Menu
register = template.Library()
class MenuNode(template.Node):
def __init__(self):
pass
def render(self, context):
# if a 500 error happens we get an empty context, in which case
# we should just return to let the 500.html template render
... | {
"repo_name": "borgstrom/django-simple-menu",
"path": "menu/templatetags/menu.py",
"copies": "1",
"size": "2253",
"license": "bsd-2-clause",
"hash": -8111781925856485000,
"line_mean": 33.1363636364,
"line_max": 89,
"alpha_frac": 0.5481580115,
"autogenerated": false,
"ratio": 4.743157894736842,
... |
from django import template
from improved_inlines.parser import inlines
import re
register = template.Library()
@register.filter
def render_inlines(value):
"""
Renders inlines in a ``Post`` by passing them through inline templates.
Template Syntax::
{{ post.body|render_inlines|markdown:"safe" }... | {
"repo_name": "issackelly/django-improved-inlines",
"path": "improved_inlines/templatetags/inlines.py",
"copies": "1",
"size": "1165",
"license": "bsd-3-clause",
"hash": -4735807077707152000,
"line_mean": 23.7872340426,
"line_max": 76,
"alpha_frac": 0.6549356223,
"autogenerated": false,
"ratio": ... |
from django import template
from inlines.parser import ContentParser
from inlines.models import InlineType
import re
register = template.Library()
@register.filter
def render_inlines(value):
"""
Renders inlines in a ``Post`` by passing them through inline templates.
Template Syntax::
{{ post.bo... | {
"repo_name": "pigmonkey/django-inlineobjects",
"path": "inlines/templatetags/inlines_tags.py",
"copies": "1",
"size": "2119",
"license": "bsd-3-clause",
"hash": 3493756531206782000,
"line_mean": 25.4875,
"line_max": 83,
"alpha_frac": 0.6134969325,
"autogenerated": false,
"ratio": 4.1467710371819... |
from django import template
from issues.models import Issue
register = template.Library()
def convert_status_to_icon(task_taken):
if task_taken is None:
return ""
if isinstance(task_taken, Issue):
return ''
if task_taken.status_check == task_taken.EDIT:
return "icon-wrench"
e... | {
"repo_name": "znick/anytask",
"path": "anytask/tasks/templatetags/icon.py",
"copies": "1",
"size": "1531",
"license": "mit",
"hash": 1453826475021011700,
"line_mean": 24.5166666667,
"line_max": 82,
"alpha_frac": 0.6583932071,
"autogenerated": false,
"ratio": 3.350109409190372,
"config_test": f... |
from django import template
from ittybitty.models import IttyBittyURL
from ittybitty.utils import gen_shortcut
register = template.Library()
class IttyBittyURLNode(template.Node):
"""
Takes care of creating the actual Itty Bitty URL if one doesn't exist for
the current page. If one does exist already, it... | {
"repo_name": "halitalptekin/PyTr",
"path": "src/ittybitty/templatetags/ittybitty_tags.py",
"copies": "3",
"size": "2406",
"license": "bsd-3-clause",
"hash": 542201097246061200,
"line_mean": 33.3714285714,
"line_max": 90,
"alpha_frac": 0.6317539485,
"autogenerated": false,
"ratio": 3.963756177924... |
from django import template
from juakstore.models import Booking
from juakstore.mycalendar import BookingCalendar, WeeklyCalendar
from django.utils.safestring import mark_safe
from datetime import datetime, timedelta
register = template.Library()
@register.tag(name="calendar")
def populate_calendar(parser, token):
... | {
"repo_name": "CSC301H-Fall2013/JuakStore",
"path": "Storefront/juakstore/templatetags/juakstore_extras.py",
"copies": "1",
"size": "2670",
"license": "mit",
"hash": 9129998909180043000,
"line_mean": 38.2794117647,
"line_max": 114,
"alpha_frac": 0.6621722846,
"autogenerated": false,
"ratio": 3.87... |
from django import template
from limbo.drilldown.util import DateDrillDown
register = template.Library()
class DateDrillDownNode(DateDrillDown):
pass
class MonthDrillDownNode(DateDrillDownNode):
def days(self, year, month):
return []
@register.tag
def date_drill_down(parser, token):
try:
... | {
"repo_name": "gdoermann/django-limbo",
"path": "limbo/drilldown/templatetags/drilldown_tags.py",
"copies": "1",
"size": "1095",
"license": "mit",
"hash": -6639389204453581000,
"line_mean": 27.0769230769,
"line_max": 105,
"alpha_frac": 0.6438356164,
"autogenerated": false,
"ratio": 3.555194805194... |
from django import template
from livesettings import config_value
from l10n.utils import moneyfmt
from tax.templatetags.satchmo_tax import CartitemLineTaxedTotalNode, CartTaxedTotalNode
import logging
log = logging.getLogger('shop.templatetags.satchmo_cart')
register = template.Library()
class CartitemTotalNode(temp... | {
"repo_name": "dokterbob/satchmo",
"path": "satchmo/apps/satchmo_store/shop/templatetags/satchmo_cart.py",
"copies": "1",
"size": "5420",
"license": "bsd-3-clause",
"hash": -2639346860273471000,
"line_mean": 29.2793296089,
"line_max": 122,
"alpha_frac": 0.6398523985,
"autogenerated": false,
"rati... |
from django import template
from livesettings import config_value
from product.models import Product
from product.queries import bestsellers
from satchmo_utils.templatetags import get_filter_args
import keyedcache
register = template.Library()
@register.filter
def best_selling_products_list(count):
"""Get a list ... | {
"repo_name": "dokterbob/satchmo",
"path": "satchmo/apps/product/templatetags/satchmo_product.py",
"copies": "1",
"size": "2897",
"license": "bsd-3-clause",
"hash": 1518998311461375500,
"line_mean": 26.3301886792,
"line_max": 95,
"alpha_frac": 0.6575768036,
"autogenerated": false,
"ratio": 3.7819... |
from django import template
from mapfeed.models import MapPath, MapStation
register = template.Library()
#provide sequenced order of stations
def draw_line(line):
seq_sta = []
paths = MapPath.objects.filter(line__id=line.id).order_by('seq_num')
for p in paths:
station = MapStation.objects.get(id=p... | {
"repo_name": "D8TM/railtracker",
"path": "sitetags/templatetags/graphic_tags.py",
"copies": "1",
"size": "1607",
"license": "apache-2.0",
"hash": 6656409863953425000,
"line_mean": 24.9193548387,
"line_max": 75,
"alpha_frac": 0.6509023024,
"autogenerated": false,
"ratio": 3.5010893246187362,
"c... |
from django import template
from maqluengine import *
from maqluengine.models import *
import sys
import random
register = template.Library()
###########################################################################################################
# ERROR / INFO LOGGER SETUP
####################################... | {
"repo_name": "robcbryant/projectanka",
"path": "maqluengine/templatetags/enki_tags.py",
"copies": "1",
"size": "5824",
"license": "apache-2.0",
"hash": -1141628946341323900,
"line_mean": 36.5741935484,
"line_max": 130,
"alpha_frac": 0.6026785714,
"autogenerated": false,
"ratio": 3.61290322580645... |
from django import template
from markitup import settings
from markitup.util import absolute_url
from markitup.fields import render_func
register = template.Library()
@register.filter
def render_markup(content):
return render_func(content)
# we do some funny stuff here for testability (the tests need to be
# ... | {
"repo_name": "ixc/django-markitup",
"path": "markitup/templatetags/markitup_tags.py",
"copies": "1",
"size": "1674",
"license": "bsd-3-clause",
"hash": -3086652068989515300,
"line_mean": 28.8928571429,
"line_max": 74,
"alpha_frac": 0.7144563919,
"autogenerated": false,
"ratio": 3.314851485148514... |
from django import template
from math import log10
register = template.Library()
def compute_tag_sizes(tags, min_font_size, max_font_size):
"""
This computes and returns a list of tag font weight sizes, between the
minimum and maximum font sizes specified, using a logarthmic assessment.
"""
tag_li... | {
"repo_name": "sjkingo/django_tagcloud",
"path": "tagcloud/templatetags/tagcloud.py",
"copies": "1",
"size": "1048",
"license": "bsd-2-clause",
"hash": -2446291314720249000,
"line_mean": 35.1379310345,
"line_max": 108,
"alpha_frac": 0.6288167939,
"autogenerated": false,
"ratio": 3.413680781758958... |
from django import template
from math import pi
import string
from obstool import settings
try:
import ephem3 as ephem
except:
import ephem
register = template.Library()
def date2hms(value):
# assume it is a date object
d = ephem.Date(value + settings.TZ_OFFSET*ephem.hour)
return(string.split(str(d))[1... | {
"repo_name": "chrisrburns/obstool",
"path": "navigator/templatetags/myfilters.py",
"copies": "1",
"size": "1598",
"license": "mit",
"hash": 6144318341077840000,
"line_mean": 23.2121212121,
"line_max": 56,
"alpha_frac": 0.7040050063,
"autogenerated": false,
"ratio": 2.7316239316239317,
"config_... |
from django import template
from math import pi, sin, cos
from decimal import Decimal
register = template.Library()
def right_ascension(ra, max):
return float(ra) / 24.0 * max
@register.simple_tag
def xpos(ra, dec, max):
r, theta = get_r_theta(ra, dec)
if(dec >= 0):
offset = 0.25
else:
... | {
"repo_name": "Floppy/kepler-explorer",
"path": "celestial/templatetags/celestial_tags.py",
"copies": "1",
"size": "1112",
"license": "mit",
"hash": 3391473067993006000,
"line_mean": 25.4761904762,
"line_max": 79,
"alpha_frac": 0.6393884892,
"autogenerated": false,
"ratio": 2.910994764397906,
"... |
from django import template
from mediasync import backends
from mediasync.conf import msettings
import mediasync
import mimetypes
# Instance of the backend you configured in settings.py.
client = backends.client()
register = template.Library()
class BaseTagNode(template.Node):
"""
Base class for all mediasyn... | {
"repo_name": "sunlightlabs/django-mediasync",
"path": "mediasync/templatetags/media.py",
"copies": "2",
"size": "10506",
"license": "bsd-3-clause",
"hash": 831243338153436200,
"line_mean": 34.9794520548,
"line_max": 114,
"alpha_frac": 0.6013706453,
"autogenerated": false,
"ratio": 3.990125332320... |
from django import template
from metashare.settings import MEDIA_URL
from metashare.repository.model_utils import get_resource_license_types
from replace import pretty_camel
register = template.Library()
@register.filter("licence_icon")
def licence_icon(licence):
if licence == "non-standard/Other_Licence/Terms":
... | {
"repo_name": "MiltosD/CEF-ELRC",
"path": "metashare/repository/templatetags/resource_distribution.py",
"copies": "2",
"size": "1157",
"license": "bsd-3-clause",
"hash": -5864528750310219000,
"line_mean": 41.8518518519,
"line_max": 115,
"alpha_frac": 0.6750216076,
"autogenerated": false,
"ratio":... |
from django import template
from mezzanine.conf import settings
from newsletter.models import Newsletter
from newsletter.forms import SubscribeRequestForm
from robokassa.forms import RobokassaForm
from lacesandstuff.apps.las_shop.models import ShippingType
register = template.Library()
@register.assignment_tag()
d... | {
"repo_name": "dfirst/romasshop",
"path": "lacesandstuff/apps/las_shop/templatetags/las_shop_tags.py",
"copies": "1",
"size": "1024",
"license": "bsd-3-clause",
"hash": 4857953765588267000,
"line_mean": 25.2564102564,
"line_max": 67,
"alpha_frac": 0.705078125,
"autogenerated": false,
"ratio": 3.4... |
from django import template
from microdevices.models import MicrophysiologyCenter
from django.contrib.auth.models import Group
register = template.Library()
# AVOID MAGIC STRINGS
VIEWER_SUFFIX = ' Viewer'
ADMIN_SUFFIX = ' Admin'
# One of the tricky things about filters is that they spawn a SQL query each time they a... | {
"repo_name": "UPDDI/mps-database-server",
"path": "mps/templatetags/custom_filters.py",
"copies": "1",
"size": "4036",
"license": "mit",
"hash": -7685335040584125000,
"line_mean": 30.53125,
"line_max": 104,
"alpha_frac": 0.6689791873,
"autogenerated": false,
"ratio": 3.7301293900184844,
"confi... |
from django import template
from midnight_main.models import Menu, PhotoAlbum, IncludeArea
from django.core.urlresolvers import reverse
import uuid
from django.utils.module_loading import import_string
from midnight_main.services import mark_current_menus
register = template.Library()
def show_menu(context, slug, l... | {
"repo_name": "webadmin87/midnight",
"path": "midnight_main/templatetags/midnight_main.py",
"copies": "1",
"size": "6753",
"license": "bsd-3-clause",
"hash": -1631282639012184800,
"line_mean": 28.2615384615,
"line_max": 133,
"alpha_frac": 0.6699964949,
"autogenerated": false,
"ratio": 2.470129870... |
from django import template
from midnight_news.models import News, Section
register = template.Library()
def show_news_line(slug=None, limit=3, **kwargs):
"""
Отображает список последних новостей
Пример использования::
{% show_news_line 'news_section_slug' 3 class='news-class' %}
:param sl... | {
"repo_name": "webadmin87/midnight",
"path": "midnight_news/templatetags/midnight_news.py",
"copies": "1",
"size": "1184",
"license": "bsd-3-clause",
"hash": -5230121870257066000,
"line_mean": 30.40625,
"line_max": 113,
"alpha_frac": 0.6825870647,
"autogenerated": false,
"ratio": 2.55076142131979... |
from django import template
from ..models import Comment, Ticket
register = template.Library()
class CommitCommentNode(template.Node):
def __init__(self, commit, varname):
self.commit = template.Variable(commit)
self.varname = varname
def render(self, context):
commit = self.commit.r... | {
"repo_name": "Mediaphormedia/gitsummary",
"path": "gitsummary/changelog/templatetags/changelog.py",
"copies": "1",
"size": "1621",
"license": "mit",
"hash": 1501513780058942500,
"line_mean": 26.4745762712,
"line_max": 77,
"alpha_frac": 0.6594694633,
"autogenerated": false,
"ratio": 4.17783505154... |
from django import template
from ..models import FinancingPlan
register = template.Library()
@register.simple_tag
def get_default_plan():
return FinancingPlan.objects.filter(
advertising_enabled=True, is_default_plan=True
).first()
@register.simple_tag
def get_plan_for_product(request, product):
... | {
"repo_name": "thelabnyc/django-oscar-wfrs",
"path": "src/wellsfargo/templatetags/wfrs_default_plan.py",
"copies": "1",
"size": "1043",
"license": "isc",
"hash": 7568205170992400000,
"line_mean": 27.1891891892,
"line_max": 67,
"alpha_frac": 0.6807286673,
"autogenerated": false,
"ratio": 3.5965517... |
from django import template
from ..models import Form
register = template.Library()
class WysiwygFormNode(template.Node):
def __init__(self, form_id, render_type):
self.form_id = form_id
self.render_type = render_type
def render(self, context):
if self.form_id in context:
... | {
"repo_name": "fitzgen/django-wysiwyg-forms",
"path": "wysiwyg_forms/templatetags/wysiwyg_forms_tags.py",
"copies": "2",
"size": "1513",
"license": "mit",
"hash": 1255943060236382000,
"line_mean": 31.1914893617,
"line_max": 114,
"alpha_frac": 0.5915399868,
"autogenerated": false,
"ratio": 3.70833... |
from django import template
from ..models import Link
register = template.Library()
# TODO: refactor this file so its not a condensed version of OrderedFlatPages
class LinkNode(template.Node):
def __init__(self, context_name, starts_with=None, user=None):
self.context_name = context_name
def re... | {
"repo_name": "sreidy/roboticsclub.org",
"path": "links/templatetags/link.py",
"copies": "2",
"size": "1522",
"license": "mit",
"hash": 4882992910364602000,
"line_mean": 30.7291666667,
"line_max": 77,
"alpha_frac": 0.5860709593,
"autogenerated": false,
"ratio": 3.9532467532467535,
"config_test"... |
from django import template
from models import *
from django.db import models
from django.db.models import Count, Min, Sum, Max, Avg
from django.db import connection, transaction
import logging, datetime
register = template.Library()
from datetime import date, timedelta
@register.filter(name='fromunix')
def fromunix(... | {
"repo_name": "hughsons/lawcore",
"path": "fixtures/templatetags/tagsfilter.py",
"copies": "1",
"size": "4825",
"license": "bsd-3-clause",
"hash": 5914550856292474000,
"line_mean": 32.7412587413,
"line_max": 83,
"alpha_frac": 0.6095336788,
"autogenerated": false,
"ratio": 3.720123361603701,
"co... |
from django import template
from models import *
from django.db import models
from django.db.models import Count, Min, Sum, Max, Avg
from django.db import connection, transaction
import logging
register = template.Library()
from datetime import date, timedelta, datetime
def now_str():
"""Return hh:mm:ss string r... | {
"repo_name": "hughsons/saltwaterfish",
"path": "admin/templatetags/tagsfilter.py",
"copies": "1",
"size": "17346",
"license": "bsd-3-clause",
"hash": 8617106529709573000,
"line_mean": 37.5466666667,
"line_max": 355,
"alpha_frac": 0.6272915946,
"autogenerated": false,
"ratio": 3.7504864864864866,... |
from django import template
from ..models import *
from django.db.models.aggregates import Count
from django.core.cache import cache
register = template.Library()
@register.simple_tag
def get_category():
category_list = Category.objects.annotate(post_num=Count('post')).order_by('-post_num')
Category.objects.... | {
"repo_name": "r26zhao/django_blog",
"path": "blog/templatetags/blog_tags.py",
"copies": "1",
"size": "1349",
"license": "mit",
"hash": 8070562168942478000,
"line_mean": 24.9423076923,
"line_max": 110,
"alpha_frac": 0.6641957005,
"autogenerated": false,
"ratio": 3.330864197530864,
"config_test"... |
from django import template
from ..models import PublishedTranslation
from django.core.urlresolvers import reverse
from django.utils.safestring import mark_safe
register = template.Library()
def publish_btn(pk, s, clas='btn-mini'):
btn = '<a href="%s" class="btn btn-inverse %s">%s</a>'
return btn % (reverse(... | {
"repo_name": "firemark/yellowjuice",
"path": "articles/templatetags/translation.py",
"copies": "1",
"size": "2161",
"license": "mit",
"hash": 6863184269588997000,
"line_mean": 29.8714285714,
"line_max": 75,
"alpha_frac": 0.6293382693,
"autogenerated": false,
"ratio": 3.542622950819672,
"config... |
from django import template
from ..models import Question
register = template.Library()
class UserAnswerNode(template.Node):
"""
TemplateTag RenderNode
renders whether user answered a question.pk
"""
def __init__(self, user, question):
self.user = template.Variable(user)
self.var... | {
"repo_name": "aneumeier/questions",
"path": "questions/templatetags/question.py",
"copies": "1",
"size": "1045",
"license": "bsd-3-clause",
"hash": -3532410938638274000,
"line_mean": 25.7948717949,
"line_max": 70,
"alpha_frac": 0.64784689,
"autogenerated": false,
"ratio": 4.26530612244898,
"co... |
from django import template
from ..models import Snippet
register = template.Library()
class snippet_node(template.Node):
def __init__(self, name, default):
self.name = template.Variable(name)
if default:
self.default = template.Variable(default)
else:
self.default = None
def render(self, context):
... | {
"repo_name": "SurfasJones/icecream-info",
"path": "icecream/lib/python2.7/site-packages/snippet/templatetags/snippet.py",
"copies": "1",
"size": "1680",
"license": "mit",
"hash": -2571516388587719700,
"line_mean": 25.6666666667,
"line_max": 75,
"alpha_frac": 0.7220238095,
"autogenerated": false,
... |
from django import template
from ..models import Student_Subject, Subject, Log
from django.utils.translation import ugettext as _
register = template.Library()
@register.filter
def teacherOf(student,subject):
return Student_Subject.objects.get(student = student, subject = subject).teacher
@register.filter
def stude... | {
"repo_name": "Andrew0701/coursework-web",
"path": "progress/home/templatetags/filters.py",
"copies": "1",
"size": "1995",
"license": "apache-2.0",
"hash": 4976425366528694000,
"line_mean": 26.9571428571,
"line_max": 103,
"alpha_frac": 0.7218813906,
"autogenerated": false,
"ratio": 2.977168949771... |
from django import template
from ..models import User
from allauth.socialaccount.models import SocialAccount
from django.conf import settings
register = template.Library()
"""
checks the use-case where a user is using alternate method to login.
e.g. he had a local account and now he is trying to login with facebook
t... | {
"repo_name": "vinodpandey/django-test-site",
"path": "apps/django_custom_auth/templatetags/django_custom_auth_utils.py",
"copies": "1",
"size": "1350",
"license": "mit",
"hash": 6063307859923965000,
"line_mean": 37.5714285714,
"line_max": 101,
"alpha_frac": 0.682962963,
"autogenerated": false,
"... |
from django import template
from ..models import Votes
from django.db.models import Sum
import pprint
register = template.Library()
# TODO: Fix so much queries here...
@register.filter
def count( code ):
# print( (Votes.objects.filter(code=code).aggregate(Sum('vote'))).vote__sum);
# total = Votes.objects.filter(code... | {
"repo_name": "algobook/algoBook",
"path": "main/templatetags/votes_filter.py",
"copies": "1",
"size": "1146",
"license": "apache-2.0",
"hash": 8744778337221908000,
"line_mean": 25.0454545455,
"line_max": 93,
"alpha_frac": 0.6771378709,
"autogenerated": false,
"ratio": 2.9086294416243654,
"conf... |
from django import template
from mptt.templatetags.mptt_tags import tree_info
from content.models import *
register = template.Library()
@register.simple_tag
def nav(nav_slug, pagepath=None, parent=None, depth=0):
html = []
if pagepath:
current_page = pagepath[-1]
pagepath_ids = [p.id for p in pagepath]
if par... | {
"repo_name": "jholster/django-birdie",
"path": "content/templatetags/content_extra.py",
"copies": "1",
"size": "1260",
"license": "bsd-3-clause",
"hash": 7371578595302215000,
"line_mean": 29.0238095238,
"line_max": 91,
"alpha_frac": 0.680952381,
"autogenerated": false,
"ratio": 2.896551724137931... |
from django import template
from nadb.models import Category, Post
import re
register = template.Library()
class CategoriesNode(template.Node):
def __init__(self, var_name):
self.var_name = var_name
def render(self, context):
categories = Category.objects.all()
context[self.va... | {
"repo_name": "earonne/django-nadb",
"path": "nadb/templatetags/nadb_blog.py",
"copies": "2",
"size": "1650",
"license": "bsd-3-clause",
"hash": 4978504133472594000,
"line_mean": 30.75,
"line_max": 99,
"alpha_frac": 0.6303030303,
"autogenerated": false,
"ratio": 3.733031674208145,
"config_test"... |
from django import template
from ncharts import models as nc_models
import datetime
register = template.Library()
@register.filter
def get_long_name(vs, v):
"""Get 'long_name' value of vs[v] """
try:
return vs[v]['long_name']
except:
return ''
@register.filter
def get_item(dictionary, key... | {
"repo_name": "ncareol/ncharts",
"path": "ncharts/templatetags/filters.py",
"copies": "1",
"size": "1520",
"license": "bsd-2-clause",
"hash": 6008892812438323000,
"line_mean": 23.9180327869,
"line_max": 65,
"alpha_frac": 0.6447368421,
"autogenerated": false,
"ratio": 3.4157303370786516,
"config... |
from django import template
from news_and_events.models import NewsAndEventsPlugin
# from entity_tags import work_out_entity
from news_and_events.cms_plugins import CMSNewsAndEventsPlugin
#from django.template.defaultfilters import date
register = template.Library()
@register.inclusion_tag('arkestra/universal_pl... | {
"repo_name": "evildmp/Arkestra",
"path": "news_and_events/templatetags/news_and_events_tags.py",
"copies": "2",
"size": "2808",
"license": "bsd-2-clause",
"hash": -4807396963396103000,
"line_mean": 33.6666666667,
"line_max": 98,
"alpha_frac": 0.6987179487,
"autogenerated": false,
"ratio": 3.7843... |
from django import template
from news.models import NewsFeed
register = template.Library()
@register.inclusion_tag('news/newsfeed.html')
def newsfeed(amount=None):
if amount is None:
feeds = NewsFeed.objects.all()
else:
feeds = NewsFeed.objects.all()[0:amount]
return {'feeds': feeds}
@r... | {
"repo_name": "vanyh/handkeinzungen-app",
"path": "news/templatetags/news_extras.py",
"copies": "1",
"size": "1277",
"license": "mit",
"hash": 7706591077978377000,
"line_mean": 25.0612244898,
"line_max": 61,
"alpha_frac": 0.6656225529,
"autogenerated": false,
"ratio": 3.489071038251366,
"config... |
from django import template
from news.models import NewsFeed
register = template.Library()
@register.inclusion_tag('news/toggle.html')
def toggle_feeds():
return {'some_context': 'Some Context'}
@register.inclusion_tag('news/newsfeed.html')
def newsfeed(amount=None, default_visible=5):
if amount is None:
... | {
"repo_name": "acdh-oeaw/dig_ed_cat",
"path": "news/templatetags/news_extras.py",
"copies": "1",
"size": "1497",
"license": "mit",
"hash": 5058544515331512000,
"line_mean": 26.7222222222,
"line_max": 63,
"alpha_frac": 0.6760187041,
"autogenerated": false,
"ratio": 3.4976635514018692,
"config_te... |
from django import template
from oa_platform.models import Platform, PlatformDimension
from pirate_core import namespace_get
from django.contrib.contenttypes.models import ContentType
from pirate_consensus.models import Consensus
from django import forms
from pirate_core.fields import JqSplitDateTimeField
from pirate_c... | {
"repo_name": "fragro/Open-Assembly",
"path": "ver1_0/openassembly/oa_platform/templatetags/platformtags.py",
"copies": "1",
"size": "4827",
"license": "bsd-3-clause",
"hash": 3066336057988328000,
"line_mean": 32.2896551724,
"line_max": 137,
"alpha_frac": 0.6668738347,
"autogenerated": false,
"ra... |
# from django import template
# from order.models import Order
# from order.api import get_alipay_form, get_alipay_url_params,get_refund_form
# import logging
# logger = logging.getLogger("django")
# register = template.Library()
# @register.tag('pay')
# def pay(parser, token):
# order = parser.compile_filter(toke... | {
"repo_name": "kinsney/sport",
"path": "order/templatetags/bill.py",
"copies": "1",
"size": "2331",
"license": "mit",
"hash": 8454459610883350000,
"line_mean": 37.85,
"line_max": 95,
"alpha_frac": 0.6156156156,
"autogenerated": false,
"ratio": 3.383164005805515,
"config_test": false,
"has_no_... |
from django import template
from orders import models
from orders import utils
register = template.Library()
get_ingredient = models.Ingredient.objects.get
@register.filter
def ingredient_name(ingredient_id):
return get_ingredient(id=int(ingredient_id)).name
@register.assignment_tag
def ingredient_id(ingredien... | {
"repo_name": "oliverdrake/ucbc",
"path": "orders/templatetags/orders.py",
"copies": "2",
"size": "1158",
"license": "mit",
"hash": -2408241834111458000,
"line_mean": 28.6923076923,
"line_max": 89,
"alpha_frac": 0.7461139896,
"autogenerated": false,
"ratio": 3.190082644628099,
"config_test": fa... |
from django import template
from orders.models import LineFollowerStage, LineFollowerJuniorStage
from results.models import LineFollowerResult, LineFollowerJuniorResult
from simulation.models import SimulationStageMatchResult
register = template.Library()
@register.inclusion_tag("referee/line_follower_actions.html")... | {
"repo_name": "bilbeyt/ituro",
"path": "ituro/referee/templatetags/referee.py",
"copies": "1",
"size": "1528",
"license": "mit",
"hash": -5790015774560530000,
"line_mean": 36.2682926829,
"line_max": 80,
"alpha_frac": 0.7729057592,
"autogenerated": false,
"ratio": 3.44920993227991,
"config_test"... |
from django import template
from oscar.core.loading import feature_hidden
register = template.Library()
def get_parameters(parser, token):
"""
{% get_parameters except_field %}
"""
args = token.split_contents()
if len(args) < 2:
raise template.TemplateSyntaxError(
"get_parame... | {
"repo_name": "elliotthill/django-oscar",
"path": "oscar/templatetags/display_tags.py",
"copies": "38",
"size": "1908",
"license": "bsd-3-clause",
"hash": 7628392238062114000,
"line_mean": 26.652173913,
"line_max": 76,
"alpha_frac": 0.6200209644,
"autogenerated": false,
"ratio": 4.085653104925053... |
from django import template
from oscar.core.loading import get_model
from oscar.core.loading import get_class
AddToBasketForm = get_class('basket.forms', 'AddToBasketForm')
SimpleAddToBasketForm = get_class('basket.forms', 'SimpleAddToBasketForm')
Product = get_model('catalogue', 'product')
register = template.Libra... | {
"repo_name": "MrReN/django-oscar",
"path": "oscar/templatetags/basket_tags.py",
"copies": "3",
"size": "2197",
"license": "bsd-3-clause",
"hash": -3938977519871871000,
"line_mean": 33.873015873,
"line_max": 76,
"alpha_frac": 0.6395084206,
"autogenerated": false,
"ratio": 3.8076256499133447,
"c... |
from django import template
from oscar.core.loading import get_model
register = template.Library()
Category = get_model('catalogue', 'category')
@register.assignment_tag(name="category_tree")
def get_annotated_list(depth=None, parent=None):
"""
Gets an annotated list from a tree branch.
Borrows heavily ... | {
"repo_name": "vovanbo/django-oscar",
"path": "src/oscar/templatetags/category_tags.py",
"copies": "28",
"size": "1642",
"license": "bsd-3-clause",
"hash": 1854547926143393800,
"line_mean": 30.5769230769,
"line_max": 76,
"alpha_frac": 0.6224116931,
"autogenerated": false,
"ratio": 3.8635294117647... |
from django import template
from oscar.core.loading import get_model
register = template.Library()
Category = get_model('catalogue', 'category')
# Since the category_tree template tag can be used multiple times in the same
# set of templates, we use a cache to avoid creating the node multile times.
NODE_CACHE = {}
... | {
"repo_name": "josesanch/django-oscar",
"path": "src/oscar/templatetags/category_tags.py",
"copies": "5",
"size": "4476",
"license": "bsd-3-clause",
"hash": 8753853986996495000,
"line_mean": 33.96875,
"line_max": 78,
"alpha_frac": 0.5692582663,
"autogenerated": false,
"ratio": 3.947089947089947,
... |
from django import template
from os import mkdir, path
from django.conf import settings
from PIL import Image
register = template.Library()
SCALE_WIDTH = 'w'
SCALE_HEIGHT = 'h'
@register.filter(name="thumbnail")
def do_thumbnail(image, arg="100x100"):
original_image_path = image.path
if not original_image_... | {
"repo_name": "eliasfernandez/django-simplecms",
"path": "cms/templatetags/image.py",
"copies": "1",
"size": "2023",
"license": "bsd-2-clause",
"hash": -187728671980328130,
"line_mean": 29.2089552239,
"line_max": 137,
"alpha_frac": 0.6015818092,
"autogenerated": false,
"ratio": 3.542907180385289,... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.