text
stringlengths
0
1.05M
meta
dict
from django import template from ..models import Competition, Invitation, Team register = template.Library() @register.inclusion_tag('competition/_competitions_registered.html', takes_context=True) def competitions_registered(context): user = context['user'] competitions = Competitio...
{ "repo_name": "michaelwisely/django-competition", "path": "src/competition/templatetags/competition_tags.py", "copies": "1", "size": "2059", "license": "bsd-3-clause", "hash": 1480197856099727400, "line_mean": 25.7402597403, "line_max": 78, "alpha_frac": 0.7017969888, "autogenerated": false, "rat...
from django import template from ..models import Membership register = template.Library() @register.filter(name='user_location') def parse_location(user): """ Returns a formatted string of user location data. Adds a comma if the city is present, adds a space is the region is present Returns empty i...
{ "repo_name": "lsk112233/Clone-test-repo", "path": "users/templatetags/users_tags.py", "copies": "1", "size": "1066", "license": "apache-2.0", "hash": -5416404436096982000, "line_mean": 23.2272727273, "line_max": 78, "alpha_frac": 0.5966228893, "autogenerated": false, "ratio": 4.404958677685951, ...
from django import template from ..models import Post from ..conf import settings register = template.Library() class LatestBlogPostsNode(template.Node): def __init__(self, context_var): self.context_var = context_var def render(self, context): latest_posts = Post.objects.current()[:5] ...
{ "repo_name": "cdvv7788/pinax-blog", "path": "pinax/blog/templatetags/pinax_blog_tags.py", "copies": "2", "size": "2206", "license": "mit", "hash": 3295916318030949000, "line_mean": 23.2417582418, "line_max": 77, "alpha_frac": 0.6355394379, "autogenerated": false, "ratio": 3.8100172711571676, "...
from django import template from ..models import Team register = template.Library() class AvailableTeamsNode(template.Node): @classmethod def handle_token(cls, parser, token): bits = token.split_contents() if len(bits) == 3 and bits[1] == "as": return cls(bits[2]) else: ...
{ "repo_name": "pinax/pinax-teams", "path": "pinax/teams/templatetags/pinax_teams_tags.py", "copies": "1", "size": "1091", "license": "mit", "hash": -8974675221838052000, "line_mean": 26.9743589744, "line_max": 79, "alpha_frac": 0.6012832264, "autogenerated": false, "ratio": 4.025830258302583, "...
from django import template from moocng.enrollment import enrollment_methods register = template.Library() class BaseButtonNode(template.Node): def __init__(self, course): self.course = template.Variable(course) def render(self, context): course = self.course.resolve(context) enrol...
{ "repo_name": "OpenMOOC/moocng", "path": "moocng/enrollment/templatetags/enrollment_tags.py", "copies": "1", "size": "1713", "license": "apache-2.0", "hash": 3061137490697643500, "line_mean": 30.1454545455, "line_max": 108, "alpha_frac": 0.7162872154, "autogenerated": false, "ratio": 4.2400990099...
from django import template from mooshell.models import JSLibraryGroup, JSLibrary, JSDependency register = template.Library() @register.inclusion_tag('_js_library_groups.html') def get_js_library_groups(shell=None, current_group=None, current_lib=None, preset_dependencies=None): "return a list of possib...
{ "repo_name": "nyov/mooshell", "path": "templatetags/mooshell_extras.py", "copies": "1", "size": "3134", "license": "mit", "hash": -7740868484271078000, "line_mean": 32.3404255319, "line_max": 87, "alpha_frac": 0.603063178, "autogenerated": false, "ratio": 4.1128608923884515, "config_test": fal...
from django import template from mybitbank.libs.entities.coinaccount import CoinAccount from mybitbank.libs.entities.coinaddress import CoinAddress def keyvalue(value, arg): ''' Template tag to fetch value from key ''' try: return value[arg] except: return False def getalerticon(...
{ "repo_name": "sgoudelis/mybitbank", "path": "mybitbank/apps/dashboard/templatetags/dashboard_extras.py", "copies": "2", "size": "2089", "license": "mit", "hash": 7632239078195834000, "line_mean": 25.7948717949, "line_max": 71, "alpha_frac": 0.6218286261, "autogenerated": false, "ratio": 4.112204...
from django import template from navtree.navigation import PageProxy register = template.Library() @register.tag def get_navigation_pages(parser, token): """ {% get_navigation_pages navigation current_page as pages %} """ try: tag_name, navigation, current_page, _as_, target = token.split_co...
{ "repo_name": "sema/navtree", "path": "navtree/templatetags/navtreehelpers.py", "copies": "1", "size": "1829", "license": "bsd-3-clause", "hash": -2923986589357919700, "line_mean": 26.7121212121, "line_max": 107, "alpha_frac": 0.6566429743, "autogenerated": false, "ratio": 4.037527593818985, "c...
from django import template from oppgavegen.models import User, ExtendedUser, Set, Chapter, Level, Template register = template.Library() @register.filter def is_teacher(user): """Returns True/False depending on if the user is a teacher""" if user.is_superuser: return True return user.groups.fil...
{ "repo_name": "w0pke/oppgavegenerator", "path": "oppgavegen/templatetags/app_filters.py", "copies": "1", "size": "2853", "license": "bsd-3-clause", "hash": 2080436230549610500, "line_mean": 26.4423076923, "line_max": 106, "alpha_frac": 0.6680686996, "autogenerated": false, "ratio": 3.753947368421...
from django import template from options_product.models import Product register = template.Library() @register.simple_tag def featured_products_for_categories(category_list, variable_name='featured_product'): """ {% featured_products_for_categories category_list "variable_name" %} """ product_qset...
{ "repo_name": "matthiask/plata-options-product", "path": "options_product/templatetags/plata_product_tags.py", "copies": "1", "size": "1281", "license": "bsd-3-clause", "hash": 4166788677776464000, "line_mean": 22.2909090909, "line_max": 86, "alpha_frac": 0.6401249024, "autogenerated": false, "ra...
from django import template from oscar.core.compat import assignment_tag from oscar.core.loading import get_model register = template.Library() Category = get_model('catalogue', 'category') assignment_tag = assignment_tag(register) @assignment_tag(name="category_tree") def get_annotated_list(depth=None, parent=Non...
{ "repo_name": "vicky2135/lucious", "path": "src/oscar/templatetags/category_tags.py", "copies": "5", "size": "1722", "license": "bsd-3-clause", "hash": -1823571868325755000, "line_mean": 29.75, "line_max": 76, "alpha_frac": 0.6306620209, "autogenerated": false, "ratio": 3.84375, "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_param...
{ "repo_name": "taedori81/django-oscar", "path": "src/oscar/templatetags/display_tags.py", "copies": "28", "size": "1909", "license": "bsd-3-clause", "hash": 5953455152049956000, "line_mean": 26.2714285714, "line_max": 76, "alpha_frac": 0.619696176, "autogenerated": false, "ratio": 4.0790598290598...
from django import template from oscar.core.loading import get_class Order = get_class('order.models', 'Order') get_nodes = get_class('dashboard.menu', 'get_nodes') register = template.Library() def get_num_user_orders(parser, token): try: tag_name, user = token.split_contents() return NumUserOr...
{ "repo_name": "DrOctogon/unwash_ecom", "path": "oscar/templatetags/dashboard_tags.py", "copies": "3", "size": "1046", "license": "bsd-3-clause", "hash": -3952178862696355000, "line_mean": 24.512195122, "line_max": 76, "alpha_frac": 0.6931166348, "autogenerated": false, "ratio": 3.7224199288256226...
from django import template from oscar.core.loading import get_class Order = get_class('order.models', 'Order') get_nodes = get_class('dashboard.nav', 'get_nodes') register = template.Library() def get_num_user_orders(parser, token): try: tag_name, user = token.split_contents() return NumUserOrd...
{ "repo_name": "saadbinakhlaq/django-oscar", "path": "oscar/templatetags/dashboard_tags.py", "copies": "9", "size": "1045", "license": "bsd-3-clause", "hash": 3638084465608067000, "line_mean": 24.487804878, "line_max": 76, "alpha_frac": 0.6928229665, "autogenerated": false, "ratio": 3.718861209964...
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": "john-parton/django-oscar", "path": "src/oscar/templatetags/category_tags.py", "copies": "19", "size": "1643", "license": "bsd-3-clause", "hash": 7840979303151133000, "line_mean": 30, "line_max": 76, "alpha_frac": 0.6220328667, "autogenerated": false, "ratio": 3.856807511737089, "...
from django import template from osgeo import ogr register = template.Library() @register.filter(name='kml_geom') def kml_geom(place): geojson_geom = place.get('location').get('geometry') json_geom = ogr.CreateGeometryFromJson(str(geojson_geom)) kml_geom = json_geom.ExportToKML() return kml_geom @...
{ "repo_name": "nagyistoce/geokey", "path": "geokey/contributions/templatetags/kml_tags.py", "copies": "1", "size": "1344", "license": "apache-2.0", "hash": -8987162292365606000, "line_mean": 25.88, "line_max": 86, "alpha_frac": 0.609375, "autogenerated": false, "ratio": 3.5091383812010446, "con...
from django import template from pagesext.models import PageImageContent, PageVideoContent, PageFileContent from pages.templatetags.pages_tags import get_page_object_by_id register = template.Library() @register.simple_tag(takes_context=True) def page_tags_by_id(context, oid): obj = get_page_object_by_id(contex...
{ "repo_name": "dlancer/django-pages-cms-extensions", "path": "pagesext/templatetags/pagesext_tags.py", "copies": "1", "size": "3489", "license": "bsd-3-clause", "hash": 7304323558034117000, "line_mean": 29.8761061947, "line_max": 79, "alpha_frac": 0.7136715391, "autogenerated": false, "ratio": 3....
from django import template from partitions.utils import chop register = template.Library() class PartitionNode(template.Node): @classmethod def handle_token(cls, parser, token): bits = token.split_contents() if len(bits) != 4: raise template.TemplateSyntaxError("Invalid number...
{ "repo_name": "eldarion/django-partitions", "path": "partitions/templatetags/partitions_tags.py", "copies": "1", "size": "1172", "license": "bsd-3-clause", "hash": -2925974996026215400, "line_mean": 25.6363636364, "line_max": 78, "alpha_frac": 0.6322525597, "autogenerated": false, "ratio": 4.3568...
from django import template from pirate_core import namespace_get from oa_cache.views import render_hashed from settings import DOMAIN from customtags.decorators import block_decorator register = template.Library() block = block_decorator(register) get_namespace = namespace_get('pp_cache') @block def pp_get_cache...
{ "repo_name": "fragro/Open-Assembly", "path": "ver1_0/openassembly/oa_cache/templatetags/cachetags.py", "copies": "1", "size": "2339", "license": "bsd-3-clause", "hash": -4408909638169144300, "line_mean": 30.1866666667, "line_max": 87, "alpha_frac": 0.6353142369, "autogenerated": false, "ratio": ...
from django import template from posts.categoryModels import Category from posts.models import Post register = template.Library() @register.simple_tag def total_posts(): return Post.objects.published().count() @register.simple_tag def url_replace(request, field, value): dict_ = request.GET.copy() d...
{ "repo_name": "alien3211/lom-web", "path": "posts/templatetags/post_tags.py", "copies": "1", "size": "1683", "license": "mit", "hash": -3053790273604177400, "line_mean": 23.3913043478, "line_max": 72, "alpha_frac": 0.7106357695, "autogenerated": false, "ratio": 3.6907894736842106, "config_test"...
from django import template from privileges.registration import registry register = template.Library() class CheckPrivilegeNode(template.Node): @classmethod def handle_token(cls, parser, token): bits = token.split_contents() if len(bits) != 6: raise template.TemplateSyntaxError...
{ "repo_name": "jacobwegner/privileges", "path": "privileges/templatetags/privileges_tags.py", "copies": "2", "size": "1119", "license": "bsd-3-clause", "hash": 6669008373547815000, "line_mean": 25.6428571429, "line_max": 71, "alpha_frac": 0.6210902592, "autogenerated": false, "ratio": 4.113970588...
from django import template from projects.constants import HEADING_MARKUP register = template.Library() @register.filter def top_level_files(project): """ Given a project, return only the top-level files - useful for generating table-of-contents, etc """ return project.files.filter(parent__isnull...
{ "repo_name": "chrisdickinson/tweezers", "path": "projects/templatetags/projects_tags.py", "copies": "1", "size": "1430", "license": "mit", "hash": 5783116417996003000, "line_mean": 27.0392156863, "line_max": 71, "alpha_frac": 0.6524475524, "autogenerated": false, "ratio": 4.028169014084507, "c...
from django import template from publications.models import BibliographicRecord from publications.lister import ( PublicationsLister, PublicationsListForPerson, PublicationsArchiveListForPerson ) register = template.Library() @register.inclusion_tag( 'arkestra/generic_lister.html', takes_context...
{ "repo_name": "evildmp/arkestra-publications", "path": "publications/templatetags/publications_tags.py", "copies": "1", "size": "1564", "license": "bsd-2-clause", "hash": 5865747362783668000, "line_mean": 29.0769230769, "line_max": 65, "alpha_frac": 0.6457800512, "autogenerated": false, "ratio": ...
from django import template from pyconde.conference.models import current_conference from pyconde.sponsorship.models import Sponsor, SponsorLevel register = template.Library() class SponsorsNode(template.Node): @classmethod def handle_token(cls, parser, token): bits = token.split_contents() ...
{ "repo_name": "zerok/pyconde-website-mirror", "path": "pyconde/sponsorship/templatetags/sponsorship_tags.py", "copies": "3", "size": "2235", "license": "bsd-3-clause", "hash": 5623125337676835000, "line_mean": 28.8133333333, "line_max": 139, "alpha_frac": 0.6098434004, "autogenerated": false, "ra...
from django import template from rando.flatpages.models import FlatPage register = template.Library() class FlatpageNode(template.Node): def __init__(self, context_name): self.context_name = context_name def render(self, context): lang = context['request'].LANGUAGE_CODE flatpages =...
{ "repo_name": "camillemonchicourt/Geotrek-rando", "path": "rando/flatpages/templatetags/flatpages_tags.py", "copies": "1", "size": "1200", "license": "bsd-2-clause", "hash": 2823950910219497000, "line_mean": 29, "line_max": 77, "alpha_frac": 0.6133333333, "autogenerated": false, "ratio": 3.934426...
from django import template from rbac.models import RBACPermission, RBACGenericPermission register = template.Library() class RBACPermissionNode(template.Node): def __init__(self, params, nodelist_true, nodelist_false): self.nodelist_true, self.nodelist_false = nodelist_true, nodelist_false self...
{ "repo_name": "somcomltd/django-rbac", "path": "rbac/templatetags/rbac_tags.py", "copies": "1", "size": "3032", "license": "mit", "hash": -4748970204961464000, "line_mean": 35.5301204819, "line_max": 81, "alpha_frac": 0.6494063325, "autogenerated": false, "ratio": 3.79, "config_test": false, ...
from django import template from registry.constants import filter_field_maps register = template.Library() @register.inclusion_tag('templatetags/facet_tag.html') def facet_tag(facet_category, facet_form): """ Renders a catergory of facets use with FacetForm """ context = { 'display': face...
{ "repo_name": "ctsit/qipr", "path": "qipr/registry/templatetags/facet_tag.py", "copies": "1", "size": "1052", "license": "apache-2.0", "hash": 1077892164214910600, "line_mean": 25.3, "line_max": 98, "alpha_frac": 0.6216730038, "autogenerated": false, "ratio": 3.530201342281879, "config_test": f...
from django import template from ..registry import granules_registry """ Granules allow child templates and (static) python code to inject granules into (base) templates. This allows you to define generic granules sections which can later be filled by either pythoncode (globally) or child templates (...
{ "repo_name": "iivvoo/django_granules", "path": "granules/templatetags/granules.py", "copies": "1", "size": "2178", "license": "bsd-2-clause", "hash": 6801446483980079000, "line_mean": 29.25, "line_max": 107, "alpha_frac": 0.6565656566, "autogenerated": false, "ratio": 4.040816326530612, "confi...
from django import template from require_media.conf import settings from require_media.renderers import get_renderer from require_media.utils import determine_requirement_group register = template.Library() def get_manager(context): return context.get(settings.CONTEXT_VAR_NAME, None) # # require_inline # class...
{ "repo_name": "jeffkistler/django-require-media", "path": "src/require_media/templatetags/require_media_tags.py", "copies": "1", "size": "6448", "license": "bsd-3-clause", "hash": 617413400390660600, "line_mean": 30.763546798, "line_max": 106, "alpha_frac": 0.6736972705, "autogenerated": false, "...
from django import template from reversion.helpers import generate_patch_html import reversion register = template.Library() @register.simple_tag(name="vdiff") def version_diff(v1, v2, field): """Return HTML showing the differences between two fields.""" return generate_patch_html(v2, v1, field, cleanup="s...
{ "repo_name": "mikesname/ehri-collections", "path": "ehriportal/portal/templatetags/reversion_tags.py", "copies": "1", "size": "2586", "license": "mit", "hash": 8434806887087856000, "line_mean": 32.1538461538, "line_max": 80, "alpha_frac": 0.6593194122, "autogenerated": false, "ratio": 3.45721925...
from django import template from riskgame.models import TeamJoinRequest, Events import hashlib import colorsys import math register = template.Library() @register.filter def requested_join(player, team): try: TeamJoinRequest.objects.get(player=player, team=team) return True except TeamJoinR...
{ "repo_name": "whatsthehubbub/rippleeffect", "path": "riskgame/templatetags/riskgame_extras.py", "copies": "1", "size": "1675", "license": "mit", "hash": 2781320768885089000, "line_mean": 25.171875, "line_max": 106, "alpha_frac": 0.6794029851, "autogenerated": false, "ratio": 3.439425051334702, ...
from django import template from rulez.templatetags.rulez_perms import rulez_perms register = template.Library() class RottweilerPermsNode(template.Node): def __init__(self, codename, varname): self.codename = codename self.varname = varname def render(self, context): user_obj = tem...
{ "repo_name": "TwigWorld/django-rottweiler", "path": "rottweiler/templatetags/rottweiler_tags.py", "copies": "1", "size": "1531", "license": "mit", "hash": 2089649541928820200, "line_mean": 28.4423076923, "line_max": 70, "alpha_frac": 0.6218158067, "autogenerated": false, "ratio": 4.1830601092896...
from django import template from scaffold import app_settings Section = app_settings.get_extending_model() register = template.Library() class SectionNode(template.Node): def __init__(self, section=None, as_varname=None): self.as_varname = as_varname self.current_section = section def _reso...
{ "repo_name": "mazelife/django-scaffold", "path": "scaffold/templatetags/sections.py", "copies": "1", "size": "5375", "license": "bsd-3-clause", "hash": 544353041858996540, "line_mean": 34.3684210526, "line_max": 79, "alpha_frac": 0.599627907, "autogenerated": false, "ratio": 4.147376543209877, ...
from django import template from ..settings import ( highlightjs_url, highlightjs_jquery_url, css_url, get_highlightjs_setting, ) from ..renderer import render_highlightjs register = template.Library() @register.simple_tag def highlightjs_css_url(): """ Return the full url to the highlightj...
{ "repo_name": "MounirMesselmeni/django-highlightjs", "path": "highlightjs/templatetags/highlightjs.py", "copies": "1", "size": "2175", "license": "mit", "hash": -798621044494713200, "line_mean": 20.75, "line_max": 73, "alpha_frac": 0.6101149425, "autogenerated": false, "ratio": 4.027777777777778,...
from django import template from shoppy import settings from django.contrib.sites.models import Site register = template.Library() @register.simple_tag def shoppy_name(): return settings.SHOPPY_SHOP_NAME @register.simple_tag def shoppy_type(): return settings.SHOPPY_SHOP_TYPE @register.simple_tag def shopp...
{ "repo_name": "pocketone/django-shoppy", "path": "shoppy/shop/templatetags/shoppy_tags.py", "copies": "1", "size": "2810", "license": "bsd-3-clause", "hash": -4943985822829219000, "line_mean": 25.2710280374, "line_max": 113, "alpha_frac": 0.6701067616, "autogenerated": false, "ratio": 3.321513002...
from django import template from simple_comments import comments register = template.Library() # Filters @register.filter def has_permission_to_delete(user, comment, configuration): return configuration.has_permission_to_delete(comment, user) @register.filter def allow_post_for_user(config, user): return n...
{ "repo_name": "strange/django-simple-comments", "path": "simple_comments/templatetags/simple_comment_tags.py", "copies": "1", "size": "3855", "license": "bsd-3-clause", "hash": -5764478367586114000, "line_mean": 30.8595041322, "line_max": 96, "alpha_frac": 0.6897535668, "autogenerated": false, "r...
from django import template from simpleoncall.models import NotificationType from simpleoncall.templatetags.icons import EvilIconNode register = template.Library() def pop_default(l, d): if len(l): return l.pop(0) return d class NotificationSettingRowNode(template.Node): TYPE_OPTIONS = { ...
{ "repo_name": "simpleoncall/simpleoncall", "path": "simpleoncall/templatetags/form.py", "copies": "1", "size": "2106", "license": "mit", "hash": 6347889593953753000, "line_mean": 29.9705882353, "line_max": 84, "alpha_frac": 0.6120607787, "autogenerated": false, "ratio": 3.8221415607985483, "con...
from django import template from sorl.thumbnail.conf import settings from sorl.thumbnail import default from sorl.thumbnail.images import ImageFile from sorl.thumbnail.parsers import parse_geometry register = template.Library() @register.tag def sorl_thumbnail(*args, **kwargs): from sorl.thumbnail.templatetags....
{ "repo_name": "j00bar/django-widgy", "path": "widgy/templatetags/thumbnail_libs.py", "copies": "2", "size": "1334", "license": "apache-2.0", "hash": -3493096345418319400, "line_mean": 27.3829787234, "line_max": 75, "alpha_frac": 0.676161919, "autogenerated": false, "ratio": 3.4559585492227978, ...
from django import template from ..steps import ( get_current_step, get_current_steps, get_current_url, get_next_step, get_next_url, get_previous_step, get_previous_url, get_url, ) register = template.Library() @register.assignment_tag(takes_context=True) def get_all_steps(context): return get_current_s...
{ "repo_name": "MarkusH/django-steps", "path": "steps/templatetags/django_steps.py", "copies": "1", "size": "1628", "license": "bsd-3-clause", "hash": -5695301296833629000, "line_mean": 27.0689655172, "line_max": 72, "alpha_frac": 0.7156019656, "autogenerated": false, "ratio": 3.2888888888888888, ...
from django import template from symposion.conference.models import current_conference from pycon.sponsorship.models import Sponsor, SponsorLevel register = template.Library() class SponsorsNode(template.Node): @classmethod def handle_token(cls, parser, token): bits = token.split_contents() ...
{ "repo_name": "eldarion/pycon", "path": "pycon/sponsorship/templatetags/sponsorship_tags.py", "copies": "2", "size": "2231", "license": "bsd-3-clause", "hash": -5958592730002023000, "line_mean": 29.1486486486, "line_max": 139, "alpha_frac": 0.6109367996, "autogenerated": false, "ratio": 3.7942176...
from django import template from symposion.conference.models import current_conference from symposion.sponsorship.models import Sponsor, SponsorLevel register = template.Library() class SponsorsNode(template.Node): @classmethod def handle_token(cls, parser, token): bits = token.split_contents(...
{ "repo_name": "pyconca/2013-web", "path": "symposion/sponsorship/templatetags/sponsorship_tags.py", "copies": "7", "size": "2239", "license": "bsd-3-clause", "hash": -1157040162414830800, "line_mean": 28.8666666667, "line_max": 139, "alpha_frac": 0.6105404198, "autogenerated": false, "ratio": 3.8...
from django import template from symposion.proposals.models import AdditionalSpeaker register = template.Library() class AssociatedProposalsNode(template.Node): @classmethod def handle_token(cls, parser, token): bits = token.split_contents() if len(bits) == 3 and bits[1] == "as": ...
{ "repo_name": "njl/pycon", "path": "symposion/proposals/templatetags/proposal_tags.py", "copies": "13", "size": "2245", "license": "bsd-3-clause", "hash": -5359623666459966000, "line_mean": 29.7534246575, "line_max": 88, "alpha_frac": 0.6316258352, "autogenerated": false, "ratio": 4.0377697841726...
from django import template from symposion.proposals.models import AdditionalSpeaker register = template.Library() class AssociatedProposalsNode(template.Node): @classmethod def handle_token(cls, parser, token): bits = token.split_contents() if len(bits) == 3 and bits[1] == "as": ...
{ "repo_name": "pyconau2017/symposion", "path": "symposion/proposals/templatetags/proposal_tags.py", "copies": "8", "size": "2220", "license": "bsd-3-clause", "hash": -7021176226636613000, "line_mean": 29.8333333333, "line_max": 88, "alpha_frac": 0.6387387387, "autogenerated": false, "ratio": 3.99...
from django import template from symposion.sponsors.models import Sponsor register = template.Library() class SponsorsNode(template.Node): @classmethod def handle_token(cls, parser, token): bits = token.split_contents() if len(bits) != 4: raise template.TemplateSyntaxError(...
{ "repo_name": "inoshiro/symposion-demo", "path": "symposion_project/apps/symposion/sponsors/templatetags/sponsors_tags.py", "copies": "5", "size": "1196", "license": "mit", "hash": -2255886723981670000, "line_mean": 26.8139534884, "line_max": 82, "alpha_frac": 0.5785953177, "autogenerated": false, ...
from django import template from symposion.sponsors_pro.models import Sponsor register = template.Library() class SponsorsNode(template.Node): @classmethod def handle_token(cls, parser, token): bits = token.split_contents() section = "all" if len(bits) != 3 and len(bits) != 4: ...
{ "repo_name": "mzdaniel/pycon", "path": "pycon_project/apps/symposion/sponsors_pro/templatetags/sponsors_pro_tags.py", "copies": "2", "size": "1503", "license": "bsd-3-clause", "hash": -5122175304518572000, "line_mean": 30.9787234043, "line_max": 87, "alpha_frac": 0.5868263473, "autogenerated": fal...
from django import template from symposion.teams.models import Team register = template.Library() class AvailableTeamsNode(template.Node): @classmethod def handle_token(cls, parser, token): bits = token.split_contents() if len(bits) == 3 and bits[1] == "as": return cls(bits[2]) ...
{ "repo_name": "pydata/symposion", "path": "symposion/teams/templatetags/teams_tags.py", "copies": "1", "size": "1097", "license": "bsd-3-clause", "hash": -7145127007748240000, "line_mean": 27.1282051282, "line_max": 77, "alpha_frac": 0.6034639927, "autogenerated": false, "ratio": 3.97463768115942...
from django import template from taxonomy.models import * register = template.Library() def get_taxonomy_members(parser, token): try: bits = tuple(token.split_contents()) except ValueError: raise template.TemplateSyntaxError( "%r tag requires arguments" % token.contents.split()[0]...
{ "repo_name": "jmichalicek/django-taxonomies", "path": "taxonomy/templatetags/taxonomy_tags.py", "copies": "1", "size": "1926", "license": "bsd-2-clause", "hash": -237671433268236930, "line_mean": 34.6666666667, "line_max": 85, "alpha_frac": 0.6505711319, "autogenerated": false, "ratio": 4.150862...
from django import template from teams.models import Member, Team register = template.Library() @register.filter def iscoordinatorofteam(user, team): """Filter to determine if user is a coordinator of a team. Example usage:: {% if user|iscoordinatorofteam:team %} You are a coordinator...
{ "repo_name": "snswa/swsites", "path": "teams/templatetags/team_tags.py", "copies": "1", "size": "1279", "license": "apache-2.0", "hash": -9050016532985783000, "line_mean": 24.0784313725, "line_max": 84, "alpha_frac": 0.598123534, "autogenerated": false, "ratio": 4.291946308724833, "config_test...
from django import template from teams.models import Team from wakawaka.models import WikiPage from wakacmsplugin.api import latest_rev_id, snippet_content from wakacmsplugin.models import WikiPageSnippet from wakacmsplugin.settings import TEAM_SLUG register = template.Library() @register.inclusion_tag('wakacmsp...
{ "repo_name": "snswa/swsites", "path": "wakacmsplugin/templatetags/wakacms_tags.py", "copies": "1", "size": "2258", "license": "apache-2.0", "hash": 6952514696479745000, "line_mean": 29.5135135135, "line_max": 78, "alpha_frac": 0.6226749336, "autogenerated": false, "ratio": 3.641935483870968, "...
from django import template from techblog_site.apps.content.models import Post from techblog_site.apps.content.models import Post_Topic from techblog_site.apps.content.models import Topic register = template.Library() class DefaultOpenLinks(): """Return links that go in the first part (open as default) of the ...
{ "repo_name": "hwins/techblog_site", "path": "techblog_site/apps/content/templatetags/topics_accordion.py", "copies": "1", "size": "5629", "license": "bsd-3-clause", "hash": -5634721194573869000, "line_mean": 37.5547945205, "line_max": 79, "alpha_frac": 0.5414816131, "autogenerated": false, "rati...
from django import template from timetable.models import RoomLink register = template.Library() @register.filter def for_event(weeks, event): result = [] oldBookingTxt = True bookingTxt = None run = 1 for week in weeks: try: bookingTxt = week.booking_set.filter(event=event)[0...
{ "repo_name": "ashbc/tgrsite", "path": "timetable/templatetags/timetable_tags.py", "copies": "1", "size": "1170", "license": "isc", "hash": 8928341353047091000, "line_mean": 23.8936170213, "line_max": 72, "alpha_frac": 0.6179487179, "autogenerated": false, "ratio": 3.5779816513761467, "config_t...
from django import template from ttag import core, args class AsTagOptions(core.Options): def __init__(self, meta, *args, **kwargs): super(AsTagOptions, self).__init__(meta=meta, *args, **kwargs) self.as_default = getattr(meta, 'as_default', None) if self.as_default: self.as_...
{ "repo_name": "matuu/django-ttag", "path": "ttag/helpers/as_tag.py", "copies": "2", "size": "1678", "license": "bsd-3-clause", "hash": -1296695879355396900, "line_mean": 31.9019607843, "line_max": 76, "alpha_frac": 0.6019070322, "autogenerated": false, "ratio": 3.704194260485651, "config_test":...
from django import template from ttag import utils, args class Options(object): def __init__(self, meta, *args, **kwargs): super(Options, self).__init__(*args, **kwargs) self.positional_args = [] self.named_args = {} # A list of argument names that are inherited from bases ...
{ "repo_name": "caktus/django-ttag", "path": "ttag/core.py", "copies": "2", "size": "10385", "license": "bsd-3-clause", "hash": -3520478231923659000, "line_mean": 36.0892857143, "line_max": 79, "alpha_frac": 0.5203659124, "autogenerated": false, "ratio": 4.617607825700311, "config_test": false, ...
from django import template from unusualbusiness.pages.models import Quote, StaticContent register = template.Library() @register.inclusion_tag('pages/blocks/quote.html', takes_context=True) def latest_quote(context): return { 'quote': Quote.objects.first(), 'request': context['request'], } ...
{ "repo_name": "jeremy-c/unusualbusiness", "path": "unusualbusiness/pages/templatetags/article_tags.py", "copies": "1", "size": "1042", "license": "bsd-3-clause", "hash": 511302892810179300, "line_mean": 24.4146341463, "line_max": 79, "alpha_frac": 0.6573896353, "autogenerated": false, "ratio": 3....
from django import template from urllib import urlencode register = template.Library() @register.simple_tag def remove_facet(request, facet_value): """"Returns a string that extracts the supplied facet_value's facet from the current querystring Example: {% load facet_tags %} ...
{ "repo_name": "openrural/open-data-nc", "path": "opendata/search/templatetags/facet_tags.py", "copies": "2", "size": "1643", "license": "mit", "hash": 5266113633129355000, "line_mean": 28.8909090909, "line_max": 78, "alpha_frac": 0.5855143031, "autogenerated": false, "ratio": 4.017114914425428, ...
from django import template from urllib.parse import urlencode, urlparse, urlunparse, parse_qs from blockcypher.utils import format_crypto_units, estimate_satoshis_transacted from blockcypher.api import _get_websocket_url from blockcypher.constants import COIN_SYMBOL_MAPPINGS register = template.Library() @regist...
{ "repo_name": "blockcypher/explorer", "path": "addresses/templatetags/btc_formats.py", "copies": "1", "size": "3966", "license": "apache-2.0", "hash": 3411566571287957500, "line_mean": 32.05, "line_max": 118, "alpha_frac": 0.6270801815, "autogenerated": false, "ratio": 3.566546762589928, "confi...
from django import template from userena.contrib.umessages.models import MessageRecipient import re register = template.Library() class MessageCount(template.Node): def __init__(self, um_from_user, var_name, um_to_user=None): self.user = template.Variable(um_from_user) self.var_name = var_name ...
{ "repo_name": "matachi/django-userena", "path": "userena/contrib/umessages/templatetags/umessages_tags.py", "copies": "3", "size": "2627", "license": "bsd-3-clause", "hash": 7641858761743445000, "line_mean": 29.9058823529, "line_max": 99, "alpha_frac": 0.6082984393, "autogenerated": false, "ratio...
from django import template from ..utils import get_sized_image, get_sized_images register = template.Library() class SrcSetNode(template.Node): @classmethod def handle_token(cls, parser, token): bits = token.split_contents() tag = bits[0] image = bits[1] sizes = [] ...
{ "repo_name": "ConvectiveSoftware/django-responsive-images", "path": "responsive_images/templatetags/responsive_images.py", "copies": "1", "size": "2334", "license": "mit", "hash": -3111641347324929000, "line_mean": 31.4166666667, "line_max": 73, "alpha_frac": 0.4845758355, "autogenerated": false, ...
from django import template from ..utils import PaginationDisplay register = template.Library() @register.inclusion_tag('includes/pagination.html') def display_pagination(qd, page): """Includes a template displaying a full pagination listing in the context of `page`. :param qd: query paramters to base...
{ "repo_name": "kcl-ddh/ddh_django_utils", "path": "ddh_utils/templatetags/ddh_utils_tags.py", "copies": "1", "size": "1821", "license": "apache-2.0", "hash": -1464760384311568600, "line_mean": 25.7794117647, "line_max": 70, "alpha_frac": 0.6419549698, "autogenerated": false, "ratio": 3.3535911602...
from django import template from ..utils import user_display register = template.Library() class UserDisplayNode(template.Node): def __init__(self, user, as_var=None): self.user_var = template.Variable(user) self.as_var = as_var def render(self, context): user = self.user_var.resolv...
{ "repo_name": "houssemFat/MeeM-Dev", "path": "teacher/apps/accounts/templatetags/accounts.py", "copies": "1", "size": "1147", "license": "mit", "hash": -3164117409425315300, "line_mean": 23.4042553191, "line_max": 95, "alpha_frac": 0.5806451613, "autogenerated": false, "ratio": 3.7980132450331126...
from django import template from wafer.sponsors.models import Sponsor, SponsorshipPackage register = template.Library() @register.inclusion_tag('wafer.sponsors/sponsors_block.html') def sponsors(): return { 'sponsors': Sponsor.objects.all().order_by('packages', 'order', 'id'), 'packages': Sponso...
{ "repo_name": "CTPUG/wafer", "path": "wafer/sponsors/templatetags/sponsors.py", "copies": "1", "size": "1275", "license": "isc", "hash": 3400715869034579500, "line_mean": 31.6923076923, "line_max": 79, "alpha_frac": 0.6917647059, "autogenerated": false, "ratio": 3.4366576819407006, "config_test...
from django import template from waffle import flag_is_active, sample_is_active, switch_is_active register = template.Library() class WaffleNode(template.Node): def __init__(self, nodelist_true, nodelist_false, condition, name): self.nodelist_true = nodelist_true self.nodelist_false = nodelist_...
{ "repo_name": "willkg/django-waffle", "path": "waffle/templatetags/waffle_tags.py", "copies": "1", "size": "2866", "license": "bsd-3-clause", "hash": 1180476622185175300, "line_mean": 29.4893617021, "line_max": 76, "alpha_frac": 0.6364270761, "autogenerated": false, "ratio": 3.8677462887989202, ...
from django import template from wagtail.core.models import Page register = template.Library() # https://docs.djangoproject.com/en/1.9/howto/custom-template-tags/ @register.simple_tag(takes_context=True) def get_site_root(context): # This returns a core.Page. The main menu needs to have the site.root_page #...
{ "repo_name": "nfletton/bvspca", "path": "bvspca/core/templatetags/navigation_tags.py", "copies": "1", "size": "3003", "license": "mit", "hash": -3771117771009512400, "line_mean": 37.0126582278, "line_max": 98, "alpha_frac": 0.67998668, "autogenerated": false, "ratio": 3.758448060075094, "confi...
from django import template from wagtail.wagtailimages.models import Filter register = template.Library() # Local cache of filters, avoid hitting the DB filters = {} @register.tag(name="image") def image(parser, token): bits = token.split_contents()[1:] image_var = bits[0] filter_spec = bits[1] bit...
{ "repo_name": "timheap/wagtail", "path": "wagtail/wagtailimages/templatetags/wagtailimages_tags.py", "copies": "6", "size": "3042", "license": "bsd-3-clause", "hash": -8773468834529943000, "line_mean": 39.0263157895, "line_max": 197, "alpha_frac": 0.6180144642, "autogenerated": false, "ratio": 4....
from django import template from wagtail.wagtailimages.models import Filter register = template.Library() # Local cache of filters, avoid hitting the DB filters = {} @register.tag(name="image") def image(parser, token): args = token.split_contents() if len(args) == 3: # token is of the form {% imag...
{ "repo_name": "helenwarren/pied-wagtail", "path": "wagtail/wagtailimages/templatetags/image_tags.py", "copies": "3", "size": "2721", "license": "bsd-3-clause", "hash": 2243000253383927800, "line_mean": 38.4347826087, "line_max": 167, "alpha_frac": 0.6321205439, "autogenerated": false, "ratio": 3....
from django import template from wagtail.wagtailimages.models import Filter register = template.Library() @register.tag(name="image") def image(parser, token): args = token.split_contents() if len(args) == 3: # token is of the form {% image self.photo max-320x200 %} tag_name, image_var, fil...
{ "repo_name": "h2oloopan/easymerge", "path": "EasyMerge/tests/wagtail/wagtail/wagtailimages/templatetags/image_tags.py", "copies": "3", "size": "2571", "license": "mit", "hash": -8896555339732273000, "line_mean": 39.171875, "line_max": 167, "alpha_frac": 0.6324387398, "autogenerated": false, "rat...
from django import template from wagtail.wagtailimages.models import Filter, SourceImageIOError register = template.Library() # Local cache of filters, avoid hitting the DB filters = {} @register.tag(name="image") def image(parser, token): bits = token.split_contents()[1:] image_var = bits[0] filter_sp...
{ "repo_name": "dresiu/wagtail", "path": "wagtail/wagtailimages/templatetags/wagtailimages_tags.py", "copies": "1", "size": "3287", "license": "bsd-3-clause", "hash": 8485835103751900000, "line_mean": 38.130952381, "line_max": 197, "alpha_frac": 0.6169759659, "autogenerated": false, "ratio": 4.129...
from django import template from wagtail.wagtailimages.templatetags.wagtailimages_tags import ( ImageNode ) register = template.Library() @register.tag(name="image") def image(parser, token): bits = token.split_contents()[1:] image_expr = parser.compile_filter(bits[0]) filter_spec = bits[1] bits...
{ "repo_name": "WGBH/wagtail-streamfieldtools", "path": "streamfield_tools/templatetags/renditionaware_image_tags.py", "copies": "1", "size": "1347", "license": "mit", "hash": 7659203171510353000, "line_mean": 28.2826086957, "line_max": 76, "alpha_frac": 0.6369710468, "autogenerated": false, "rati...
from django import template from wheelcms_axle import queries from wheelcms_axle.utils import get_active_language from wheelcms_axle import auth register = template.Library() def navigation_items(request, node): language = get_active_language() nav = [] ## remove visible_children? Unnecessary with per...
{ "repo_name": "wheelcms/wheelcms_axle", "path": "wheelcms_axle/templatetags/topnav.py", "copies": "1", "size": "1951", "license": "bsd-2-clause", "hash": -2332157933366595000, "line_mean": 32.0677966102, "line_max": 85, "alpha_frac": 0.6371091748, "autogenerated": false, "ratio": 4.09873949579831...
from django import template from wp_frontman.wp_helpers import wp_nav_menu, month_archives, year_archives from wp_frontman.lib.trees import make_tree, prune_tree from wp_frontman.lib.utils import s2i register = template.Library() # TODO: use the cached_inclusion_tag decorator @register.inclusion_tag('wp_frontman/t...
{ "repo_name": "ludoo/wpkit", "path": "attic/ngfrontman/wp_frontman/templatetags/wpf_sidebar_tags.py", "copies": "2", "size": "2341", "license": "bsd-3-clause", "hash": 6590462393618044000, "line_mean": 43.1698113208, "line_max": 114, "alpha_frac": 0.6997009825, "autogenerated": false, "ratio": 3....
from django import template import import_string from is_core.config import settings from is_core.site import get_site_by_name register = template.Library() @register.inclusion_tag('is_core/menu/sub_menu.html', takes_context=True) def submenu(context, menu_items): return {'menu_items': menu_items} @register....
{ "repo_name": "matllubos/django-is-core", "path": "is_core/templatetags/menu.py", "copies": "1", "size": "1291", "license": "bsd-3-clause", "hash": -6852176760903307000, "line_mean": 26.4680851064, "line_max": 94, "alpha_frac": 0.7226955848, "autogenerated": false, "ratio": 3.2766497461928936, ...
from django import template import locale import decimal register = template.Library() #################################################################################################### ############# Formats an international number system into Nepali Numeric System #################### ############################...
{ "repo_name": "cliftonmcintosh/nepalmap_app", "path": "wazimap_np/templatetags/nepal_format.py", "copies": "2", "size": "1053", "license": "mit", "hash": 1789958141684362800, "line_mean": 21.8913043478, "line_max": 100, "alpha_frac": 0.3817663818, "autogenerated": false, "ratio": 3.65625, "conf...
from django import template import logging import re import HTML from dataviewer.models import * from dataviewer.permissions import * register = template.Library() @register.inclusion_tag('blocks/page_tabs.html', takes_context=True) def page_tabs(context): """ List all pages who are associated with the model c...
{ "repo_name": "johnewart/django-dataviewer", "path": "dataviewer/templatetags/dataviewer_tags.py", "copies": "1", "size": "1364", "license": "bsd-3-clause", "hash": 1358851886831744000, "line_mean": 23.375, "line_max": 84, "alpha_frac": 0.7082111437, "autogenerated": false, "ratio": 3.39303482587...
from django import template import mistune from pygments import highlight from pygments.lexers import get_lexer_by_name from pygments.formatters import html register = template.Library() # pygmentize -S default -f html -a .highlight > default.css # pygmentize -S monokai -f html -a .highlight > pygment.css """ /* fi...
{ "repo_name": "andreztz/DjangoBlog", "path": "blog/templatetags/markdownify.py", "copies": "1", "size": "1164", "license": "apache-2.0", "hash": 5943434530196227000, "line_mean": 25.4545454545, "line_max": 74, "alpha_frac": 0.7001718213, "autogenerated": false, "ratio": 3.7070063694267517, "con...
from django import template import random from feedback.models import Feedback, Favorite, Event register = template.Library() @register.filter def rating_average(feedback, num=False): ratings = [f.rating for f in feedback if f.rating] if not ratings: return '' avg = sum(ratings) / float(len(ratings)) if...
{ "repo_name": "mcdermott-scholars/mcdermott", "path": "feedback/templatetags/feedback_tags.py", "copies": "1", "size": "2334", "license": "mit", "hash": -7299189984716293000, "line_mean": 27.1325301205, "line_max": 99, "alpha_frac": 0.7253641817, "autogenerated": false, "ratio": 3.201646090534979...
from django import template import re register = template.Library() @register.filter def join_attr(obj_list, attr_name, sep=', '): return sep.join(getattr(i, attr_name) for i in obj_list) @register.filter def lineformat ( objs ): elements = [obj.name for obj in objs] if len(elements) > 0: return...
{ "repo_name": "protwis/protwis", "path": "structure/templatetags/structure_extras.py", "copies": "1", "size": "5157", "license": "apache-2.0", "hash": -8914059437607731000, "line_mean": 32.4935064935, "line_max": 347, "alpha_frac": 0.5828970332, "autogenerated": false, "ratio": 3.2680608365019013...
from django import template import select2.select2 as sl2 register = template.Library() @register.filter def select2_setting(value): """ A simple way to read select2 settings in a template. Please consider this filter private for now, do not use it in your own templates. """ return sl2.get_...
{ "repo_name": "JP-Ellis/django-select2-forms", "path": "select2/templatetags/select2.py", "copies": "1", "size": "3207", "license": "bsd-2-clause", "hash": -8533575543878203000, "line_mean": 20.238410596, "line_max": 79, "alpha_frac": 0.6111630808, "autogenerated": false, "ratio": 3.7075144508670...
from django import template def parse_ttag(token, required_tags): """ A function to parse a template tag. Pass in the token to parse, and a list of keywords to look for. It sets the name of the tag to 'tag_name' in the hash returned. >>> from test_utils.templatetags.utils import parse_ttag >>...
{ "repo_name": "Harish515/django-basic-apps-master", "path": "basic/tools/templatetags/utils.py", "copies": "13", "size": "1024", "license": "bsd-3-clause", "hash": -1181923412401379800, "line_mean": 33.1666666667, "line_max": 72, "alpha_frac": 0.5927734375, "autogenerated": false, "ratio": 3.3573...
from django import template from package.context_processors import used_packages_list register = template.Library() class ParticipantURLNode(template.Node): def __init__(self, repo, participant): self.repo = template.Variable(repo) self.participant = template.Variable(participant) def ren...
{ "repo_name": "pydanny/djangopackages", "path": "package/templatetags/package_tags.py", "copies": "2", "size": "1551", "license": "mit", "hash": 3802171710386705000, "line_mean": 30.02, "line_max": 111, "alpha_frac": 0.6744036106, "autogenerated": false, "ratio": 3.936548223350254, "config_test...
from django import template register = template.Library() class VarNode(template.Node): def __init__(self, var_name, var_to_resolve): self.var_name = var_name self.var_to_resolve = var_to_resolve def get_context(self, top_context): for context in top_context.dicts: ...
{ "repo_name": "kevinr/750book-web", "path": "750book-web-env/lib/python2.7/site-packages/pinax/templatetags/templatetags/var_tag.py", "copies": "2", "size": "1234", "license": "mit", "hash": 69184850886619120, "line_mean": 26.4222222222, "line_max": 70, "alpha_frac": 0.5559157212, "autogenerated": ...
from django import template register = template.Library() class RecurseNode(template.Node): def __init__(self, var, name, child, nodeList): self.var = var self.name = name self.child = child self.nodeList = nodeList def __repr__(self): return '<RecurseNode>' def...
{ "repo_name": "MicroPyramid/micro-finance", "path": "micro_admin/templatetags/recurse.py", "copies": "2", "size": "2265", "license": "mit", "hash": 5747117751832557000, "line_mean": 31.3571428571, "line_max": 85, "alpha_frac": 0.5483443709, "autogenerated": false, "ratio": 4.103260869565218, "c...
from django import template register = template.Library() class SetVarNode(template.Node): def __init__(self, var_name, var_value): self.var_name = var_name self.var_value = var_value def render(self, context): try: value = template.Variable(self.var_value).resolve(cont...
{ "repo_name": "un33k/django-toolware", "path": "toolware/templatetags/variable.py", "copies": "1", "size": "1048", "license": "mit", "hash": 2823800775854834700, "line_mean": 24.5609756098, "line_max": 98, "alpha_frac": 0.6307251908, "autogenerated": false, "ratio": 3.810909090909091, "config_t...
from django import template register = template.Library() class VarNode(template.Node): def __init__(self, var_name, var_to_resolve): self.var_name = var_name self.var_to_resolve = var_to_resolve def get_context(self, top_context): for context in top_context.dicts: ...
{ "repo_name": "jhaus/pinax", "path": "pinax/templatetags/templatetags/var_tag.py", "copies": "3", "size": "1242", "license": "mit", "hash": 8646766685521665000, "line_mean": 26.6, "line_max": 70, "alpha_frac": 0.5523349436, "autogenerated": false, "ratio": 3.9554140127388533, "config_test": fal...
from django import template register = template.Library() def columnize(parser, token): """ Put stuff into columns. Can also define class tags for rows and cells Usage: {% columnize num_cols [row_class[,row_class2...]|'' [cell_class[,cell_class2]]] %} num_cols: the number of columns ...
{ "repo_name": "fatihzkaratana/intranet", "path": "backend/cmsutils/templatetags/columnize.py", "copies": "3", "size": "3790", "license": "apache-2.0", "hash": -2699591616695551000, "line_mean": 34.1018518519, "line_max": 121, "alpha_frac": 0.5319261214, "autogenerated": false, "ratio": 3.93970893...
from django import template register = template.Library() @register.assignment_tag(takes_context=True) def get_site_root(context): # NB this returns a core.Page, not the implementation-specific model used # so object-comparison to self will return false as objects would differ return context['request']....
{ "repo_name": "registerguard/celebrate", "path": "blog/templatetags/blog_tags.py", "copies": "1", "size": "2381", "license": "mit", "hash": 7566331639106987000, "line_mean": 37.4032258065, "line_max": 79, "alpha_frac": 0.6971860563, "autogenerated": false, "ratio": 4.028764805414552, "config_te...
from django import template register = template.Library() @register.filter(name='opp') def opp(value, arg): if value.home_team == arg: s = 'vs <a href="{link}"> {team}</a>' else: s = 'at <a href="{link}"> {team}</a>' return s.format(link=value.home_team.get_absolute_url(), ...
{ "repo_name": "pawelad/BLM", "path": "Players/templatetags/players_tags.py", "copies": "1", "size": "1172", "license": "mit", "hash": -3324228498397455400, "line_mean": 34.5454545455, "line_max": 89, "alpha_frac": 0.5588737201, "autogenerated": false, "ratio": 3.21978021978022, "config_test": f...
from django import template register = template.Library() @register.filter(name='past_game_name') def past_game_name(value, arg): if value.home_team == arg: # Example: CHI 230 vs NYK 169 return '{home_team} {home_score} vs {away_team} {away_score}'.format(home_team=value.home_team.short_name, ...
{ "repo_name": "pawelad/BLM", "path": "Teams/templatetags/teams_tags.py", "copies": "1", "size": "1849", "license": "mit", "hash": 1627030871632258000, "line_mean": 49, "line_max": 119, "alpha_frac": 0.4775554354, "autogenerated": false, "ratio": 4.2214611872146115, "config_test": false, "has_...
from django import template register = template.Library() @register.filter def partition(thelist, n): """ Break a list into ``n`` pieces. The last list may be larger than the rest if the list doesn't break cleanly. That is:: >>> l = range(10) >>> partition(l, 2) [[0, 1, 2, 3, 4...
{ "repo_name": "Socialsquare/RunningCause", "path": "profile/templatetags/partition_slice.py", "copies": "2", "size": "1439", "license": "mit", "hash": -3340238661484636000, "line_mean": 23.3898305085, "line_max": 80, "alpha_frac": 0.5038220987, "autogenerated": false, "ratio": 2.9854771784232366,...
from django import template register = template.Library() @register.filter def post_process_fieldsets(fieldset): """ Removes a few fields from FeinCMS admin inlines, those being ``id``, ``DELETE`` and ``ORDER`` currently. Additionally, it ensures that dynamically added fields (i.e. ``Applicatio...
{ "repo_name": "pjdelport/feincms", "path": "feincms/templatetags/feincms_admin_tags.py", "copies": "1", "size": "1238", "license": "bsd-3-clause", "hash": -8124711978347418000, "line_mean": 28.4761904762, "line_max": 65, "alpha_frac": 0.5904684976, "autogenerated": false, "ratio": 4.0590163934426...
from django import template register = template.Library() @register.filter('type') def type_(obj): ''' Retrieve the class name of an object ''' return str(type(obj).__name__) @register.inclusion_tag('widgets/form_full.html') def form_full(form, csrf_token=True): ''' Shortcut to render all ...
{ "repo_name": "brasilcomvc/brasilcomvc", "path": "brasilcomvc/common/templatetags/form_utils.py", "copies": "1", "size": "1189", "license": "apache-2.0", "hash": -7509007373433697000, "line_mean": 21.0185185185, "line_max": 72, "alpha_frac": 0.6072329689, "autogenerated": false, "ratio": 3.715625...
from django import template register = template.Library() @register.inclusion_tag('wpkit/tags/sidebar_posts.html', takes_context=True) #, expire_timestamps=('page',)) def wpkit_sidebar_posts(context, num=None, page=None): blog = context.get('blog') num = num or blog.options.posts_per_page qs = blog.mode...
{ "repo_name": "ludoo/wpkit", "path": "wpkit/templatetags/wpkit_widgets.py", "copies": "1", "size": "2366", "license": "bsd-3-clause", "hash": -5443437711101875000, "line_mean": 33.7941176471, "line_max": 113, "alpha_frac": 0.6491969569, "autogenerated": false, "ratio": 3.40431654676259, "config...
from django import template register = template.Library() @register.simple_tag def number_human(value, separator=' ', precision=2, delimeter_count=3, decimal_separator=','): # Converts an integer or floating-point number or a string to a string # containing the delimiter character (default comma) ...
{ "repo_name": "nico401/Penelope", "path": "Penelope/templatetags/functions.py", "copies": "1", "size": "1589", "license": "unlicense", "hash": 8590783994315577000, "line_mean": 29.5769230769, "line_max": 105, "alpha_frac": 0.540591567, "autogenerated": false, "ratio": 3.5869074492099324, "confi...
from django import template register = template.Library() @register.simple_tag def upload_js(): return """ <!-- The template to display files available for upload --> <script id="template-upload" type="text/x-tmpl"> {% for (var i=0, files=o.files, l=files.length, file=files[0]; i<l; file=files[++i]) { %} ...
{ "repo_name": "codepython/CollectorCity-Market-Place", "path": "stores/apps/for_sale/templatetags/for_sale_tags.py", "copies": "2", "size": "3411", "license": "apache-2.0", "hash": 1557641473456626200, "line_mean": 42.7435897436, "line_max": 174, "alpha_frac": 0.5042509528, "autogenerated": false, ...
from django import template register = template.Library() @register.tag(name="session_strategy") def do_stockrecord(parse, token): """ Template tag for fetching the appropriate stockrecord for a product and returning it to the context """ tokens = token.split_contents() if len(tokens) < 3 or...
{ "repo_name": "saadbinakhlaq/django-oscar", "path": "oscar/templatetags/stockrecord_tags.py", "copies": "5", "size": "1229", "license": "bsd-3-clause", "hash": -6420131672674025000, "line_mean": 30.5128205128, "line_max": 72, "alpha_frac": 0.6289666395, "autogenerated": false, "ratio": 3.96451612...
from django import template register = template.Library() @register.tag(name="wishlists_containing_product") def do_basket_form(parse, token): """ Template tag for adding the user's wishlists form to the template context so it can be rendered. """ tokens = token.split_contents() if len(token...
{ "repo_name": "bschuon/django-oscar", "path": "src/oscar/templatetags/wishlist_tags.py", "copies": "43", "size": "1279", "license": "bsd-3-clause", "hash": -6812883687979651000, "line_mean": 31.7948717949, "line_max": 74, "alpha_frac": 0.6419077404, "autogenerated": false, "ratio": 3.899390243902...
from django import template register = template.Library() @register.tag def get_relation_by_type_list(parser, token): """Gets list of relations from object identified by a content type. Syntax:: {% get_relation_list [content_type_app_label.content_type_model] for [object] as [varname] [direction] ...
{ "repo_name": "praekelt/jmbo-show", "path": "show/templatetags/show_tags.py", "copies": "1", "size": "1928", "license": "bsd-3-clause", "hash": -235713047860189980, "line_mean": 29.6031746032, "line_max": 113, "alpha_frac": 0.6125518672, "autogenerated": false, "ratio": 3.9266802443991855, "con...
from django import template register = template.Library() @register.tag def purchase_info_for_product(parse, token): """ Template tag for fetching the appropriate ``PurchaseInfo`` instance for a product and returning it to the context """ tokens = token.split_contents() if len(tokens) != 5 o...
{ "repo_name": "DrOctogon/unwash_ecom", "path": "oscar/templatetags/purchase_info_tags.py", "copies": "5", "size": "2553", "license": "bsd-3-clause", "hash": -7657880969960022000, "line_mean": 31.7307692308, "line_max": 78, "alpha_frac": 0.6173129651, "autogenerated": false, "ratio": 3.92769230769...
from django import template register = template.Library() ### # This is a partial template for a form. All forms will have this same stuff. # @register.inclusion_tag('partials/form.html') def form(id, title, action, f): return { 'title': title, 'id': id, 'action': action, 'f...
{ "repo_name": "colinsullivan/bingo-board", "path": "bingo_board/bingo/templatetags/forms.py", "copies": "1", "size": "1255", "license": "mit", "hash": -6403874160619264000, "line_mean": 24.1, "line_max": 86, "alpha_frac": 0.603187251, "autogenerated": false, "ratio": 3.6271676300578033, "config...
from django import template register = template.Library() @register.inclusion_tag('tools/pager.html', takes_context=True) def pager(context): show_pager = (context['is_paginated'] and context['paginator'].num_pages > 1) if not show_pager: return locals() page = context['page_o...
{ "repo_name": "SarFootball/backend", "path": "teamlogic/templatetags/teamlogic_tags.py", "copies": "1", "size": "1093", "license": "apache-2.0", "hash": -7217061370827400000, "line_mean": 25.6585365854, "line_max": 64, "alpha_frac": 0.5782250686, "autogenerated": false, "ratio": 3.889679715302491...
from django import template register = template.Library() @register.simple_tag(takes_context=True) def add_to_query_string(context, key, value): """ Adds a query to the query string if it exists, otherwise it creates a new one """ query_string = context['request'].GET.copy() query_string[key] = value ...
{ "repo_name": "iychoi/syndicate", "path": "old/ms/django_lib/potatopage/templatetags/paginator_tags.py", "copies": "2", "size": "1425", "license": "apache-2.0", "hash": 3948707531600818700, "line_mean": 36.5, "line_max": 114, "alpha_frac": 0.6736842105, "autogenerated": false, "ratio": 3.88283378...