text
stringlengths
0
1.05M
meta
dict
from django import template register = template.Library() @register.simple_tag def geturl(url, timeout=None): """ https://djangosnippets.org/snippets/719/ Usage: {% geturl url [timeout] %} Examples: {% geturl "http://example.com/path/to/content/" %} {% geturl object.urlfield 1 %} """...
{ "repo_name": "registerguard/django-dox", "path": "dox/templatetags/get_url_content.py", "copies": "1", "size": "1135", "license": "apache-2.0", "hash": 4721662520205818000, "line_mean": 30.5277777778, "line_max": 125, "alpha_frac": 0.6334801762, "autogenerated": false, "ratio": 4.486166007905139...
from django import template register = template.Library() @register.simple_tag def jquery_upload_display_templates(): return """ <!-- The template to display files available for upload --> <script id="template-upload" type="text/x-tmpl"> {% for (var i=0, file; file=o.files[i]; i++) { %} <tr class="template-up...
{ "repo_name": "bcfuchs/citizengrid", "path": "dashboard/citizengrid/templatetags/jquery_upload_display_tags.py", "copies": "2", "size": "3463", "license": "bsd-3-clause", "hash": 478602426034952770, "line_mean": 37.9101123596, "line_max": 236, "alpha_frac": 0.4550967369, "autogenerated": false, "...
from django import template register = template.Library() @register.simple_tag def next_in_gallery(photo, gallery): next = photo.get_next_in_gallery(gallery) if next: return '<a title="%s" href="%s"><img src="%s"/></a>' % (next.title, next.get_absolute_url(), next.get_thumbnail_url()) return "" ...
{ "repo_name": "garyp/djwed", "path": "photologue/templatetags/photologue_tags.py", "copies": "1", "size": "1056", "license": "mit", "hash": 6215515030377643000, "line_mean": 33.064516129, "line_max": 126, "alpha_frac": 0.6278409091, "autogenerated": false, "ratio": 3.087719298245614, "config_te...
from django import template register = template.Library() @register.simple_tag def upload_js(): return """ <script id="template-upload" type="text/x-jquery-tmpl"> <tr class="template-upload{{if error}} ui-state-error{{/if}}"> <td class="preview"></td> <td class="name">${name}</...
{ "repo_name": "aih/pdf2html", "path": "fileupload/templatetags/upload_tags.py", "copies": "2", "size": "3152", "license": "mit", "hash": 5918129236973067000, "line_mean": 44.6811594203, "line_max": 91, "alpha_frac": 0.4559010152, "autogenerated": false, "ratio": 4.4582743988684586, "config_test...
from django import template register = template.Library() @register.simple_tag def upload_js(): return """ <!-- The template to display files available for djupload --> <script id="template-djupload" type="text/x-tmpl"> {% for (var i=0, file; file=o.files[i]; i++) { %} <tr class="template-djupload fade"> ...
{ "repo_name": "savioabuga/django-upload", "path": "djupload/templatetags/upload_tags.py", "copies": "1", "size": "3461", "license": "mit", "hash": -5291985413567500000, "line_mean": 37.032967033, "line_max": 198, "alpha_frac": 0.4524703843, "autogenerated": false, "ratio": 3.4889112903225805, "...
from django import template register = template.Library() @register.simple_tag def upload_js(): return """ <!-- The template to display files available for upload --> <script id="template-upload" type="text/x-tmpl"> {% for (var i=0, file; file=o.files[i]; i++) { %} <tr class="template-upload fade"> {%...
{ "repo_name": "skmezanul/seahub", "path": "seahub/base/templatetags/upload_tags.py", "copies": "1", "size": "2410", "license": "apache-2.0", "hash": -7366023037051134000, "line_mean": 40.5517241379, "line_max": 175, "alpha_frac": 0.5058091286, "autogenerated": false, "ratio": 3.403954802259887, ...
from django import template register = template.Library() @register.simple_tag(takes_context = True) def query_replace(context, field, value): """ Gets HttpRequest from context, returns querystring with updated field-value. django.core.context_processors.request places a request in the default contex...
{ "repo_name": "bartscheers/banana", "path": "banana/templatetags/query_replace.py", "copies": "2", "size": "1146", "license": "bsd-3-clause", "hash": 8051506591922086000, "line_mean": 31.7428571429, "line_max": 99, "alpha_frac": 0.6980802792, "autogenerated": false, "ratio": 3.9653979238754324, ...
from django import template register = template.Library() @register.tag(name="jsrequire") def jsrequire(parse, token): """ Syntax:: {% jsrequire path_relative_to_STATIC_URL|url %} Examples:: {% jsrequire /formcheckin.js %} {% jsrequire /jqueryui/accordian.js %}...
{ "repo_name": "granteagon/okonomi", "path": "okonomi/templatetags/okonomi.py", "copies": "1", "size": "1587", "license": "mit", "hash": 4565719844286834000, "line_mean": 30.1176470588, "line_max": 119, "alpha_frac": 0.595463138, "autogenerated": false, "ratio": 3.9282178217821784, "config_test"...
from django import template register = template.Library() @register.tag def sass(parser, token): nodelist = parser.parse(('endsass'),) parser.delete_first_token(); return SassNode(nodelist) class SassNode(template.Node): def __init__(self, nodelist): self.nodelist = nodelist def render(self, context): outp...
{ "repo_name": "lmanzurv/sassy_coffee", "path": "sassy_coffee/templatetags/sassy_coffee.py", "copies": "1", "size": "1206", "license": "apache-2.0", "hash": -4350046976542792700, "line_mean": 24.1458333333, "line_max": 47, "alpha_frac": 0.6749585406, "autogenerated": false, "ratio": 3.6, "config...
from django import template register = template.Library() sort_cycles = { u'id': [u'id', u'-id'], u'status': [u'status', u'-status'], u'name': [u'name', u'last_name', u'-name', u'-last_name'], u'payer_name': [u'payer_name', u'-payer_name'], u'amount': [u'amount', u'-amount'], u'reference_numbe...
{ "repo_name": "joneskoo/sikteeri", "path": "membership/templatetags/sorturl.py", "copies": "1", "size": "1949", "license": "mit", "hash": -44720539390802780, "line_mean": 33.1929824561, "line_max": 79, "alpha_frac": 0.5484864033, "autogenerated": false, "ratio": 3.3836805555555554, "config_test...
from django import template register = template.Library() @register.tag(name='dict_get') def do_dict(parser, token): try: tag_name, dictname, key = token.contents.split(None, 2) except ValueError: raise template.TemplateSyntaxError("'dict_get' node requires a dict and a key name.") # nodeli...
{ "repo_name": "callowayproject/django-stories", "path": "stories/templatetags/stories_admin.py", "copies": "1", "size": "1802", "license": "apache-2.0", "hash": -6598703666131331000, "line_mean": 39.0444444444, "line_max": 121, "alpha_frac": 0.614872364, "autogenerated": false, "ratio": 3.8016877...
from django import template register = template.Library() # {% video self.intro_video extra_att extra_att %} @register.tag(name="video") def video(parser, token): template_params = token.split_contents()[1:] # Everything after 'video' video_expr = template_params[0] extra_attrs = {} # Everyting af...
{ "repo_name": "takeflight/wagtailvideos", "path": "wagtailvideos/templatetags/wagtailvideos_tags.py", "copies": "1", "size": "1091", "license": "bsd-3-clause", "hash": 6141855378825870000, "line_mean": 29.3055555556, "line_max": 106, "alpha_frac": 0.6278643446, "autogenerated": false, "ratio": 4....
from django import template try: from django.core.urlresolvers import reverse except ImportError: from django.urls import reverse from django.utils.translation import ugettext as _ from .. import notify_settings from ..utils import render_notification register = template.Library() class RenderNotifications...
{ "repo_name": "v1k45/django-notify-x", "path": "notify/templatetags/notification_tags.py", "copies": "1", "size": "6165", "license": "mit", "hash": -1740869549911864600, "line_mean": 33.8305084746, "line_max": 81, "alpha_frac": 0.6347120843, "autogenerated": false, "ratio": 4.378551136363637, "...
from django import template try: import json as _json except ImportError: import django.utils.simplejson as _json register = template.Library() class JsonNode(template.Node): def __init__(self, variable, or_null): self.variable = variable self.or_null = or_null def render(self, cont...
{ "repo_name": "ddanier/django_ajax", "path": "django_ajax/templatetags/django_ajax_tags.py", "copies": "1", "size": "2908", "license": "bsd-3-clause", "hash": 9101969994495923000, "line_mean": 30.2688172043, "line_max": 95, "alpha_frac": 0.5949105915, "autogenerated": false, "ratio": 3.8773333333...
from django import template try: # noinspection PyUnresolvedReferences from django.db.models.loading import get_model except ImportError: # noinspection PyUnresolvedReferences from django.db.models import get_model from django.core.cache import cache register = template.Library() Chunk = get_model('...
{ "repo_name": "sociateru/chunks", "path": "chunks/templatetags/chunks.py", "copies": "2", "size": "1631", "license": "bsd-3-clause", "hash": -2814647512825145300, "line_mean": 30.3653846154, "line_max": 103, "alpha_frac": 0.6235438381, "autogenerated": false, "ratio": 3.828638497652582, "config...
from django import template # used for registering custom template tags register = template.Library() @register.filter(name='access') def access(value, key): """Gets a specified key out of a specified collection.""" # if the collection is a list and the key is an index, make sure we don't go out of bounds ...
{ "repo_name": "PhoenixWright/django-bdd", "path": "django_bdd/templatetags/django_bdd_tags.py", "copies": "1", "size": "1560", "license": "apache-2.0", "hash": 7317259183950304000, "line_mean": 32.1914893617, "line_max": 94, "alpha_frac": 0.6467948718, "autogenerated": false, "ratio": 4.16, "co...
from django import template register = template.Library() from articles.models import ArticleTranslation, Linker from django.db.models import Q from django.utils.translation import get_language import datetime @register.inclusion_tag('articles/articles_banner.html', takes_context=True) def articles_banner(context, lim...
{ "repo_name": "platypus-creation/django-articles", "path": "articles/templatetags/articles_banner.py", "copies": "1", "size": "1821", "license": "mit", "hash": -8184963880446800000, "line_mean": 42.3571428571, "line_max": 148, "alpha_frac": 0.7342119714, "autogenerated": false, "ratio": 4.0829596...
from django import template register = template.Library() from decimal import * from django.contrib.auth.models import User as auth_user from shop.models import Category, TreeCash, UserProfile, Item, Discount @register.filter() def add_class(field, css): return field.as_widget(attrs={"class":css}) @register.sim...
{ "repo_name": "Zex0n/django-simple-cms", "path": "shop/templatetags/cms_tags.py", "copies": "1", "size": "9338", "license": "mit", "hash": -7992108326871587000, "line_mean": 29.3006535948, "line_max": 133, "alpha_frac": 0.5927523727, "autogenerated": false, "ratio": 3.582689335394127, "config_t...
from django import template register = template.Library() from decimal import * @register.filter() def add_class(field, css): return field.as_widget(attrs={"class":css}) @register.simple_tag(takes_context = True) def cookie(context, cookie_name): # could feed in additional argument to use as default value req...
{ "repo_name": "Zex0n/django-simple-cms", "path": "shop/templatetags/cms_tags-old.py", "copies": "1", "size": "3277", "license": "mit", "hash": -6754162313254518000, "line_mean": 27.0085470085, "line_max": 129, "alpha_frac": 0.5761367104, "autogenerated": false, "ratio": 3.75802752293578, "confi...
from django import template register = template.Library() from django.conf import settings import os hashlib = False try: from hashlib import md5 from hashlib import sha1 hashlib = True except: import md5 import sha def assetmd5(value): if hashlib: h = md5(value) else: h = md5.new(value...
{ "repo_name": "clintecker/django-clint-helpers", "path": "clint_helpers/templatetags/filehashes.py", "copies": "1", "size": "1651", "license": "mit", "hash": 4684262219139800000, "line_mean": 32.04, "line_max": 107, "alpha_frac": 0.6202301635, "autogenerated": false, "ratio": 3.7184684684684686, ...
from django import template register = template.Library() from plataforma.models import Categoria, Articulo ## tag que recibe una variable y renderiza un pequeno template html @register.inclusion_tag('template_tags/categorias_sidebar.html') def show_categorias(count=6): categorias= Categoria.objects.all().order_by...
{ "repo_name": "SurielRuano/Orientador-Legal", "path": "plataforma/templatetags/categorias_inclusion_tag.py", "copies": "1", "size": "1199", "license": "mit", "hash": -229899208363217760, "line_mean": 28.243902439, "line_max": 68, "alpha_frac": 0.7623019183, "autogenerated": false, "ratio": 2.9101...
from django import template register = template.Library() import re class RenderDataNode(template.Node): def __init__(self, content): self.content = template.Variable(content) def render(self, context): try: actual_content = self.content.resolve(context) if actual_c...
{ "repo_name": "robertzp/minicms", "path": "minicms/templatetags/render_content.py", "copies": "1", "size": "1040", "license": "mit", "hash": 4114400447993836000, "line_mean": 36.1428571429, "line_max": 100, "alpha_frac": 0.5721153846, "autogenerated": false, "ratio": 4.581497797356828, "config_...
from django import template register = template.Library() #import re #re_nobr = re.compile("<br />") register = template.Library() #def do_nobr(parser, token): # nodelist = parser.parse(('endnobr',)) # parser.delete_first_token() # return NobrNode(nodelist) #class NobrNode(template.Node): # def ...
{ "repo_name": "carquois/blobon", "path": "blobon/punns/templatetags/blog_tags.py", "copies": "1", "size": "1039", "license": "mit", "hash": -2607981115517891600, "line_mean": 27.8611111111, "line_max": 65, "alpha_frac": 0.6448508181, "autogenerated": false, "ratio": 3.395424836601307, "config_t...
from django import template register = template.Library() class IfGtNode(template.Node): child_nodelists = ('nodelist_true', 'nodelist_false') def __init__(self, var1, var2, nodelist_true, nodelist_false, negate): self.var1, self.var2 = var1, var2 self.nodelist_true, self.nodelist_false = nodel...
{ "repo_name": "luminousflux/lflux", "path": "lfluxproject/ltools/templatetags/ifgt.py", "copies": "1", "size": "1627", "license": "mit", "hash": 920172943660444700, "line_mean": 32.8958333333, "line_max": 87, "alpha_frac": 0.6318377382, "autogenerated": false, "ratio": 3.552401746724891, "confi...
from django import template register = template.Library() class MessagesNode(template.Node): """ Outputs grouped Django Messages Framework messages in separate lists sorted by level. """ def __init__(self, messages): self.messages = messages def render(self, context): try: ...
{ "repo_name": "mplaine/nintendo-gw-web-shop", "path": "src/nintendo_gw_web_shop/webshop/templatetags/messages.py", "copies": "1", "size": "1546", "license": "mit", "hash": 4112395830680012000, "line_mean": 35.8333333333, "line_max": 97, "alpha_frac": 0.5142302717, "autogenerated": false, "ratio":...
from django import template register = template.Library() class MessagesNode(template.Node): """ Outputs grouped Django Messages Framework messages in separate lists sorted by level. """ def __init__(self, messages): self.messages = messages def render(self, context): ...
{ "repo_name": "linkedin/indextank-service", "path": "storefront/templatetags/messages.py", "copies": "1", "size": "1517", "license": "apache-2.0", "hash": -1293193469625354800, "line_mean": 33.4772727273, "line_max": 78, "alpha_frac": 0.5102175346, "autogenerated": false, "ratio": 4.6391437308868...
from django import template register = template.Library() def boundary(value, arg): """Defines a boundary for an integer. If the value of the integer is higher than the boundary, then the boundary is returned instead. Example: {{ comment.depth|:"4" }} will return 4 if the value of comment.depth is 4 ...
{ "repo_name": "lethain/lifeflow", "path": "templatetags/lifeflow.py", "copies": "1", "size": "1149", "license": "mit", "hash": 8919344451946132000, "line_mean": 25.1136363636, "line_max": 71, "alpha_frac": 0.6083550914, "autogenerated": false, "ratio": 3.670926517571885, "config_test": false, ...
from django import template register = template.Library() from apps.people.models import Group @register.inclusion_tag('people/partials/contexted_participants.html') def contextual_participants(release, context): participants = release.participants if context.identifier == 'idol': try: (p...
{ "repo_name": "hello-base/web", "path": "apps/merchandise/music/templatetags/music_tags.py", "copies": "1", "size": "2210", "license": "apache-2.0", "hash": 496075490142348800, "line_mean": 36.4576271186, "line_max": 82, "alpha_frac": 0.6615384615, "autogenerated": false, "ratio": 4.4827586206896...
from django import template register = template.Library() from blog.models import Article, Category, ArticleTranslation from blog.utils import Year, Month from blog import settings as blog_settings try: from tagging.models import Tag except: Tag = None @register.inclusion_tag('blog/includes/_nav.html') def b...
{ "repo_name": "Cotidia/cotidia-blog", "path": "blog/templatetags/blog_tags.py", "copies": "1", "size": "3067", "license": "mit", "hash": -8012767792915446000, "line_mean": 38.3205128205, "line_max": 167, "alpha_frac": 0.7029670688, "autogenerated": false, "ratio": 3.76319018404908, "config_test...
from django import template register = template.Library() from cms.models import Page, CMSPlugin from contacts_and_people.models import Person, Entity, Membership, Building from news_and_events.models import NewsArticle, Event from django.contrib.auth.models import User from django.contrib.admin.models import LogEntry...
{ "repo_name": "evildmp/Arkestra", "path": "housekeeping/templatetags/statistics_tags.py", "copies": "2", "size": "1530", "license": "bsd-2-clause", "hash": -908203571219956700, "line_mean": 33.7727272727, "line_max": 93, "alpha_frac": 0.6562091503, "autogenerated": false, "ratio": 3.9740259740259...
from django import template register = template.Library() from django.contrib.auth.models import User from ..models import Project, Technology, StatusUpdate @register.inclusion_tag('projects/show_project_list.html', takes_context=True) def show_project_list(context): project_list = [ { 'id...
{ "repo_name": "develersrl/projectboard", "path": "projects/templatetags/projects.py", "copies": "1", "size": "1676", "license": "mit", "hash": -5273657213299708000, "line_mean": 34.6808510638, "line_max": 86, "alpha_frac": 0.7124105012, "autogenerated": false, "ratio": 3.809090909090909, "confi...
from django import template register = template.Library() from django.template.defaultfilters import urlencode @register.simple_tag() def _page_link(instance, page): return instance.get_absolute_url(page=page) @register.inclusion_tag('core/pagination.html') def show_pagination(pages, instance, range_width=3): ...
{ "repo_name": "codefisher/djangopress", "path": "djangopress/core/templatetags/show_pagination.py", "copies": "1", "size": "1972", "license": "mit", "hash": 2389341655394261500, "line_mean": 33.0172413793, "line_max": 210, "alpha_frac": 0.6465517241, "autogenerated": false, "ratio": 3.42361111111...
from django import template register = template.Library() from django.template import Node, TemplateSyntaxError, Variable from django.core.mail import mail_admins try: from hashlib import md5 except ImportError: from md5 import md5 import struct from urlparse import urljoin from os import remove, rename from ...
{ "repo_name": "akaihola/django-cairo-text", "path": "cairotext/templatetags/cairotext.py", "copies": "1", "size": "12348", "license": "bsd-3-clause", "hash": -8640875366088102000, "line_mean": 40.4362416107, "line_max": 91, "alpha_frac": 0.6145934564, "autogenerated": false, "ratio": 3.2031128404...
from django import template register = template.Library() import logging logger = logging.getLogger(__name__) @register.filter def format_lease_state(value, role): """format the transaction status code""" labels = { # 0: { # 'status': 'need set price', # 'buyer': "Please wait...
{ "repo_name": "shawiz/idlebook", "path": "idlebook/account/templatetags/state_format.py", "copies": "1", "size": "15751", "license": "mit", "hash": 3465122821196502000, "line_mean": 40.1253263708, "line_max": 170, "alpha_frac": 0.5308869278, "autogenerated": false, "ratio": 4.187981919702207, "...
from django import template register = template.Library() class UrlNode(template.Node): def __init__(self, named_url = None, action = None, extras = []): self.named_url = named_url self.action = action self.extras = extras def render(self, context): resolved_extras = [] ...
{ "repo_name": "zeraien/django-url-framework", "path": "django_url_framework/templatetags/url_framework.py", "copies": "1", "size": "2897", "license": "mit", "hash": -6972527609130098000, "line_mean": 39.2361111111, "line_max": 132, "alpha_frac": 0.6123576113, "autogenerated": false, "ratio": 4.13...
from django import template register = template.Library() @register.filter("mongo_id") def mongo_id(value): # Retrieve _id value if type(value) == type({}): if value.has_key('_id'): #should be "in", not "has_key" value = value['_id'] # Return value return unicode(value) from djan...
{ "repo_name": "abegong/textbadger", "path": "textbadger/tb_app/templatetags/tb_app_tags.py", "copies": "1", "size": "1892", "license": "mit", "hash": -8284048030276244000, "line_mean": 29.0317460317, "line_max": 74, "alpha_frac": 0.5570824524, "autogenerated": false, "ratio": 3.6809338521400776, ...
from django import template register=template.Library() @register.filter def choice(value, choices): ''' Get the choice displayable value Example Given: class Model(models.model): STATUS_DRAFT = 0 STATUS_PENDDING = 1 STATUS_APPROVING = 2 STATUS_CONFIRMED ...
{ "repo_name": "kensonman/webframe", "path": "templatetags/choice.py", "copies": "1", "size": "1202", "license": "apache-2.0", "hash": -498419012487917440, "line_mean": 28.3170731707, "line_max": 118, "alpha_frac": 0.5565723794, "autogenerated": false, "ratio": 3.7917981072555205, "config_test":...
from django import template register=template.Library() @register.filter def format(value, fmt='{}'): ''' @Deprecated Use format instead Format the string according to [Python String Formatting](https://docs.python.org/3/library/string.html#string-formatting) syntax. USAGE ===== Given variable pi=3...
{ "repo_name": "kensonman/webframe", "path": "templatetags/stringformat.py", "copies": "1", "size": "1256", "license": "apache-2.0", "hash": 214737553286725570, "line_mean": 32.0526315789, "line_max": 133, "alpha_frac": 0.6042993631, "autogenerated": false, "ratio": 3.322751322751323, "config_te...
from django import template register=template.Library() @register.filter def format(value, fmt='{}'): ''' Format the variable according to [Python3 String Formatting](https://docs.python.org/3/library/string.html#string-formatting) syntax. USAGE ===== Given variable pi=3.141516: pi|format:'{0:0....
{ "repo_name": "kensonman/webframe", "path": "templatetags/format.py", "copies": "1", "size": "1062", "license": "apache-2.0", "hash": 101215866972222780, "line_mean": 34.4, "line_max": 136, "alpha_frac": 0.5809792844, "autogenerated": false, "ratio": 3.1701492537313434, "config_test": false, ...
from django import template register = template.Library() @register.filter def lower(value): """Converts a string into all lowercase""" return value.lower() @register.filter def to_admin_string(admin_list): admin_names = "" if len(admin_list) > 0: name_array = ["","","","","", ""] ...
{ "repo_name": "LibraryOfCongress/gazetteer", "path": "gazetteer/templatetags/detail_extras.py", "copies": "1", "size": "1281", "license": "mit", "hash": 166308237563630200, "line_mean": 34.5833333333, "line_max": 67, "alpha_frac": 0.5027322404, "autogenerated": false, "ratio": 3.5386740331491713,...
from django import template register = template.Library() @register.simple_tag def make_urn(item): from django.conf import settings agency = getattr(settings, 'ARISTOTLE_DDI_AGENCY', "example.com") if item.version: version = item.version else: version = "0.0.1" urn = 'urn:ddi:%s:%...
{ "repo_name": "LegoStormtroopr/aristotle-ddi-utils", "path": "aristotle_ddi_utils/utils.py", "copies": "1", "size": "1141", "license": "bsd-2-clause", "hash": 3237011120454238000, "line_mean": 24.9545454545, "line_max": 69, "alpha_frac": 0.6170026293, "autogenerated": false, "ratio": 3.4059701492...
from django import template try: from django.template import Node, Token, TemplateSyntaxError except: from django.template.base import Node, Token, TemplateSyntaxError from django.template import resolve_variable from django.template.defaultfilters import stringfilter from django.templatetags import future fro...
{ "repo_name": "gonnado/django-localeurl", "path": "localeurl/templatetags/localeurl_tags.py", "copies": "1", "size": "2401", "license": "mit", "hash": -3220705976421790700, "line_mean": 28.6419753086, "line_max": 79, "alpha_frac": 0.661391087, "autogenerated": false, "ratio": 3.8354632587859423, ...
from django import template try: from django.template import Node, Token, TemplateSyntaxError except: from django.template.base import Node, Token, TemplateSyntaxError try: from django.template import resolve_variable except ImportError: from django.template.base import Variable from django.template.de...
{ "repo_name": "eugena/django-localeurl", "path": "localeurl/templatetags/localeurl_tags.py", "copies": "1", "size": "2645", "license": "mit", "hash": 6401081053373059000, "line_mean": 27.75, "line_max": 79, "alpha_frac": 0.6601134216, "autogenerated": false, "ratio": 3.889705882352941, "config_...
from django import template try: from django.template import TemplateSyntaxError, Node, NodeList except ImportError: from django.template.base import TemplateSyntaxError, Node, NodeList from dolphin import flipper register = template.Library() class IfActiveNode(Node): child_nodelists = ('nodelist_true'...
{ "repo_name": "coxmediagroup/dolphin", "path": "dolphin/templatetags/dolphin_tags.py", "copies": "1", "size": "2101", "license": "mit", "hash": -3725306769320517000, "line_mean": 30.3582089552, "line_max": 79, "alpha_frac": 0.6301761066, "autogenerated": false, "ratio": 3.778776978417266, "conf...
from django import template try: from django.urls import reverse except ImportError: # For Django < 1.10 from django.core.urlresolvers import reverse from django.template.loader import render_to_string # Issue 182: six no longer included with Django 3.0 try: from django.utils import six except ImportErr...
{ "repo_name": "ad-m/django-avatar", "path": "avatar/templatetags/avatar_tags.py", "copies": "4", "size": "3479", "license": "bsd-3-clause", "hash": 1891902675824016600, "line_mean": 28.735042735, "line_max": 79, "alpha_frac": 0.6401264731, "autogenerated": false, "ratio": 3.689289501590668, "co...
from django import template try: from django.urls import reverse except ImportError: from django.core.urlresolvers import reverse register = template.Library() @register.tag def masquerade_link(parser, token): return MasqueradeLinkNode() class MasqueradeLinkNode(template.Node): def __init__(self): ...
{ "repo_name": "erikcw/django-masquerade", "path": "masquerade/templatetags/masquerade.py", "copies": "1", "size": "1536", "license": "apache-2.0", "hash": -8799582749679967000, "line_mean": 24.6, "line_max": 72, "alpha_frac": 0.5755208333, "autogenerated": false, "ratio": 4.401146131805158, "co...
from django import template try: import simplejson as json except ImportError as e: import json from knockout_modeler.ko import ko, ko_data, ko_model, ko_bindings, get_fields register = template.Library() def knockout(values): """ Knockoutify a QuerySet! """ if not values: return '' ...
{ "repo_name": "Miserlou/django-knockout-modeler", "path": "knockout_modeler/templatetags/knockout.py", "copies": "1", "size": "1266", "license": "mit", "hash": -9065161567123554000, "line_mean": 17.0857142857, "line_max": 78, "alpha_frac": 0.6050552923, "autogenerated": false, "ratio": 3.44959128...
from django import template from django.conf import settings from django.contrib.flatpages.models import FlatPage from django.contrib.sites.shortcuts import get_current_site register = template.Library() class FlatpageNode(template.Node): def __init__(self, context_name, starts_with=None, user=None): sel...
{ "repo_name": "letouriste001/SmartForest_2.0", "path": "python3.4Smartforest/lib/python3.4/site-packages/django/contrib/flatpages/templatetags/flatpages.py", "copies": "1", "size": "3632", "license": "mit", "hash": 4447990662828111000, "line_mean": 34.9603960396, "line_max": 74, "alpha_frac": 0.61729...
from django import template from django.contrib.admin.models import LogEntry register = template.Library() class AdminLogNode(template.Node): def __init__(self, limit, varname, user): self.limit, self.varname, self.user = limit, varname, user def __repr__(self): return "<GetAdminLog Node>" ...
{ "repo_name": "letouriste001/SmartForest_2.0", "path": "python3.4Smartforest/lib/python3.4/site-packages/django/contrib/admin/templatetags/log.py", "copies": "1", "size": "2080", "license": "mit", "hash": -5114337540191162000, "line_mean": 34.2542372881, "line_max": 106, "alpha_frac": 0.6235576923, ...
from django import template from django.contrib.admin.utils import quote from django.core.urlresolvers import Resolver404, get_script_prefix, resolve from django.utils.http import urlencode from django.utils.six.moves.urllib.parse import parse_qsl, urlparse, urlunparse register = template.Library() @register.filter ...
{ "repo_name": "letouriste001/SmartForest_2.0", "path": "python3.4Smartforest/lib/python3.4/site-packages/django/contrib/admin/templatetags/admin_urls.py", "copies": "1", "size": "1812", "license": "mit", "hash": 4190813021528770000, "line_mean": 31.9454545455, "line_max": 93, "alpha_frac": 0.67163355...
from django import template from django.utils.encoding import iri_to_uri from django.utils.six.moves.urllib.parse import urljoin register = template.Library() class PrefixNode(template.Node): def __repr__(self): return "<PrefixNode for %r>" % self.name def __init__(self, varname=None, name=None): ...
{ "repo_name": "letouriste001/SmartForest_2.0", "path": "python3.4Smartforest/lib/python3.4/site-packages/django/templatetags/static.py", "copies": "1", "size": "4052", "license": "mit", "hash": 5605556771698643000, "line_mean": 25.3116883117, "line_max": 116, "alpha_frac": 0.5866238894, "autogenera...
from django import template from blogengine.models import Category, Post import re import calendar, datetime from django.template import Context register = template.Library() class CategoriesNode(template.Node): def __init__(self, var_name): self.var_name = var_name def render(self, context): cate...
{ "repo_name": "EricShiGit/personalblog", "path": "blogengine/templatetags/blog.py", "copies": "1", "size": "2745", "license": "mit", "hash": -8231862299924386000, "line_mean": 29.9186046512, "line_max": 99, "alpha_frac": 0.604007286, "autogenerated": false, "ratio": 3.7044534412955468, "config_...
from django import template from datetime import date, timedelta from league.models import Schedule, Season, Team, Standings import datetime from django.db.models import Q register = template.Library() @register.simple_tag def pct(won, matches): try: win_pct = float(won)/float(matches) ...
{ "repo_name": "mgawrys1/django-league", "path": "templatetags/league_tags.py", "copies": "1", "size": "2060", "license": "mit", "hash": 6231124602284248000, "line_mean": 32.4, "line_max": 135, "alpha_frac": 0.640776699, "autogenerated": false, "ratio": 3.193798449612403, "config_test": false, ...
from django import template from django.apps import apps from django.utils.encoding import iri_to_uri from django.utils.six.moves.urllib.parse import urljoin register = template.Library() class PrefixNode(template.Node): def __repr__(self): return "<PrefixNode for %r>" % self.name def ...
{ "repo_name": "yephper/django", "path": "django/templatetags/static.py", "copies": "1", "size": "4554", "license": "bsd-3-clause", "hash": 8211562412404339000, "line_mean": 25.9386503067, "line_max": 116, "alpha_frac": 0.5707070707, "autogenerated": false, "ratio": 4.333016175071361, "config_te...
from django import template from django.conf import settings from django.contrib.flatpages.models import FlatPage from django.contrib.sites.shortcuts import get_current_site register = template.Library() class FlatpageNode(template.Node): def __init__(self, context_name, starts_with=None, user=None): ...
{ "repo_name": "diego-d5000/MisValesMd", "path": "env/lib/python2.7/site-packages/django/contrib/flatpages/templatetags/flatpages.py", "copies": "2", "size": "3733", "license": "mit", "hash": -5669418182000253000, "line_mean": 34.9603960396, "line_max": 74, "alpha_frac": 0.6005893383, "autogenerated...
from django import template from django.conf import settings from django.contrib.flatpages.models import FlatPage register = template.Library() class FlatpageNode(template.Node): def __init__(self, context_name, starts_with=None, user=None): self.context_name = context_name if starts_...
{ "repo_name": "rimbalinux/LMD3", "path": "django/contrib/flatpages/templatetags/flatpages.py", "copies": "12", "size": "3565", "license": "bsd-3-clause", "hash": -7695590033242187000, "line_mean": 34.3775510204, "line_max": 74, "alpha_frac": 0.6016830295, "autogenerated": false, "ratio": 4.358190...
from django import template from django.conf import settings from django.contrib import admin from django.contrib.auth.forms import UserCreationForm, UserChangeForm, AdminPasswordChangeForm from django.contrib.auth.models import User, Group from django.core.exceptions import PermissionDenied from django.http impo...
{ "repo_name": "greggian/TapdIn", "path": "django/contrib/auth/admin.py", "copies": "1", "size": "6176", "license": "apache-2.0", "hash": 8448558885520485000, "line_mean": 45.5076923077, "line_max": 208, "alpha_frac": 0.5835492228, "autogenerated": false, "ratio": 4.2563749138525155, "config_tes...
from django import template from django.conf import settings from django.core.urlresolvers import reverse register = template.Library() ### Show an update instance ### @register.inclusion_tag("feeds/update.html", takes_context=True) def show_update(context, update): feed_object = update.feed.feed_object ...
{ "repo_name": "caseywstark/colab", "path": "colab/apps/object_feeds/templatetags/object_feeds_tags.py", "copies": "1", "size": "2666", "license": "mit", "hash": 8957323997347425000, "line_mean": 43.9655172414, "line_max": 124, "alpha_frac": 0.6627906977, "autogenerated": false, "ratio": 4.0150602...
from django import template from django.conf import settings from django.shortcuts import get_object_or_404, render_to_response from django.contrib.auth.decorators import login_required, permission_required from utils import next_redirect, confirmation_view from django.contrib import comments from django.contrib....
{ "repo_name": "rimbalinux/MSISDNArea", "path": "django/contrib/comments/views/moderation.py", "copies": "12", "size": "5196", "license": "bsd-3-clause", "hash": 5157218176497189000, "line_mean": 30.679245283, "line_max": 95, "alpha_frac": 0.6347190146, "autogenerated": false, "ratio": 4.021671826...
from django import template from django.conf import settings from django.template.defaultfilters import stringfilter from django.utils.encoding import smart_str from django.utils.safestring import mark_safe import md5 import urllib GRAVATAR_MAX_RATING = getattr(settings, 'GRAVATAR_MAX_RATING', 'R') GRAVATAR_D...
{ "repo_name": "caseywstark/colab", "path": "colab/apps/threadedcomments/templatetags/gravatar.py", "copies": "1", "size": "4661", "license": "mit", "hash": -4993660374294839000, "line_mean": 37.5, "line_max": 202, "alpha_frac": 0.6275477365, "autogenerated": false, "ratio": 3.9366554054054053, ...
from django import template from django.conf import settings from account.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 ...
{ "repo_name": "caseywstark/colab", "path": "colab/apps/account/templatetags/account_tags.py", "copies": "1", "size": "1268", "license": "mit", "hash": 8139205808744855000, "line_mean": 22.3846153846, "line_max": 95, "alpha_frac": 0.5528391167, "autogenerated": false, "ratio": 4.012658227848101, ...
from django import template from django.conf import settings register = template.Library() @register.filter def flatpagehist_diff_previous(self): return self.diff_previous() @register.filter def restructuredparts(value, **overrides): """return the restructured text parts""" try: from...
{ "repo_name": "brosner/django-wikiapp", "path": "wiki/templatetags/restructuredtext.py", "copies": "4", "size": "3732", "license": "mit", "hash": -3662919558448125000, "line_mean": 33.2075471698, "line_max": 134, "alpha_frac": 0.6463022508, "autogenerated": false, "ratio": 4.464114832535885, "c...
from django import template from django.conf import settings register = template.Library() SHORTNAME = getattr(settings, 'DISQUS_SHORTNAME', None) def disqus_dev(): """ Returns the HTML/js code to enable DISQUS comments on a local development server if the settings.DEBUG is set to True. "...
{ "repo_name": "cuongthai/cuongthai-s-blog", "path": "disqus/templatetags/disqus_tags.py", "copies": "2", "size": "3419", "license": "bsd-3-clause", "hash": -912859450773932800, "line_mean": 34.7634408602, "line_max": 171, "alpha_frac": 0.6218192454, "autogenerated": false, "ratio": 3.532024793388...
from django import template from django.conf import settings register = template.Library() SHORTNAME = settings.DISQUS_SHORTNAME def disqus_dev(): """ Returns the HTML/js code to enable DISQUS comments on a local development server if the settings.DEBUG is set to True. """ if setting...
{ "repo_name": "rimbalinux/MSISDNArea", "path": "disqus/templatetags/disqus_tags.py", "copies": "2", "size": "3233", "license": "bsd-3-clause", "hash": 6083482084621042000, "line_mean": 36.0352941176, "line_max": 171, "alpha_frac": 0.6294463347, "autogenerated": false, "ratio": 3.4913606911447084,...
from django import template from django.contrib.admin.models import LogEntry register = template.Library() class AdminLogNode(template.Node): def __init__(self, limit, varname, user): self.limit, self.varname, self.user = limit, varname, user def __repr__(self): return "<GetAdminLog...
{ "repo_name": "hunch/hunch-sample-app", "path": "django/contrib/admin/templatetags/log.py", "copies": "12", "size": "2327", "license": "mit", "hash": -8387024615532454000, "line_mean": 38.8245614035, "line_max": 136, "alpha_frac": 0.6110872368, "autogenerated": false, "ratio": 3.8718801996672214,...
from django import template from django.contrib.admin.models import LogEntry register = template.Library() class AdminLogNode(template.Node): def __init__(self, limit, varname, user): self.limit, self.varname, self.user = limit, varname, user def __repr__(self): return "<GetAdminL...
{ "repo_name": "diego-d5000/MisValesMd", "path": "env/lib/python2.7/site-packages/django/contrib/admin/templatetags/log.py", "copies": "1", "size": "2211", "license": "mit", "hash": -596864553427244700, "line_mean": 34.85, "line_max": 110, "alpha_frac": 0.6019900498, "autogenerated": false, "ratio...
from django import template from django.contrib.admin.utils import quote from django.core.urlresolvers import Resolver404, get_script_prefix, resolve from django.utils.http import urlencode from django.utils.six.moves.urllib.parse import parse_qsl, urlparse, urlunparse register = template.Library() @registe...
{ "repo_name": "diego-d5000/MisValesMd", "path": "env/lib/python2.7/site-packages/django/contrib/admin/templatetags/admin_urls.py", "copies": "1", "size": "1867", "license": "mit", "hash": -786393539247808800, "line_mean": 31.9454545455, "line_max": 93, "alpha_frac": 0.6518478843, "autogenerated": f...
from django import template from django.contrib.admin.utils import quote from django.urls import Resolver404, get_script_prefix, resolve from django.utils.http import urlencode from django.utils.six.moves.urllib.parse import parse_qsl, urlparse, urlunparse register = template.Library() @register.filter def...
{ "repo_name": "yephper/django", "path": "django/contrib/admin/templatetags/admin_urls.py", "copies": "1", "size": "1854", "license": "bsd-3-clause", "hash": 6905118468283668000, "line_mean": 31.7090909091, "line_max": 93, "alpha_frac": 0.6499460626, "autogenerated": false, "ratio": 3.649606299212...
from django import template from django.contrib.contenttypes.models import ContentType from django.core.urlresolvers import reverse from django.conf import settings register = template.Library() from threadedcomments.models import ThreadedComment from issues.models import Issue from papers.models import Paper, Pa...
{ "repo_name": "caseywstark/colab", "path": "colab/apps/dashboard/templatetags/dashboard_tags.py", "copies": "1", "size": "8384", "license": "mit", "hash": 7487791645275512000, "line_mean": 37.4490740741, "line_max": 143, "alpha_frac": 0.6337070611, "autogenerated": false, "ratio": 3.8283105022831...
from django import template from django.contrib.contenttypes.models import ContentType from django.core.urlresolvers import reverse register = template.Library() from voting.models import Vote from issues.models import Issue, IssueContributor @register.inclusion_tag("issues/issue_item.html", takes_context=T...
{ "repo_name": "caseywstark/colab", "path": "colab/apps/issues/templatetags/issues_tags.py", "copies": "1", "size": "1794", "license": "mit", "hash": 2888690158010372000, "line_mean": 29.9824561404, "line_max": 89, "alpha_frac": 0.6727982163, "autogenerated": false, "ratio": 3.470019342359768, "...
from django import template from django.contrib.contenttypes.models import ContentType from types import ListType,TupleType from xformmanager.models import * from hq.models import * from reporters.models import Reporter, ReporterGroup import xformmanager.adapter.querytools as qtools import hq.utils as utils ...
{ "repo_name": "commtrack/temp-aquatest", "path": "apps/hq/registration.py", "copies": "1", "size": "2148", "license": "bsd-3-clause", "hash": -1906841797410106000, "line_mean": 29.6176470588, "line_max": 122, "alpha_frac": 0.6070763501, "autogenerated": false, "ratio": 4.052830188679246, "confi...
from django import template from django.contrib.contenttypes.models import ContentType from types import ListType,TupleType from xformmanager.models import * from hq.models import * import xformmanager.adapter.querytools as qtools import hq.utils as utils import time from datetime import timedelta...
{ "repo_name": "commtrack/temp-aquatest", "path": "apps/hq/reporter/inspector.py", "copies": "1", "size": "8303", "license": "bsd-3-clause", "hash": 2113969083680750600, "line_mean": 38.9014778325, "line_max": 132, "alpha_frac": 0.6054438155, "autogenerated": false, "ratio": 3.909133709981168, "...
from django import template from django.core.exceptions import PermissionDenied, ObjectDoesNotExist from django.db import models, transaction from django.forms.models import modelform_factory from django.http import Http404, HttpResponse from django.utils.encoding import force_unicode, smart_unicode from django.u...
{ "repo_name": "LennonChin/Django-Practices", "path": "MxOnline/extra_apps/xadmin/plugins/editable.py", "copies": "1", "size": "6899", "license": "apache-2.0", "hash": 3738882683790606000, "line_mean": 41.11875, "line_max": 131, "alpha_frac": 0.5806638643, "autogenerated": false, "ratio": 3.999420...
from django import template from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse from django.contrib.contenttypes.models import ContentType from types import ListType,TupleType from hq.models import * import xformmanager.adapter.querytools as qtools import hq.utils as u...
{ "repo_name": "commtrack/temp-aquatest", "path": "apps/hq/templatetags/mainreport_tags.py", "copies": "1", "size": "4985", "license": "bsd-3-clause", "hash": -1757136538015339800, "line_mean": 36.3461538462, "line_max": 162, "alpha_frac": 0.5622868606, "autogenerated": false, "ratio": 3.503162333...
from django import template from django.core.urlresolvers import reverse from django.template import Library, Node from graphing import dbhelper register = template.Library() import time xmldate_format= '%Y-%m-%dT%H:%M:%S' output_format = '%Y-%m-%d %H:%M' class StringColumnsNode(Node): def __init...
{ "repo_name": "commtrack/temp-aquatest", "path": "apps/graphing/templatetags/inspector_tags.py", "copies": "1", "size": "4956", "license": "bsd-3-clause", "hash": 3187794161072607700, "line_mean": 36.1384615385, "line_max": 156, "alpha_frac": 0.6236884584, "autogenerated": false, "ratio": 3.76024...
from django import template from django.core.urlresolvers import reverse from ladder.helpers import PagingInfo register = template.Library() PAGE_LIST_CUTOFF = 15 class PageListNode( template.Node ) : def __init__( self, page_info ) : self.page_info = template.Variable( page_info ) de...
{ "repo_name": "GordonsBeard/elo", "path": "ladder/templatetags/paging_tags.py", "copies": "1", "size": "2273", "license": "mit", "hash": 7515520987709797000, "line_mean": 38.5892857143, "line_max": 147, "alpha_frac": 0.5411350638, "autogenerated": false, "ratio": 3.3724035608308607, "config_tes...
from django import template from django.core.urlresolvers import reverse from xformmanager.models import * from django.contrib.contenttypes.models import ContentType from types import ListType,TupleType from hq.models import * import graphing.dbhelper as dbhelper import xformmanager.adapter.querytools ...
{ "repo_name": "commtrack/temp-aquatest", "path": "apps/graphing/templatetags/formdata-tags.py", "copies": "1", "size": "1183", "license": "bsd-3-clause", "hash": -6626249070896817000, "line_mean": 29.1315789474, "line_max": 113, "alpha_frac": 0.6306001691, "autogenerated": false, "ratio": 3.27700...
from django import template from django.db import models from djpcms.utils import force_str from djpcms import get_site register = template.Library() @register.filter def site_address(request): host = request.environ.get('HTTP_HOST','') if host: if request.is_secure(): retu...
{ "repo_name": "strogo/djpcms", "path": "djpcms/templatetags/djpmodutils.py", "copies": "1", "size": "1926", "license": "bsd-3-clause", "hash": 5725532113034860000, "line_mean": 23.3684210526, "line_max": 78, "alpha_frac": 0.5083073728, "autogenerated": false, "ratio": 4.1869565217391305, "confi...
from django import template from django.db import transaction from django.conf import settings from django.contrib import admin from django.contrib.auth.forms import UserCreationForm, UserChangeForm, AdminPasswordChangeForm from django.contrib.auth.models import User, Group from django.contrib import messages fr...
{ "repo_name": "egenerat/gae-django", "path": "django/contrib/auth/admin.py", "copies": "9", "size": "6211", "license": "mit", "hash": -7043150839492449000, "line_mean": 41.4335664336, "line_max": 208, "alpha_frac": 0.60827564, "autogenerated": false, "ratio": 4.21370420624152, "config_test": fa...
from django import template from django.db.models import Count from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger from django_comments.templatetags.comments import CommentListNode from mptt.utils import get_cached_trees from mptt.templatetags.mptt_tags import RecurseTreeNode register = t...
{ "repo_name": "flavoi/diventi", "path": "diventi/comments/templatetags/comment_extras.py", "copies": "1", "size": "2549", "license": "apache-2.0", "hash": -8925042875521335000, "line_mean": 35.5147058824, "line_max": 107, "alpha_frac": 0.7081208317, "autogenerated": false, "ratio": 3.945820433436...
from django import template from django.template.defaultfilters import stringfilter, linebreaks_filter from django.utils.safestring import mark_safe from django.conf import settings from bleach.sanitizer import Cleaner import mistune register = template.Library() cleaner = Cleaner( tags=[ "a", ...
{ "repo_name": "rwakulszowa/poradnia", "path": "poradnia/letters/templatetags/format_text.py", "copies": "2", "size": "1169", "license": "mit", "hash": -8010080783784829000, "line_mean": 18.875, "line_max": 74, "alpha_frac": 0.498716852, "autogenerated": false, "ratio": 3.641744548286604, "confi...
from django import template from django.template import Library from django.utils.safestring import mark_safe from xadmin.util import static, vendor as util_vendor register = Library() @register.simple_tag(takes_context=True) def view_block(context, block_name, *args, **kwargs): if 'admin_view' not in ...
{ "repo_name": "LennonChin/Django-Practices", "path": "MxOnline/extra_apps/xadmin/templatetags/xadmin_tags.py", "copies": "1", "size": "1941", "license": "apache-2.0", "hash": 2431247799561505300, "line_mean": 28.8412698413, "line_max": 91, "alpha_frac": 0.6429675425, "autogenerated": false, "rati...
from django import template from django.template.loader import get_template from django.template.base import VariableDoesNotExist register = template.Library() # # Nodes # def templatePath(name): return "datable/templatetags/%s.html" % name def widgetTemplatePath(name): return "datable/tem...
{ "repo_name": "mpasternak/dojango-datable", "path": "datable/templatetags/datable_tags.py", "copies": "1", "size": "6831", "license": "mit", "hash": 7361693317228947000, "line_mean": 27.5714285714, "line_max": 79, "alpha_frac": 0.6119162641, "autogenerated": false, "ratio": 4.056413301662708, "...
from django import template from django.template.loader import render_to_string from django.conf import settings from django.contrib.contenttypes.models import ContentType from django.contrib import comments from django.utils.encoding import smart_unicode register = template.Library() class BaseCommentNode(t...
{ "repo_name": "rimbalinux/LMD3", "path": "django/contrib/comments/templatetags/comments.py", "copies": "12", "size": "12178", "license": "bsd-3-clause", "hash": 1723493757697654000, "line_mean": 34.5705705706, "line_max": 127, "alpha_frac": 0.6034652652, "autogenerated": false, "ratio": 4.0756358...
from django import template from django.templatetags import static import re register = template.Library() MIN_ENDING_PATTERN = re.compile(r'(?P<main>[\w\-\.\/]+)\.min(?P<suffix>\.\w+)$', re.I) @register.simple_tag(takes_context=True) def debug(context, path, switch_key='debug'): """ return a xxx[...
{ "repo_name": "ace-han/luckydraw", "path": "slotmachine/templatetags/debug.py", "copies": "1", "size": "1715", "license": "mit", "hash": -2519456405282115600, "line_mean": 38.880952381, "line_max": 132, "alpha_frac": 0.6151603499, "autogenerated": false, "ratio": 3.43, "config_test": false, "...
from django import template from django.utils.encoding import iri_to_uri from django.utils.six.moves.urllib.parse import urljoin register = template.Library() class PrefixNode(template.Node): def __repr__(self): return "<PrefixNode for %r>" % self.name def __init__(self, varname=None, n...
{ "repo_name": "diego-d5000/MisValesMd", "path": "env/lib/python2.7/site-packages/django/templatetags/static.py", "copies": "1", "size": "4212", "license": "mit", "hash": 8328664024144932000, "line_mean": 24.8280254777, "line_max": 116, "alpha_frac": 0.564339981, "autogenerated": false, "ratio": 4...
from django import template from django.utils.encoding import iri_to_uri register = template.Library() class PrefixNode(template.Node): def __repr__(self): return "<PrefixNode for %r>" % self.name def __init__(self, varname=None, name=None): if name is None: raise tem...
{ "repo_name": "rimbalinux/MSISDNArea", "path": "django/templatetags/static.py", "copies": "3", "size": "2233", "license": "bsd-3-clause", "hash": 4663293153180166000, "line_mean": 24.5833333333, "line_max": 66, "alpha_frac": 0.5579937304, "autogenerated": false, "ratio": 4.3359223300970875, "co...
from django import template from django.utils.encoding import iri_to_uri register = template.Library() class StaticFilesPrefixNode(template.Node): def __init__(self, varname=None): self.varname = varname def render(self, context): try: from django.conf import settings...
{ "repo_name": "hunch/hunch-sample-app", "path": "django/contrib/staticfiles/templatetags/staticfiles.py", "copies": "9", "size": "1194", "license": "mit", "hash": 1847948102698104000, "line_mean": 25.7674418605, "line_max": 81, "alpha_frac": 0.5988274707, "autogenerated": false, "ratio": 4.326086...
from django import template from django.utils.html import escape from voting.models import Vote register = template.Library() # Tags class ScoreForObjectNode(template.Node): def __init__(self, object, context_var): self.object = object self.context_var = context_var def render...
{ "repo_name": "caseywstark/colab", "path": "colab/apps/voting/templatetags/voting_tags.py", "copies": "1", "size": "8280", "license": "mit", "hash": 4593856220052632000, "line_mean": 33.8528138528, "line_max": 98, "alpha_frac": 0.6089371981, "autogenerated": false, "ratio": 3.971223021582734, "...
from django import template from django.utils.html import format_html, escape from django.utils.safestring import mark_safe from ..wrappers import * from ..utils import pad from ..fields import FIELDS register = template.Library() class Field(): """ Semantic UI Form Field. """ def __init__(self...
{ "repo_name": "thetarkus/django-semanticui-forms", "path": "semanticuiforms/templatetags/semanticui.py", "copies": "1", "size": "5565", "license": "mit", "hash": 344777197670290800, "line_mean": 24.0046728972, "line_max": 88, "alpha_frac": 0.6364779874, "autogenerated": false, "ratio": 3.33034111...
from django import template from django.utils.html import strip_tags, mark_safe from diventi.ebooks.models import ( Book, Section, ) from diventi.tooltips.models import ( Tooltip, TooltipGroup, ) register = template.Library() @register.filter(name='tooltip') def tooltip(value, sectio...
{ "repo_name": "flavoi/diventi", "path": "diventi/tooltips/templatetags/tooltips_extras.py", "copies": "1", "size": "1486", "license": "apache-2.0", "hash": -4153417189058887700, "line_mean": 31.0222222222, "line_max": 88, "alpha_frac": 0.5437415882, "autogenerated": false, "ratio": 4.462462462462...
from django import template from django.utils.safestring import mark_safe import random import re """ Example Usage in the template: <p>{{ email|hide_email }}<br /> {{ email|hide_email:"Contact Me" }}<br /> {% hide_email "name@example.com" %}<br /> {% hide_email "name@example.com" "John Smith" %}</p> {{...
{ "repo_name": "CCLab/sezam", "path": "apps/backend/templatetags/backendtemplates.py", "copies": "1", "size": "3897", "license": "bsd-3-clause", "hash": 4942041009440950000, "line_mean": 33.1081081081, "line_max": 249, "alpha_frac": 0.6073903002, "autogenerated": false, "ratio": 3.4034934497816596...
from django import template from django.utils.safestring import mark_safe register = template.Library() @register.simple_tag def upload_js(): return mark_safe(""" <!-- The template to display files available for upload --> <script id="template-upload" type="text/x-tmpl"> {% for (var i=0, file; file=o.fi...
{ "repo_name": "dlwndghk94/patent_expo", "path": "fileupload/templatetags/upload_tags.py", "copies": "1", "size": "3224", "license": "mit", "hash": -1195711994053908000, "line_mean": 36.843373494, "line_max": 214, "alpha_frac": 0.4785980149, "autogenerated": false, "ratio": 3.5428571428571427, "...
from django import template from geoprisma.models import Service register = template.Library() @register.simple_tag def printWidgetOptionss(options): """ Construit un tableau de clef:valeur pour l'affichage javascript Args: options: Liste d'option Returns: La liste format...
{ "repo_name": "groupe-conseil-nutshimit-nippour/django-geoprisma", "path": "geoprisma/templatetags/widget_extras.py", "copies": "1", "size": "2012", "license": "bsd-3-clause", "hash": -4964852825313558000, "line_mean": 24.8266666667, "line_max": 84, "alpha_frac": 0.5124254473, "autogenerated": fals...
from django import template from mediagenerator.generators.bundles.utils import _render_include_media from mediagenerator import utils register = template.Library() class MediaNode(template.Node): def __init__(self, bundle, variation): self.bundle = bundle self.variation = variation ...
{ "repo_name": "rimbalinux/MSISDNArea", "path": "mediagenerator/templatetags/media.py", "copies": "5", "size": "1535", "license": "bsd-3-clause", "hash": 4033994198961635300, "line_mean": 32.1111111111, "line_max": 79, "alpha_frac": 0.6403908795, "autogenerated": false, "ratio": 4.252077562326869,...
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 thin...
{ "repo_name": "commtrack/temp-aquatest", "path": "apps/xformmanager/templatetags/xform_tags.py", "copies": "1", "size": "1678", "license": "bsd-3-clause", "hash": 9155104647166669000, "line_mean": 37.023255814, "line_max": 96, "alpha_frac": 0.5589988081, "autogenerated": false, "ratio": 4.2588832...
from django import template import json register = template.Library() @register.inclusion_tag('admin_highcharts/js.html') def highcharts_for_result(cl): def get_verbose_name(name): for item in cl.model._meta.fields: if item.name==name: return item.verbose_name ...
{ "repo_name": "nieoding/django-admin-highcharts", "path": "admin_highcharts/templatetags/highcharts_tag.py", "copies": "1", "size": "2076", "license": "bsd-3-clause", "hash": -1215389785101331000, "line_mean": 35.0714285714, "line_max": 148, "alpha_frac": 0.5414258189, "autogenerated": false, "ra...
from django import template register = template.Library() import os.path from django.template.defaultfilters import stringfilter @register.assignment_tag def getJsStatics(widgetTypeSet): static_list = [] STATIC_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), "../static/geoprisma/widgets...
{ "repo_name": "groupe-conseil-nutshimit-nippour/django-geoprisma", "path": "geoprisma/templatetags/static_extras.py", "copies": "1", "size": "2855", "license": "bsd-3-clause", "hash": 5378881364966838000, "line_mean": 41.9230769231, "line_max": 104, "alpha_frac": 0.511033275, "autogenerated": false...
from django import template __author__ = "SmileyChris" #============================================================================== # Calculation objects #============================================================================== class BaseCalc(object): def __init__(self, var1, var2=None, negate=...
{ "repo_name": "hfercc/mese2014", "path": "annoying/templatetags/smart_if.py", "copies": "1", "size": "7518", "license": "apache-2.0", "hash": 2645807853298029600, "line_mean": 29.325, "line_max": 79, "alpha_frac": 0.5223463687, "autogenerated": false, "ratio": 4.183639398998331, "config_test": ...
from django import template class Library(template.Library): def smart_tag(self, func = None, takes_context = None, name = None): # based on: http://bl.ocks.org/natevw/f14812604be62c073461 # imports necessary to match original context from django.template.base import TemplateSyntaxE...
{ "repo_name": "integree/django-congo", "path": "congo/templatetags/__init__.py", "copies": "1", "size": "2871", "license": "mit", "hash": 5955126207567228000, "line_mean": 44.3064516129, "line_max": 89, "alpha_frac": 0.5405781958, "autogenerated": false, "ratio": 4.785, "config_test": false, ...