text
stringlengths
0
1.05M
meta
dict
from django import template from pendulum.models import Entry from pendulum import utils from datetime import datetime, timedelta, time register = template.Library() def seconds_for_entries(entries): seconds = [e.get_seconds() for e in entries] return sum(seconds) def total_hours_for_period(period, user=None...
{ "repo_name": "codekoala/django-pendulum", "path": "pendulum/templatetags/pendulum_tags.py", "copies": "1", "size": "8477", "license": "mit", "hash": 2792887036175905000, "line_mean": 33.6, "line_max": 118, "alpha_frac": 0.6407927333, "autogenerated": false, "ratio": 4.161512027491409, "config_...
from django import template from pirate_core import HttpRedirectException, namespace_get from django.conf import settings from django.core.paginator import Paginator, InvalidPage from django.http import Http404 from django.shortcuts import render_to_response from django.template import RequestContext from haystack.for...
{ "repo_name": "fragro/Open-Assembly", "path": "ver1_0/openassembly/oa_search/templatetags/haystacktags.py", "copies": "1", "size": "2313", "license": "bsd-3-clause", "hash": 412680558038129100, "line_mean": 28.6538461538, "line_max": 93, "alpha_frac": 0.6956333766, "autogenerated": false, "ratio"...
from django import template from pirate_core import namespace_get from oa_dashboard.models import DashboardPanel from oa_cache.views import render_hashed from oa_cache.models import interpret_hash from django.contrib.auth.models import User from customtags.decorators import block_decorator register = template.Library...
{ "repo_name": "fragro/Open-Assembly", "path": "ver1_0/openassembly/oa_dashboard/templatetags/dashboardtags.py", "copies": "1", "size": "2780", "license": "bsd-3-clause", "hash": 653067659678543900, "line_mean": 34.1898734177, "line_max": 128, "alpha_frac": 0.6467625899, "autogenerated": false, "r...
from django import template from piwik.models import Analytics from django.conf import settings from django.utils.translation import ugettext as _ from decimal import Decimal register = template.Library() track = True if settings.DEBUG: track = False try: if not track and settings.PIWIK_IN_DEBUG == True: ...
{ "repo_name": "bhell/django-piwik", "path": "piwik/templatetags/piwik_tags.py", "copies": "1", "size": "4561", "license": "bsd-3-clause", "hash": -2607624034620109300, "line_mean": 33.0373134328, "line_max": 174, "alpha_frac": 0.6193817145, "autogenerated": false, "ratio": 3.9251290877796903, "...
from django import template from playlist.models import ScheduledPlaylist register = template.Library() @register.tag def get_current_playlist_entry(parser, token): try: tag_name, for_arg, obj, as_arg, as_varname = token.split_contents() except ValueError: raise template.TemplateSyntaxError('g...
{ "repo_name": "praekelt/panya-playlist", "path": "playlist/templatetags/playlist_template_tags.py", "copies": "1", "size": "1566", "license": "bsd-3-clause", "hash": -2608043159725622300, "line_mean": 38.15, "line_max": 161, "alpha_frac": 0.6941251596, "autogenerated": false, "ratio": 3.676056338...
from django import template from polybookexchange.models import Exemplar from django.db.models import Avg, Sum register = template.Library() from polybookexchange.utils import sciper2name @register.inclusion_tag('polybookexchange/templatetags/show_book.html') def show_book(book, show_details): return {'book': b...
{ "repo_name": "PolyLAN/polybookexchange", "path": "polybookexchange/templatetags/polybookexchange_extras.py", "copies": "1", "size": "1628", "license": "bsd-2-clause", "hash": -789695808883692800, "line_mean": 28.6, "line_max": 94, "alpha_frac": 0.7143734644, "autogenerated": false, "ratio": 3.08...
from django import template from powerschool_apps.health_care_plan.models import Allergy, AllergyMedication, Asthma, Diabetes register = template.Library() @register.filter('allergens_choice_list') def allergens_choice_list(allergy_inst): if allergy_inst.allergens != ['']: choice_label_list = [] ...
{ "repo_name": "IronCountySchoolDistrict/powerschool_apps", "path": "powerschool_apps/health_care_plan/templatetags/choice_tags.py", "copies": "1", "size": "3406", "license": "mit", "hash": -9035079634500363000, "line_mean": 39.5476190476, "line_max": 106, "alpha_frac": 0.6236054022, "autogenerated"...
from django import template from prices import MoneyRange, TaxedMoney, TaxedMoneyRange from ...core.utils.taxes import DEFAULT_TAX_RATE_NAME register = template.Library() @register.inclusion_tag('product/_price_range.html', takes_context=True) def price_range(context, price_range): display_gross = context['site...
{ "repo_name": "UITools/saleor", "path": "saleor/core/templatetags/taxed_prices.py", "copies": "1", "size": "1426", "license": "bsd-3-clause", "hash": -5951802473613118000, "line_mean": 33.7804878049, "line_max": 79, "alpha_frac": 0.6816269285, "autogenerated": false, "ratio": 3.5209876543209875, ...
from django import template from Produkte.models import Kauf from Grundgeruest.models import ScholariumProfile register = template.Library() @register.simple_tag def choice_value(key, field, formular): return dict(formular.fields[field].choices)[key] @register.simple_tag def stufenname(stufe): return dict(Sc...
{ "repo_name": "wmles/scholarium.at", "path": "Produkte/templatetags/produkttags.py", "copies": "1", "size": "2492", "license": "mit", "hash": -8456305383659928000, "line_mean": 25.752688172, "line_max": 75, "alpha_frac": 0.7230707395, "autogenerated": false, "ratio": 2.7400881057268722, "config...
from django import template from Produkte.models import Kauf, Spendenstufe from Grundgeruest.models import ScholariumProfile register = template.Library() @register.simple_tag def verbose(obj): return obj.__class__._meta.verbose_name @register.simple_tag def choice_value(key, field, formular): return dict(fo...
{ "repo_name": "valuehack/scholarium.at", "path": "Produkte/templatetags/produkttags.py", "copies": "1", "size": "3035", "license": "mit", "hash": -8813920639746444000, "line_mean": 26.8073394495, "line_max": 115, "alpha_frac": 0.7238535137, "autogenerated": false, "ratio": 2.7159498207885306, "...
from django import template from projects.forms import ProjectForm register = template.Library() def show_project_topic(topic): return {"topic": topic} register.inclusion_tag("projects/topic_item.html")(show_project_topic) def show_project(project): return {"project": project} register.inclusion_tag("project...
{ "repo_name": "ingenieroariel/pinax", "path": "apps/projects/templatetags/project_tags.py", "copies": "1", "size": "1565", "license": "mit", "hash": 8641857641775407000, "line_mean": 30.32, "line_max": 126, "alpha_frac": 0.6792332268, "autogenerated": false, "ratio": 3.5407239819004523, "config...
from django import template from promrep.models import PostAssertion register = template.Library() @register.inclusion_tag('promrep/tags/office_badges.html', takes_context=True) def get_office_badges(context, person_id): offices = None selected_offices = context.get('selected_offices') if selected_offic...
{ "repo_name": "kingsdigitallab/dprr-django", "path": "promrep/templatetags/promrep_tags.py", "copies": "1", "size": "2270", "license": "mit", "hash": 1777617082365471200, "line_mean": 36.2131147541, "line_max": 81, "alpha_frac": 0.5515418502, "autogenerated": false, "ratio": 3.7091503267973858, ...
from django import template from quoteme import models register = template.Library() class RandomNode(template.Node): def __init__(self, varname, model): self.varname = varname self.model = model def render(self, context): try: obj = self.model.objects.published().order_...
{ "repo_name": "montylounge/django-quoteme", "path": "quoteme/templatetags/quoteme_tags.py", "copies": "1", "size": "1843", "license": "bsd-3-clause", "hash": 5475354493290933000, "line_mean": 25.3285714286, "line_max": 78, "alpha_frac": 0.5567010309, "autogenerated": false, "ratio": 4.26620370370...
from django import template from random import randint from django.utils.safestring import mark_safe from django.contrib.staticfiles.storage import staticfiles_storage register = template.Library() @register.simple_tag def random_intnumber(length=5): """ Create a random integer with given length. For a le...
{ "repo_name": "CIRALabs/DSAP", "path": "src/web/templatetags/app_filters.py", "copies": "1", "size": "1433", "license": "mit", "hash": 350529004288616060, "line_mean": 33.1428571429, "line_max": 82, "alpha_frac": 0.6510816469, "autogenerated": false, "ratio": 4.0594900849858355, "config_test": ...
from django import template from random import randrange, shuffle register = template.Library() class EncryptEmail(template.Node): """ Template tag that allows to obfuscate email addresses in page templates. Based on http://djangosnippets.org/snippets/1907/ """ def __init__(self, c...
{ "repo_name": "zeehio/META-SHARE", "path": "metashare/repository/templatetags/email_protection.py", "copies": "6", "size": "2257", "license": "bsd-3-clause", "hash": 3265748508397223000, "line_mean": 32.7014925373, "line_max": 78, "alpha_frac": 0.579973416, "autogenerated": false, "ratio": 3.9252...
from django import template from random import sample from Application.utilities.web_utilitites import clean_html, reconvert_html from Application.service.item_services import get_status_by_user_item register = template.Library() colors = [ "#F44336", "#E91E63", "#9C27B0", "#673AB7", ...
{ "repo_name": "andjimrio/LTN", "path": "Application/templatetags/apptags.py", "copies": "1", "size": "2389", "license": "mit", "hash": -6944060593504133000, "line_mean": 22.6534653465, "line_max": 113, "alpha_frac": 0.5604855588, "autogenerated": false, "ratio": 3.3742937853107344, "config_test...
from django import template from request.models import Request register = template.Library() class ActiveUserNode(template.Node): def __init__(self, parser, token): tokens = token.contents.split() tag_name = tokens.pop(0) self.kwargs = {} if not ((len(tokens) == 5) or (len...
{ "repo_name": "Derecho/django-request", "path": "request/templatetags/request_tag.py", "copies": "1", "size": "1994", "license": "bsd-2-clause", "hash": 5139339251133891000, "line_mean": 33.9824561404, "line_max": 104, "alpha_frac": 0.5802407222, "autogenerated": false, "ratio": 4.004016064257028...
from django import template from request.models import Request register = template.Library() class ActiveUserNode(template.Node): def __init__(self, parser, token): tokens = token.contents.split() tag_name = tokens.pop(0) self.kwargs = {} if not ((len(tokens) == 5) or (len(tokens...
{ "repo_name": "gnublade/django-request", "path": "request/templatetags/request_tag.py", "copies": "4", "size": "1961", "license": "bsd-2-clause", "hash": 6299066174884405000, "line_mean": 32.2372881356, "line_max": 104, "alpha_frac": 0.5900050994, "autogenerated": false, "ratio": 3.92985971943887...
from django import template from sass.models import SassModel from sass.management.commands import sassify register = template.Library() class SassNode(template.Node): def __init__(self, name): try: command = sassify.Command() command.process_sass(name=name) self.model...
{ "repo_name": "ashchristopher/django-sass", "path": "sass/templatetags/sass_tag.py", "copies": "1", "size": "1202", "license": "mit", "hash": 5610714642893061000, "line_mean": 35.4242424242, "line_max": 116, "alpha_frac": 0.6522462562, "autogenerated": false, "ratio": 3.75625, "config_test": fa...
from django import template from satchmo.configuration import config_value, SettingNotSet import logging log = logging.getLogger('configuration.config_tags') register = template.Library() def force_space(value, chars=40): """Forces spaces every `chars` in value""" chars = int(chars) if len(value) < char...
{ "repo_name": "sankroh/satchmo", "path": "satchmo/configuration/templatetags/config_tags.py", "copies": "2", "size": "1563", "license": "bsd-3-clause", "hash": -8313367047259074000, "line_mean": 24.2096774194, "line_max": 120, "alpha_frac": 0.56621881, "autogenerated": false, "ratio": 4.049222797...
from django import template from satchmo.shop.templatetags import get_filter_args register = template.Library() def order_details(context, order, default_view_tax=False): """Output a formatted block giving order details.""" return {'order' : order, 'default_view_tax' : default_view_tax, 'reque...
{ "repo_name": "roadhead/satchmo", "path": "satchmo/shop/templatetags/satchmo_order.py", "copies": "2", "size": "1486", "license": "bsd-3-clause", "hash": -1444555086962977800, "line_mean": 28.72, "line_max": 100, "alpha_frac": 0.668909825, "autogenerated": false, "ratio": 3.6782178217821784, "c...
from django import template from satchmo_store.shop import get_satchmo_setting from satchmo_store.shop.models import Order, ORDER_STATUS from satchmo_store.shop.utils import is_multihost_enabled register = template.Library() def customorder_management(order): custom = [] for orderitem in order.orderitem_set.a...
{ "repo_name": "russellmayhew/satchmo", "path": "satchmo/apps/satchmo_store/shop/templatetags/satchmo_adminorder_tags.py", "copies": "14", "size": "1662", "license": "bsd-3-clause", "hash": 5965570523073078000, "line_mean": 29.2181818182, "line_max": 89, "alpha_frac": 0.6817087846, "autogenerated": ...
from django import template from saved_searches.models import SavedSearch register = template.Library() class MostRecentNode(template.Node): def __init__(self, varname, user=None, search_key=None, limit=10): self.varname = varname self.user = user self.search_key = search_key sel...
{ "repo_name": "dablak/saved_searches", "path": "saved_searches/templatetags/saved_searches_tags.py", "copies": "2", "size": "4100", "license": "bsd-3-clause", "hash": -7436800117329086000, "line_mean": 29.8270676692, "line_max": 111, "alpha_frac": 0.5904878049, "autogenerated": false, "ratio": 3....
from django import template from schedule.models import Calendar register = template.Library() class CalendarNode(template.Node): def __init__(self, content_object, distinction, context_var, create=False): self.content_object = template.Variable(content_object) self.distinction = distinction ...
{ "repo_name": "indro/t2c", "path": "apps/external_apps/schedule/templatetags/scheduletags.py", "copies": "2", "size": "3099", "license": "mit", "hash": 4152275874775785500, "line_mean": 44.5882352941, "line_max": 225, "alpha_frac": 0.6476282672, "autogenerated": false, "ratio": 3.77007299270073, ...
from django import template from scripter.conf import settings from scripter.utils import get_required_scripts from scripter import scripts as scripts_reg register = template.Library() # Usage: {% scripter_css "reset;960gs==12cols" %} @register.inclusion_tag('scripter/styles.html') def head_css(default_css=None): ...
{ "repo_name": "ekaputra07/django-scripter", "path": "scripter/templatetags/scripts.py", "copies": "1", "size": "2485", "license": "bsd-3-clause", "hash": -5977123135937044000, "line_mean": 27.2386363636, "line_max": 64, "alpha_frac": 0.5211267606, "autogenerated": false, "ratio": 3.90723270440251...
from django import template from seasonal_events.models import Season register = template.Library() @register.tag def season_data(parser,token): return CurrentSeason() class CurrentSeason(template.Node): """ Denne klassen gir navnet på en tidsbestemt season og en tilhørende logo-url til cont...
{ "repo_name": "hackerspace-ntnu/website", "path": "seasonal_events/templatetags/seasonal_header_updater.py", "copies": "1", "size": "1272", "license": "mit", "hash": 5844562334492019000, "line_mean": 32.3947368421, "line_max": 75, "alpha_frac": 0.6115051221, "autogenerated": false, "ratio": 3.868...
from django import template from settings import * register = template.Library() #This will display the undefined on the GUI if value is None it will print '' else value @register.filter def displayNone(value): if value is None: return '-' else: return value displayNone = register.simple_tag(d...
{ "repo_name": "cernops/CloudMan", "path": "cloudman/templatetags/filters.py", "copies": "1", "size": "2968", "license": "apache-2.0", "hash": 4409481082749159400, "line_mean": 23.5289256198, "line_max": 97, "alpha_frac": 0.6543126685, "autogenerated": false, "ratio": 3.6823821339950373, "config...
from django import template from settings.local import MEDIA_URL as STATIC_URL register = template.Library() class StaticLinkNode(template.Node): def __init__(self, file_type, file_path): self.file_type = file_type if not file_path.endswith(file_type) and file_type != "img": file_path...
{ "repo_name": "mozilla/inventory", "path": "vendor-local/src/django-tastytools/tastytools/templatetags/staticlink.py", "copies": "5", "size": "1114", "license": "bsd-3-clause", "hash": 1277261162381805000, "line_mean": 33.8125, "line_max": 84, "alpha_frac": 0.5987432675, "autogenerated": false, "...
from django import template from simcon import settings register = template.Library() @register.simple_tag def getRecorderHead(): ''' Supplies the required header elements for: jquery, recorder, and ajax sends ''' return ''' <script type="text/javascript" src="''' + settings.STATIC_URL + '''jquer...
{ "repo_name": "djorda9/Simulated-Conversations", "path": "vagrant/simcon/templatetags/recorder_tags.py", "copies": "1", "size": "5879", "license": "mit", "hash": 1646508525217881600, "line_mean": 33.1860465116, "line_max": 138, "alpha_frac": 0.6210239837, "autogenerated": false, "ratio": 3.827473...
from django import template from simple_audit.models import Audit register = template.Library() class AdminAuditNode(template.Node): def __init__(self, limit, varname, user): self.limit, self.varname, self.user = limit, varname, user def __repr__(self): return "<GetAdminLog Node>" def ...
{ "repo_name": "globocom/database-as-a-service", "path": "dbaas/admin/templatetags/audit.py", "copies": "1", "size": "1830", "license": "bsd-3-clause", "hash": 6003621304129846000, "line_mean": 31.6785714286, "line_max": 107, "alpha_frac": 0.6092896175, "autogenerated": false, "ratio": 3.804573804...
from django import template from six.moves.urllib_parse import urlencode from smart_lists.helpers import SmartList register = template.Library() @register.inclusion_tag("smart_lists/smart_list.html", takes_context=True) def smart_list( context, object_list=None, page_obj=None, is_paginated=None, ...
{ "repo_name": "plecto/django-smart-lists", "path": "smart_lists/templatetags/smart_list.py", "copies": "1", "size": "3104", "license": "mit", "hash": 8609183825528271000, "line_mean": 31.3333333333, "line_max": 102, "alpha_frac": 0.6365979381, "autogenerated": false, "ratio": 3.630409356725146, ...
from django import template from sleep.models import * from django.utils.timezone import now from django.utils.html import format_html import datetime import datetime_utils import pytz import numpy import cmath register = template.Library() # Inclusion tags @register.inclusion_tag('inclusion/announcement.html') def di...
{ "repo_name": "sleepers-anonymous/zscore", "path": "sleep/templatetags/sleep_tags.py", "copies": "1", "size": "10685", "license": "mit", "hash": 8362044942511940000, "line_mean": 41.0669291339, "line_max": 212, "alpha_frac": 0.6411792232, "autogenerated": false, "ratio": 3.484996738421396, "con...
from django import template from sleep.models import * import datetime register = template.Library() @register.inclusion_tag('inclusion/graph_per_day.html') def graphPerDay(user, interval=None): sleeper = Sleeper.objects.get(pk=user.pk) if interval == None: s = datetime.date.min else: s = datetime.date.tod...
{ "repo_name": "sleepers-anonymous/zscore", "path": "sleep/templatetags/graphs.py", "copies": "1", "size": "3783", "license": "mit", "hash": -6285091633279850000, "line_mean": 41.0333333333, "line_max": 193, "alpha_frac": 0.6249008723, "autogenerated": false, "ratio": 3.2838541666666665, "config...
from django import template from smartypants import smartypants from django.utils.safestring import mark_safe from django.conf import settings from markdown_deux import markdown as markdown_deux register = template.Library() @register.filter def smartquotes(text): return smartypants(text) # Clean up text to mat...
{ "repo_name": "knowledgecommonsdc/kcdc3", "path": "kcdc3/apps/pinata/templatetags/pinata_filters.py", "copies": "1", "size": "1471", "license": "mit", "hash": -2934353900934390000, "line_mean": 27.8431372549, "line_max": 70, "alpha_frac": 0.7464309993, "autogenerated": false, "ratio": 3.553140096...
from django import template from smileys.models import Smiley import re register = template.Library() def gen_smileys(value, type): """ Replaces all occurrences of the active smiley patterns in `value` with a tag that points to the image associated with the respective pattern. Hoorah! """ fo...
{ "repo_name": "codekoala/django-smileys", "path": "smileys/templatetags/smiley_tags.py", "copies": "1", "size": "1680", "license": "bsd-3-clause", "hash": -314547103587574900, "line_mean": 39, "line_max": 165, "alpha_frac": 0.6196428571, "autogenerated": false, "ratio": 3.5443037974683542, "con...
from django import template from socialgraph.util import get_people_user_follows def do_dict_entry_for_item(parser, token): """ Given an object and a dictionary keyed with object ids - as returned by the ``friends_for_user`` template tag - retrieves the value for the given object and stores it in a con...
{ "repo_name": "mvayngrib/startthedark", "path": "socialgraph/templatetags/socialgraph_tags.py", "copies": "2", "size": "2714", "license": "bsd-3-clause", "hash": -937061394950946300, "line_mean": 34.7236842105, "line_max": 80, "alpha_frac": 0.6311717023, "autogenerated": false, "ratio": 3.9678362...
from django import template from socialregistration.templatetags import resolve, get_bits register = template.Library() @register.tag def openid_form(parser, token): """ Render OpenID form. Allows to pre set the provider:: {% openid_form "https://www.google.com/accounts/o8/id" %} Also creates custo...
{ "repo_name": "kapt/django-socialregistration", "path": "socialregistration/contrib/openid/templatetags/openid.py", "copies": "7", "size": "1330", "license": "mit", "hash": 4036050608767387600, "line_mean": 26.7083333333, "line_max": 96, "alpha_frac": 0.6082706767, "autogenerated": false, "ratio"...
from django import template from splunkdj.templatetags.tagutils import component_context register = template.Library() @register.inclusion_tag('splunkdj:components/component.html', takes_context=True) def sankey(context, id, *args, **kwargs): return component_context( context, "splunk-toolkit-san...
{ "repo_name": "PowerSchill/minecraft-app", "path": "app/minecraft-app/django/minecraft-app/templatetags/splunk_wftoolkit.py", "copies": "2", "size": "2650", "license": "apache-2.0", "hash": -7438612585109463000, "line_mean": 27.8152173913, "line_max": 81, "alpha_frac": 0.6483018868, "autogenerated"...
from django import template from src.basic.inlines.parser import inlines from src.basic.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:: ...
{ "repo_name": "hittu123/ruhive", "path": "src/basic/inlines/templatetags/inlines.py", "copies": "1", "size": "2079", "license": "mit", "hash": -1515661563114033400, "line_mean": 24.6790123457, "line_max": 99, "alpha_frac": 0.6402116402, "autogenerated": false, "ratio": 3.9078947368421053, "conf...
from django import template from subprocess import Popen, PIPE from bs4 import BeautifulSoup try: unicode_type = unicode except NameError: unicode_type = str register = template.Library() @register.filter def html2text(value): """ Pipes given HTML string into the text browser W3M, which renders it. ...
{ "repo_name": "ramusus/django-email-html", "path": "email_html/templatetags/email_html.py", "copies": "1", "size": "1309", "license": "bsd-3-clause", "hash": -1045927907122028500, "line_mean": 29.4418604651, "line_max": 123, "alpha_frac": 0.6241405653, "autogenerated": false, "ratio": 4.015337423...
from django import template from support.forms import ContactForm from support.forms import get_support_moderators as _get_support_moderators register = template.Library() def show_support_form(): return {"contact_form": ContactForm()} register.inclusion_tag("support/contact_form.html")(show_support_form) def ge...
{ "repo_name": "philippWassibauer/django-support", "path": "support/templatetags/support_tags.py", "copies": "1", "size": "1467", "license": "mit", "hash": 1606199942243843800, "line_mean": 27.2307692308, "line_max": 95, "alpha_frac": 0.6802999318, "autogenerated": false, "ratio": 3.71392405063291...
from django import template from sys import stdout, stderr register = template.Library() @register.simple_tag(takes_context=True) def object_name(context): print stderr, "dir=", dir(context); stderr.flush() print stderr, "dicts=", context.dicts; stderr.flush() print stderr, "has_key('object')", conte...
{ "repo_name": "warnes/irrigatorpro", "path": "irrigator_pro/home/templatetags/object_name.py", "copies": "1", "size": "1324", "license": "mit", "hash": -3829094779351843300, "line_mean": 30.5238095238, "line_max": 80, "alpha_frac": 0.6148036254, "autogenerated": false, "ratio": 3.8045977011494254...
from django import template from tagging.models import Tag, TaggedItem from knesset.tagvotes.models import TagVote from knesset.laws.models import VoteAction, VOTE_ACTION_TYPE_CHOICES, MemberVotingStatistics from knesset.mks.models import Member from datetime import date, timedelta from django.utils.translation import ...
{ "repo_name": "livni/old-OK", "path": "src/knesset/laws/templatetags/laws_extra.py", "copies": "1", "size": "3940", "license": "bsd-3-clause", "hash": -5176158211113512000, "line_mean": 40.0416666667, "line_max": 125, "alpha_frac": 0.6296954315, "autogenerated": false, "ratio": 3.29156223893066, ...
from django import template from tagging.models import Tag, TaggedItem from tagvotes.models import TagVote from laws.models import VoteAction, VOTE_ACTION_TYPE_CHOICES, MemberVotingStatistics from mks.models import Member, Knesset from datetime import date, timedelta from django.utils.translation import ugettext_lazy a...
{ "repo_name": "otadmor/Open-Knesset", "path": "laws/templatetags/laws_tags.py", "copies": "1", "size": "5817", "license": "bsd-3-clause", "hash": 5240679037258638000, "line_mean": 42.7368421053, "line_max": 138, "alpha_frac": 0.612858862, "autogenerated": false, "ratio": 3.3051136363636364, "co...
from django import template from task.models import Execution register = template.Library() @register.inclusion_tag('partial/execution_list_inline.html', takes_context=True) def last_activity_bar(context, related_to=None, no_title=False): if not related_to: raise Exception('related_to parameter is require...
{ "repo_name": "senkal/gunnery", "path": "gunnery/task/templatetags/task_extras.py", "copies": "2", "size": "1356", "license": "apache-2.0", "hash": -345951388551427300, "line_mean": 41.40625, "line_max": 81, "alpha_frac": 0.6202064897, "autogenerated": false, "ratio": 4.121580547112462, "config...
from django import template from template_utils.templatetags.generic_content import GenericContentNode register = template.Library() class LatestFeaturedNode(GenericContentNode): def _get_query_set(self): return self.query_set.filter(featured__exact=True) def do_featured_entries(parser, token): """ ...
{ "repo_name": "mafix/coltrane-blog", "path": "coltrane/templatetags/coltrane.py", "copies": "1", "size": "1655", "license": "bsd-3-clause", "hash": -2953679726279103000, "line_mean": 29.6481481481, "line_max": 96, "alpha_frac": 0.6489425982, "autogenerated": false, "ratio": 3.9311163895486936, ...
from django import template from textify.models import TextifyPost from django.conf import settings from random import shuffle register = template.Library() CACHE_PREFIX = "textifypost_" SLUG_MIDFIX = "slug_" TAG_MIDFIX = "tag_" def do_get_posts(parser, token): tokens = token.split_contents() if len(tokens)%...
{ "repo_name": "sixpearls/django-textify", "path": "textify/templatetags/textify_post_tags.py", "copies": "1", "size": "2334", "license": "bsd-2-clause", "hash": -6065641298404483000, "line_mean": 33.3382352941, "line_max": 138, "alpha_frac": 0.6135389889, "autogenerated": false, "ratio": 3.601851...
from django import template from tournament.models import Countries, GroupPredictions, MatchPredictions, Matches from django.core.exceptions import ObjectDoesNotExist, MultipleObjectsReturned from django.utils.http import urlquote from django.conf import settings register = template.Library() @register.filter def gr...
{ "repo_name": "katembu/world-cup", "path": "world_cup/tournament/templatetags/brackets_tags.py", "copies": "1", "size": "2694", "license": "mit", "hash": -4777729881646252000, "line_mean": 33.1012658228, "line_max": 112, "alpha_frac": 0.6321455085, "autogenerated": false, "ratio": 4.4163934426229...
from django import template from tracking.models import Organization, ReferringEntity, PatientVisit from datetime import datetime , timedelta, date register = template.Library() # @register.assignment_tag # def get_video(video): # video_type = video.content_type.split('/')[0] # return video_type @register.assignme...
{ "repo_name": "Heteroskedastic/Dr-referral-tracker", "path": "tracking/templatetags/visite_counts.py", "copies": "1", "size": "4370", "license": "mit", "hash": 5041759828980299000, "line_mean": 26.3125, "line_max": 89, "alpha_frac": 0.6395881007, "autogenerated": false, "ratio": 3.846830985915493...
from django import template from tracking.models import Visitor import re register = template.Library() class VisitorsOnSite(template.Node): """ Injects the number of active users on your site as an integer into the context """ def __init__(self, varname, same_page=False): self.varname = varna...
{ "repo_name": "mrfunyon/django-tracking", "path": "tracking/templatetags/tracking_tags.py", "copies": "1", "size": "3127", "license": "mit", "hash": -4515574309572642300, "line_mean": 31.2371134021, "line_max": 197, "alpha_frac": 0.6469459546, "autogenerated": false, "ratio": 3.8941469489414695, ...
from django import template from tracking.models import Visitor register = template.Library() class VisitorsOnSite(template.Node): """ Injects the number of active users on your site as an integer into the context """ def __init__(self, varname, same_page=False): self.varname = varname ...
{ "repo_name": "Bunch/django-tracking", "path": "tracking/templatetags/tracking_tags.py", "copies": "25", "size": "1705", "license": "mit", "hash": -1763274752715538000, "line_mean": 33.1, "line_max": 197, "alpha_frac": 0.6604105572, "autogenerated": false, "ratio": 4.148418491484185, "config_te...
from django import template from tribes.forms import TribeForm register = template.Library() def show_tribe_topic(topic): return {"topic": topic} register.inclusion_tag("tribes/topic_item.html")(show_tribe_topic) def show_tribe(tribe): return {"tribe": tribe} register.inclusion_tag("tribes/tribe_item.html")(...
{ "repo_name": "ingenieroariel/pinax", "path": "apps/tribes/templatetags/tribe_tags.py", "copies": "1", "size": "1420", "license": "mit", "hash": -1485507904026282800, "line_mean": 29.8913043478, "line_max": 126, "alpha_frac": 0.6690140845, "autogenerated": false, "ratio": 3.3411764705882354, "c...
from django import template from ultimate.captain.models import GameReportScore register = template.Library() @register.filter def get_user_games(league, user): return league.get_user_games(user) @register.filter def get_report_for_team(game, team): return game.get_report_for_team(team) @register.filter ...
{ "repo_name": "a2ultimate/ultimate-league-app", "path": "src/ultimate/templatetags/games.py", "copies": "2", "size": "1269", "license": "bsd-3-clause", "hash": 6976031107917674000, "line_mean": 24.38, "line_max": 113, "alpha_frac": 0.7202521671, "autogenerated": false, "ratio": 3.3394736842105264...
from django import template from urllib.parse import urlparse, parse_qs, urlsplit register = template.Library() def embed_url(value): url = None if 'vimeo' in value: """ - http://vimeo.com/119054553 - http://vimeo.com/channels/staffpicks/119054553 - http://vimeo.com/groups/fil...
{ "repo_name": "britny/djangocms-styledlink", "path": "djangocms_styledlink/templatetags/video_custom_tags.py", "copies": "1", "size": "2713", "license": "bsd-3-clause", "hash": 8834617467880465000, "line_mean": 30.9176470588, "line_max": 69, "alpha_frac": 0.5377810542, "autogenerated": false, "ra...
from django import template from ..utils import is_active register = template.Library() @register.tag def ifswitch(parser, token): bits = token.split_contents() if len(bits) < 2: raise template.TemplateSyntaxError( "%r tag requires an argument" % bits[0]) name = bits[1] try: ...
{ "repo_name": "potatolondon/django-hashbrown", "path": "hashbrown/templatetags/hashbrown_tags.py", "copies": "1", "size": "1370", "license": "bsd-2-clause", "hash": -1595800436949780200, "line_mean": 24.3703703704, "line_max": 66, "alpha_frac": 0.6131386861, "autogenerated": false, "ratio": 4.005...
from django import template from uuid import uuid4 from django.core.urlresolvers import reverse from django.forms import Media from ..utils import make_context from ..widgets import swift_direct_js as swift_direct_js_html from ..widgets import swift_direct_css as swift_direct_css_html register = template.Library() __a...
{ "repo_name": "mmcardle/django_swift_direct", "path": "swift_direct/templatetags/swift_direct.py", "copies": "1", "size": "1035", "license": "mit", "hash": 7435134829200575000, "line_mean": 27.7777777778, "line_max": 79, "alpha_frac": 0.6879227053, "autogenerated": false, "ratio": 3.4615384615384...
from django import template from vacancies_and_studentships.models import Studentship, Vacancy, VacanciesPlugin from entity_tags import work_out_entity, entity_for_page from vacancies_and_studentships.cms_plugins import CMSVacanciesPlugin from cms.models import Page from django.db.models import Q register = template...
{ "repo_name": "bubenkoff/Arkestra", "path": "vacancies_and_studentships/templatetags/vacancies_and_studentships_tags.py", "copies": "2", "size": "4572", "license": "bsd-2-clause", "hash": -3303322098570653000, "line_mean": 31.6571428571, "line_max": 139, "alpha_frac": 0.6566054243, "autogenerated":...
from django import template from vodkamartiniarticle.models import Article from django.db.models import get_model register = template.Library() @register.tag(name='get_latest_articles') def do_latest_articles(parser, token): """ Simple tag to create a new template variable latest_articles which contains the l...
{ "repo_name": "alexisbellido/django-vodkamartini-article", "path": "vodkamartiniarticle/templatetags/article_tags.py", "copies": "1", "size": "1784", "license": "bsd-3-clause", "hash": -5297745567374389000, "line_mean": 36.1666666667, "line_max": 137, "alpha_frac": 0.6900224215, "autogenerated": fa...
from django import template from vodkamartiniqa.forms import AnswerForm from vodkamartiniqa.models import Answer from django.template.loader import render_to_string from django.core import urlresolvers from django.utils.encoding import smart_unicode register = template.Library() class BaseAnswerNode(template.Node): ...
{ "repo_name": "alexisbellido/django-vodkamartini-qa", "path": "vodkamartiniqa/templatetags/answers.py", "copies": "1", "size": "6918", "license": "bsd-3-clause", "hash": 4704279574252560000, "line_mean": 34.116751269, "line_max": 152, "alpha_frac": 0.6237351836, "autogenerated": false, "ratio": 4...
from django import template from vodkamartiniqa.models import Question from django.db.models import get_model from django.db.models import Count register = template.Library() @register.tag(name='get_questions') def do_questions(parser, token): """ Flexible tag to create a new template variable with questions....
{ "repo_name": "alexisbellido/django-vodkamartini-qa", "path": "vodkamartiniqa/templatetags/question_tags.py", "copies": "1", "size": "3681", "license": "bsd-3-clause", "hash": 6692535927167820000, "line_mean": 61.3898305085, "line_max": 168, "alpha_frac": 0.6530834012, "autogenerated": false, "ra...
from django import template from wagtailcloudinary.fields import CloudinaryResource register = template.Library() @register.filter() def as_resource(image): if isinstance(image, str): image_arr = image.split('/') image = { 'public_id': '/'.join(image_arr[2:]), 'type': imag...
{ "repo_name": "dteskera/wagtailcloudinary", "path": "wagtailcloudinary/templatetags/wagtailcloudinary.py", "copies": "1", "size": "1812", "license": "bsd-2-clause", "hash": 8588793909414008000, "line_mean": 28.2258064516, "line_max": 116, "alpha_frac": 0.5877483444, "autogenerated": false, "ratio...
from django import template from wagtail.core.models import Page register = template.Library() @register.simple_tag(takes_context=True) def get_site_root(context): return context['request'].site.root_page def has_menu_children(page): if page.get_children().filter(live=True, show_in_menus=True): retu...
{ "repo_name": "chrisdev/wagtail-cookiecutter-foundation", "path": "{{cookiecutter.project_slug}}/utils/templatetags/navigation_tags.py", "copies": "2", "size": "5551", "license": "mit", "hash": -978493978695844000, "line_mean": 29.3333333333, "line_max": 78, "alpha_frac": 0.6386236714, "autogenerat...
from django import template from wagtail.documents.models import Document from contact.models import ContactPage from blog.models import BlogPage from events.models import EventPage from pages.models import Testimonial, Advert register = template.Library() @register.simple_tag(takes_context=True) def get_contact_fie...
{ "repo_name": "Chukwunonso/ndi_anambra", "path": "utils/templatetags/ndi_anambra_utils.py", "copies": "1", "size": "2811", "license": "mit", "hash": 4724230759765659000, "line_mean": 25.2710280374, "line_max": 79, "alpha_frac": 0.6318036286, "autogenerated": false, "ratio": 3.8089430894308944, ...
from django import template from wagtail.wagtailcore.models import Page register = template.Library() @register.assignment_tag(takes_context=True) def get_site_root(context): return context['request'].site.root_page def has_menu_children(page): if page.get_children().filter(live=True, show_in_menus=True): ...
{ "repo_name": "aksh1/wagtail-cookiecutter-foundation", "path": "{{cookiecutter.repo_name}}/utils/templatetags/navigation_tags.py", "copies": "2", "size": "4890", "license": "mit", "hash": 7076006494561364000, "line_mean": 29.5625, "line_max": 78, "alpha_frac": 0.6488752556, "autogenerated": false, ...
from django import template from wagtail.wagtailcore.templatetags.wagtailcore_tags import richtext __author__ = 'bgrace' register = template.Library() class TextFragmentNode(template.Node): def __init__(self, fragment_name): self.fragment_name = fragment_name def render(self, context): pag...
{ "repo_name": "bgrace/wagtail-commons", "path": "wagtail_commons/core/templatetags/fragment_tags.py", "copies": "1", "size": "1070", "license": "bsd-3-clause", "hash": -7192036997433528000, "line_mean": 32.4375, "line_max": 107, "alpha_frac": 0.661682243, "autogenerated": false, "ratio": 4.007490...
from django import template from wagtail.wagtaildocs.models import Document from contact.models import ContactPage from blog.models import BlogPage from events.models import EventPage from pages.models import Testimonial, Advert register = template.Library() @register.assignment_tag(takes_context=True) def get_conta...
{ "repo_name": "aksh1/wagtail-cookiecutter-foundation", "path": "{{cookiecutter.repo_name}}/utils/templatetags/{{cookiecutter.repo_name}}_utils.py", "copies": "1", "size": "2818", "license": "mit", "hash": 132495014977101820, "line_mean": 25.3364485981, "line_max": 79, "alpha_frac": 0.6323633783, "a...
from django import template from weather.models import Forecast, ForecastDay from datetime import datetime register = template.Library() class LatestForecastNode(template.Node): def __init__(self, varname='latest_forecast'): self.varname = varname def render(self, context): context[...
{ "repo_name": "caiges/populous", "path": "populous/weather/templatetags/weather_tags.py", "copies": "1", "size": "1869", "license": "bsd-3-clause", "hash": -2090784671013915100, "line_mean": 29.6557377049, "line_max": 135, "alpha_frac": 0.6425896201, "autogenerated": false, "ratio": 3.73053892215...
from django import template from woodstock.models import EventPart register = template.Library() class GetEventPartsNode(template.Node): def __init__(self, variable_name=None): self.variable_name = variable_name def render(self, context): if self.variable_name is None: return u''...
{ "repo_name": "allink/woodstock", "path": "woodstock/templatetags/event_tags.py", "copies": "1", "size": "1069", "license": "bsd-3-clause", "hash": -778892168773069300, "line_mean": 34.6333333333, "line_max": 102, "alpha_frac": 0.6679139383, "autogenerated": false, "ratio": 3.9301470588235294, ...
from django import template from wp.models import Post, Comment register = template.Library() @register.inclusion_tag("wp/recent_comments.html") def show_comments(num_comments): return {"comments":Comment.objects.order_by("-comment_date")[:num_comments]} @register.inclusion_tag("wp/recent_posts.html") def sho...
{ "repo_name": "agiliq/django-wordpress", "path": "wp/templatetags/wordpress_tags.py", "copies": "1", "size": "1789", "license": "bsd-3-clause", "hash": -602692438770090800, "line_mean": 30.3859649123, "line_max": 129, "alpha_frac": 0.664058133, "autogenerated": false, "ratio": 3.7426778242677825,...
from django import template from xformmanager.models import FormDataPointer register = template.Library() NOT_SET = "-- not set --" @register.simple_tag def form_data_lookup(column, form, editing=False): '''Lookup the column in the form. If it is found render it. If not return some default thing saying i...
{ "repo_name": "fredwilliam/PMO", "path": "apps/xformmanager/templatetags/xform_tags.py", "copies": "4", "size": "1635", "license": "bsd-3-clause", "hash": 7177578757271081000, "line_mean": 37.023255814, "line_max": 96, "alpha_frac": 0.5737003058, "autogenerated": false, "ratio": 4.203084832904884...
from django import template from xformmanager.models import * from hq.models import * from hq.models import * register = template.Library() from resources.models import * from facilities.models import Facility xmldate_format= '%Y-%m-%dT%H:%M:%S' output_format = '%Y-%m-%d %H:%M' def _get_class(count): if count % 2...
{ "repo_name": "fredwilliam/PMO", "path": "apps/commtrack_calendar/templatetags/calendar-tags.py", "copies": "2", "size": "1844", "license": "bsd-3-clause", "hash": -8960035667141631000, "line_mean": 31.350877193, "line_max": 118, "alpha_frac": 0.4978308026, "autogenerated": false, "ratio": 3.6370...
from django import template from xformmanager.models import * from hq.models import * from hq.models import * register = template.Library() from samples.models import * from wqm.models import * xmldate_format= '%Y-%m-%dT%H:%M:%S' output_format = '%Y-%m-%d %H:%M' def _get_class(count): if count % 2 == 0: r...
{ "repo_name": "icomms/wqmanager", "path": "apps/aquatest_calendar/templatetags/calendar-tags.py", "copies": "2", "size": "2323", "license": "bsd-3-clause", "hash": 168555989402412700, "line_mean": 35.296875, "line_max": 115, "alpha_frac": 0.4984933276, "autogenerated": false, "ratio": 3.681458003...
from django import template from xformmanager.models import * from hq.models import * from hq.models import * register = template.Library() xmldate_format= '%Y-%m-%dT%H:%M:%S' output_format = '%Y-%m-%d %H:%M' def _get_class(count): if count % 2 == 0: return "even" return "odd" #def _getsamples() # ...
{ "repo_name": "commtrack/commtrack-core", "path": "apps/commtrack_reports/templatetags/show_samples-tags.py", "copies": "2", "size": "1667", "license": "bsd-3-clause", "hash": 724879802898740700, "line_mean": 27.7413793103, "line_max": 92, "alpha_frac": 0.4709058188, "autogenerated": false, "rati...
from django import template import datetime from datetime import date from django.utils.safestring import mark_safe from django.core.urlresolvers import reverse register = template.Library() @register.filter(name='get_active_label') def active_label(active): span = '' if active: span = '<span class=...
{ "repo_name": "Clemson-DPA/dpa-pipe-backend", "path": "dpa/ptasks/templatetags/ptasks_extras.py", "copies": "1", "size": "2999", "license": "mit", "hash": 5920367198468590000, "line_mean": 32.3222222222, "line_max": 79, "alpha_frac": 0.6008669557, "autogenerated": false, "ratio": 3.41183162684869...
from django import template import datetime from django.utils import timezone from ..models import Comment from ..models import Issue register = template.Library() @register.filter def is_commited(repository, contributor): """Checks if contributor has made commits to the repository.""" for commit in reposit...
{ "repo_name": "UKS-Tim3/Issuebox", "path": "issuebox/website/templatetags/website_filters.py", "copies": "1", "size": "2431", "license": "mit", "hash": -3489716991672350700, "line_mean": 33.7285714286, "line_max": 78, "alpha_frac": 0.6733854381, "autogenerated": false, "ratio": 4.162671232876712,...
from django import template import datetime from django.utils.translation import ugettext_lazy as _ register = template.Library() def do_statistics_nav_vars(parser, token): if len(token.contents.split()) != 2: raise template.TemplateSyntaxError, _("%(name)r tag needs a single argument") % {'name': token....
{ "repo_name": "bansalrajnikant/djime", "path": "djime/templatetags/statistics_navigation_tags.py", "copies": "1", "size": "2595", "license": "bsd-3-clause", "hash": 2417586755412758500, "line_mean": 46.2, "line_max": 164, "alpha_frac": 0.6647398844, "autogenerated": false, "ratio": 3.624301675977...
from django import template import datetime from wagtail.wagtailcore.models import Page from wagtail.wagtailcore.rich_text import LINK_HANDLERS from wagtail.wagtailimages.models import get_image_model try: from wagtail.wagtailimages.models import get_upload_to except ImportError: def get_upload_to(instance, pa...
{ "repo_name": "bgrace/wagtail-commons", "path": "wagtail_commons/core/templatetags/bootstrap_wagtail_tags.py", "copies": "1", "size": "3752", "license": "bsd-3-clause", "hash": -3943475327285083600, "line_mean": 29.016, "line_max": 113, "alpha_frac": 0.6407249467, "autogenerated": false, "ratio":...
from django import template import datetime import itertools from django.core.cache import cache import pickle from aspc.eatshop.models import Hours register = template.Library() @register.inclusion_tag("eatshop/hours_fragment.html") def format_hours(business): """ Return business hours information with early...
{ "repo_name": "theworldbright/mainsite", "path": "aspc/eatshop/templatetags/eatshop.py", "copies": "2", "size": "5100", "license": "mit", "hash": 1802536392629113000, "line_mean": 40.4634146341, "line_max": 144, "alpha_frac": 0.6123529412, "autogenerated": false, "ratio": 3.6770007209805335, "c...
from django import template import datetime import pytz # for time zone handleing register = template.Library() @register.tag(name="timePosted") def do_time_since(parser, token): try: # split_contents() knows not to split quoted strings. tag_name, date_to_format = token.split_contents() excep...
{ "repo_name": "agconti/stamped", "path": "stamped_project/stamped/templatetags/stamped_custom_tags.py", "copies": "1", "size": "2034", "license": "mit", "hash": 7907065560587322000, "line_mean": 37.3962264151, "line_max": 118, "alpha_frac": 0.6258603736, "autogenerated": false, "ratio": 3.9342359...
from django import template import datetime register = template.Library() """ register.filter('cut', cut) register.filter('lower', lower) register.tag('current_time', do_current_time) """ # Filters @register.filter(name='cut') # Replaces register.filter('cut', cut) def cut(value, arg): """Removes all values of ...
{ "repo_name": "fbreversg/django_playing", "path": "templating/templatetags/extras.py", "copies": "1", "size": "1273", "license": "mit", "hash": -2378324891384069600, "line_mean": 27.9318181818, "line_max": 91, "alpha_frac": 0.6881382561, "autogenerated": false, "ratio": 3.7551622418879056, "con...
from django import template import datetime register = template.Library() @register.filter(name='printHHMM') def printHHMM(value): '''takes a datetime.timedelta and prints it as HH:MM''' s=int(value.total_seconds()) if s<0: #so we round towards zero rather than towards -Infinity sign="-" s=...
{ "repo_name": "sleepers-anonymous/zscore", "path": "sleep/templatetags/datetime_utils.py", "copies": "1", "size": "1998", "license": "mit", "hash": 4460911975825501000, "line_mean": 26, "line_max": 101, "alpha_frac": 0.5570570571, "autogenerated": false, "ratio": 3, "config_test": false, "has...
from django import template import json from collections import OrderedDict import logging from .jsonenc import NoIndent, IndentingJSONEncoder logger = logging.getLogger(__name__) register = template.Library() def noindent_poly(val, key=None): if key and key == 'poly': return NoIndent(val) elif isins...
{ "repo_name": "crocs-muni/RTTWebInterface", "path": "ViewResults/templatetags/extras.py", "copies": "1", "size": "1511", "license": "mit", "hash": 1629133897026177300, "line_mean": 26.9814814815, "line_max": 85, "alpha_frac": 0.6598279285, "autogenerated": false, "ratio": 3.7034313725490198, "c...
from django import template import json from django.conf import settings register = template.Library() @register.simple_tag(takes_context=True) def get_admin_context(context): ctx = {'location':None, 'param1':None, 'param2':None, 'static':settings.STATIC_URL} try: context['app_list'] if len(co...
{ "repo_name": "mick-t/django-radmin-console", "path": "radmin/templatetags/radmin_extras.py", "copies": "1", "size": "1420", "license": "bsd-2-clause", "hash": 6582770857479830000, "line_mean": 28.5833333333, "line_max": 87, "alpha_frac": 0.5711267606, "autogenerated": false, "ratio": 3.848238482...
from django import template import json import ntpath register = template.Library() @register.filter(name='n3') def n3(filename): """ :param filename: :return: file name with suffix .n3 """ return filename.rsplit(".", 1)[0] + ".n3" def path_leaf(path): head, tail = ntpath.split(path) r...
{ "repo_name": "LinDA-tools/transformation", "path": "templatetags/modelview_tags.py", "copies": "1", "size": "8415", "license": "mit", "hash": -4005715018078864000, "line_mean": 28.3205574913, "line_max": 181, "alpha_frac": 0.5524658348, "autogenerated": false, "ratio": 3.5717317487266556, "con...
from django import template import locale from decimal import * locale.setlocale(locale.LC_ALL, '') register = template.Library() @register.filter() def currency(value): try: value = locale.currency(value, grouping=True) except: value = moneyfmt(Decimal(str(value))) return value # from ...
{ "repo_name": "nurey/disclosed", "path": "app/goat/templatetags/goat_filters.py", "copies": "1", "size": "2039", "license": "mit", "hash": 6707263062298617000, "line_mean": 30.3846153846, "line_max": 73, "alpha_frac": 0.5801863659, "autogenerated": false, "ratio": 3.654121863799283, "config_tes...
from django import template # import locale import math from decimal import Decimal register = template.Library() @register.filter def keyvalue(dict, key): try: return dict[key] except KeyError: return '' @register.filter def nicenumber(number): if number and number != 0: try: ...
{ "repo_name": "danst0/Portfolio", "path": "core/templatetags/filters.py", "copies": "1", "size": "1179", "license": "bsd-2-clause", "hash": -3261666608478809600, "line_mean": 22.137254902, "line_max": 64, "alpha_frac": 0.6166242578, "autogenerated": false, "ratio": 4.06551724137931, "config_tes...
from django import template import locale register = template.Library() @register.filter(name='calculaperct') def calculaperct(value1, value2): try: resultado = (float(value1) / float(value2) * 100) return resultado except: return 0 @register.filter(name='calculaUtilidad') def calculaU...
{ "repo_name": "CARocha/mapafinca", "path": "encuestas/templatetags/helpertags.py", "copies": "2", "size": "1899", "license": "mit", "hash": -4053700785535772000, "line_mean": 24.3333333333, "line_max": 86, "alpha_frac": 0.6429699842, "autogenerated": false, "ratio": 3.2517123287671232, "config_...
from django import template import locale register = template.Library() @register.filter def restar(value, arg): return int(value)-int(arg) @register.filter def total_dict(value): return sum(value.values()) @register.filter def total_per_key(value, arg): '''value es el dict y arg es el key del qu...
{ "repo_name": "ErickMurillo/ciat_plataforma", "path": "monitoreo/monitoreo/templatetags/tools.py", "copies": "3", "size": "1739", "license": "mit", "hash": 8910488557834756000, "line_mean": 25.3484848485, "line_max": 87, "alpha_frac": 0.6808510638, "autogenerated": false, "ratio": 3.0670194003527...
from django import template import markdown from let_me_app import models from django.utils.translation import gettext from django.utils import timezone register = template.Library() @register.filter def markdownify(text): # safe_mode governs how the function handles raw HTML return markdown.markdown(text, ...
{ "repo_name": "oleg-chubin/let_me_play", "path": "let_me_app/templatetags/let_me_app.py", "copies": "1", "size": "1165", "license": "apache-2.0", "hash": 6211793405338522000, "line_mean": 25.4772727273, "line_max": 62, "alpha_frac": 0.7278969957, "autogenerated": false, "ratio": 3.883333333333333...
from django import template import markdown import datetime from pytz import timezone, UTC from django.conf import settings # A pytz.timezone object representing the Django project time zone # Use TZ.localize(mydate) instead of tzinfo=TZ to ensure that DST rules # are respected register = template.Library() @regist...
{ "repo_name": "akshaybabloo/gollahalli-com", "path": "gollahalli_cms/viewer/templatetags/custom_tags.py", "copies": "1", "size": "1332", "license": "mit", "hash": -3213775696383095000, "line_mean": 24.6153846154, "line_max": 76, "alpha_frac": 0.6719219219, "autogenerated": false, "ratio": 3.31343...
from django import template import math from django.contrib.humanize.templatetags.humanize import intcomma from django.template.defaultfilters import floatformat from django.utils.safestring import mark_safe SCALES = [ None, 'Thousands', 'Millions', 'Billions', 'Trillions' ] register = template.L...
{ "repo_name": "OpenSourcePolicyCenter/webapp-public", "path": "webapp/apps/taxbrain/templatetags/results.py", "copies": "2", "size": "1426", "license": "mit", "hash": 2310835780587908000, "line_mean": 19.9705882353, "line_max": 66, "alpha_frac": 0.6486676017, "autogenerated": false, "ratio": 3.50...
from django import template import math from django.contrib.humanize.templatetags.humanize import intcomma from django.template.defaultfilters import floatformat SCALES = [ None, 'Thousands', 'Millions', 'Billions', 'Trillions' ] register = template.Library() @register.filter def scales_of_units...
{ "repo_name": "zrisher/webapp-public", "path": "webapp/apps/taxbrain/templatetags/results.py", "copies": "4", "size": "1278", "license": "mit", "hash": -2106718678632484000, "line_mean": 21.0344827586, "line_max": 66, "alpha_frac": 0.6478873239, "autogenerated": false, "ratio": 3.5013698630136987...
from django import template import math from django.utils.safestring import mark_safe from aspc.settings import STATIC_URL from aspc.courses.models import POSSIBLE_GRADES register = template.Library() @register.filter def star(rating): num_star_on = int(math.floor(rating)) num_star_half = int(round(rating)) -...
{ "repo_name": "aspc/mainsite", "path": "aspc/courses/templatetags/stars.py", "copies": "1", "size": "1269", "license": "mit", "hash": -8588318706473924000, "line_mean": 36.3529411765, "line_max": 94, "alpha_frac": 0.6619385343, "autogenerated": false, "ratio": 3.0214285714285714, "config_test":...
from django import template import math import time BILLION = math.pow(10, 9) MILLION = math.pow(10, 6) THOUSAND = math.pow(10, 3) register = template.Library() @register.filter def percentage(value): return format(value, "0.2%") @register.filter def short_quantity(value): if value >= BILLION: re...
{ "repo_name": "xgi/aliendb", "path": "web/aliendb/apps/analytics/templatetags/stats_tags.py", "copies": "1", "size": "1507", "license": "bsd-3-clause", "hash": 4004483172874322000, "line_mean": 26.4, "line_max": 72, "alpha_frac": 0.5640345056, "autogenerated": false, "ratio": 3.22008547008547, ...
from django import template import misaka as m from pygments import highlight from pygments.formatters import ClassNotFound, HtmlFormatter from pygments.lexers import get_lexer_by_name register = template.Library() class MisakaRenderer(m.HtmlRenderer): def blockcode(self, text, lang): try: le...
{ "repo_name": "chiehtu/django-misaka", "path": "django_misaka/templatetags/markdown.py", "copies": "1", "size": "1431", "license": "mit", "hash": -8032341031878840000, "line_mean": 27.62, "line_max": 79, "alpha_frac": 0.6477987421, "autogenerated": false, "ratio": 3.7757255936675462, "config_te...
from django import template import os.path from django.utils.translation import gettext_lazy from devilry.devilry_markup import parse_markdown register = template.Library() @register.filter("devilry_truncatefileextension") def devilry_truncatefileextension(value, max_length): """ Args: value: file...
{ "repo_name": "devilry/devilry-django", "path": "devilry/devilry_group/templatetags/devilry_group_tags.py", "copies": "1", "size": "3122", "license": "bsd-3-clause", "hash": 4583390059254407000, "line_mean": 28.7333333333, "line_max": 105, "alpha_frac": 0.6233183857, "autogenerated": false, "rati...
from django import template import posts.md import md5, re import datetime register = template.Library() @register.tag(name='markdown') def do_markdown(parser, token): nodelist = parser.parse(('endmarkdown',)) parser.delete_first_token() return MarkdownNode(nodelist, safe=False) @register.tag(name='userm...
{ "repo_name": "benkuhn/benkuhn.net", "path": "posts/templatetags/md.py", "copies": "1", "size": "2078", "license": "mit", "hash": -8329155416844784000, "line_mean": 27.4657534247, "line_max": 56, "alpha_frac": 0.6337824832, "autogenerated": false, "ratio": 3.3408360128617365, "config_test": fal...
from django import template import random register = template.Library() @register.filter def shuffle(arg): aux = list(arg)[:] random.shuffle(aux) return aux @register.assignment_tag(takes_context=True) def get_request_parameters(context, exclude=None): """Returns a string with all the request param...
{ "repo_name": "kingsdigitallab/kdl-django", "path": "cms/templatetags/cms_tags.py", "copies": "1", "size": "2265", "license": "mit", "hash": -278838461996839740, "line_mean": 31.8260869565, "line_max": 78, "alpha_frac": 0.6609271523, "autogenerated": false, "ratio": 3.8784246575342465, "config_...
from django import template import re from django.template.defaultfilters import date as date_filter from datetime import date from dataloaderinterface.models import SiteRegistration register = template.Library() @register.filter(name='get_site_sensor') def get_site_sensor(site, variable_code): if not isinstance...
{ "repo_name": "ODM2/ODM2WebSDL", "path": "src/dataloaderinterface/templatetags/site.py", "copies": "1", "size": "1964", "license": "bsd-3-clause", "hash": 4087009230820747000, "line_mean": 25.5405405405, "line_max": 134, "alpha_frac": 0.6878818737, "autogenerated": false, "ratio": 3.5644283121597...
from django import template import re from citations.models import Reference as R register = template.Library() class CiteNode(template.Node): def __init__(self, citation): self.citation = citation self.citations = [x.replace("\"", "").replace("'", "") for x in citation.split(" ")] def rend...
{ "repo_name": "will-hart/django-citations", "path": "citations/templatetags/citation_tags.py", "copies": "1", "size": "2281", "license": "mit", "hash": -4215449895857980400, "line_mean": 29.0131578947, "line_max": 102, "alpha_frac": 0.6001753617, "autogenerated": false, "ratio": 3.939550949913644...