text
stringlengths
0
1.05M
meta
dict
from django.template import Context from django.template.loader import get_template from django.template import Library register = Library() def get_context_template(element): element_type = element.__class__.__name__.lower() if element_type == 'boundfield': template = get_template("foundationform/...
{ "repo_name": "TigorC/django-foundation-form", "path": "foundationform/templatetags/foundation.py", "copies": "1", "size": "1062", "license": "bsd-3-clause", "hash": 3680840973739877000, "line_mean": 29.3428571429, "line_max": 77, "alpha_frac": 0.6883239171, "autogenerated": false, "ratio": 4.282...
from django.template import Context from django.template.loader import get_template from avocado.models import Column, Criterion, Field FIELD_TEMPLATE_PATH = 'avocado/field-doc' CONCEPT_TEMPLATE_PATH = 'avocado/concept-doc' def generate_field_doc(pk, template_name=None, mimetype='txt'): "Generates the documentat...
{ "repo_name": "pombredanne/django-avocado", "path": "avocado/docs.py", "copies": "1", "size": "2335", "license": "bsd-3-clause", "hash": 917713728819017200, "line_mean": 27.1325301205, "line_max": 72, "alpha_frac": 0.6650963597, "autogenerated": false, "ratio": 3.7419871794871793, "config_test"...
from django.template import Context from django.template.loader import render_to_string from django.conf import settings if 'django_mailer' in settings.INSTALLED_APPS: from django_mailer import send_mail else: from django.core.mail import send_mail def send_reminder(submission_list, extra_context=None): ...
{ "repo_name": "mozilla/mozilla-ignite", "path": "apps/timeslot/notifications.py", "copies": "1", "size": "1261", "license": "bsd-3-clause", "hash": 6669262699622089000, "line_mean": 35.0285714286, "line_max": 74, "alpha_frac": 0.6391752577, "autogenerated": false, "ratio": 4.054662379421222, "c...
from django.template import Context from django.template.loader import render_to_string from django.contrib.sites.models import Site from notifications.conf import settings class BaseBackend(object): """ The base backend. """ def __init__(self, medium_id, spam_sensitivity=None): self.medium_i...
{ "repo_name": "aaronc-bixly/notifications", "path": "notifications/backends/base.py", "copies": "1", "size": "1962", "license": "mit", "hash": 737444325219400600, "line_mean": 35.3333333333, "line_max": 89, "alpha_frac": 0.6340468909, "autogenerated": false, "ratio": 4.33112582781457, "config_t...
from django.template import Context from django.template.loader import render_to_string from django.forms.util import flatatt from layout import LayoutObject, Field from utils import render_field class AppendedText(Field): template = "bootstrap/layout/appended_text.html" def __init__(self, field, text, *arg...
{ "repo_name": "pjdelport/django-crispy-forms", "path": "crispy_forms/bootstrap.py", "copies": "2", "size": "2936", "license": "mit", "hash": 9064517028281305000, "line_mean": 35.7, "line_max": 108, "alpha_frac": 0.6461171662, "autogenerated": false, "ratio": 3.8031088082901556, "config_test": f...
from django.template import Context from django.template.loader import render_to_string from django.http import HttpResponse from django.views.decorators.cache import never_cache from tardis.tardis_portal.auth import decorators as authz from tardis.tardis_portal.shortcuts import render_response_index from tardis.tardi...
{ "repo_name": "grischa/mytardis-pdb-depositing", "path": "views.py", "copies": "1", "size": "3178", "license": "bsd-3-clause", "hash": -8925863199967334000, "line_mean": 34.7078651685, "line_max": 71, "alpha_frac": 0.6050975456, "autogenerated": false, "ratio": 3.8105515587529974, "config_test"...
from django.template import Context from django.template.loader import render_to_string from itertools import chain class NotificationBackend(object): slug = None display_name = None sensitivity = 2 format_templates = {} def path(self): return "%s.%s" % (self.__module__, self.__class__.__n...
{ "repo_name": "theatlantic/django-notification", "path": "notification/backends/base.py", "copies": "1", "size": "1926", "license": "mit", "hash": -4656374781884535000, "line_mean": 36.7647058824, "line_max": 82, "alpha_frac": 0.6059190031, "autogenerated": false, "ratio": 4.563981042654029, "c...
from django.template import Context from django.template.loader import render_to_string from ..compat import context_flatten class Renderable(object): """ Interface for an object that can be rendered with the {% render object %} template tag. The {% render %} tag will call the Renderable.render() method ...
{ "repo_name": "team23/django_backend", "path": "django_backend/backend/renderable.py", "copies": "1", "size": "3139", "license": "bsd-3-clause", "hash": -4809872473287847000, "line_mean": 34.6704545455, "line_max": 79, "alpha_frac": 0.627588404, "autogenerated": false, "ratio": 4.43988684582744, ...
from django.template import Context from django.template.loader import render_to_string from django.contrib.sites.models import Site from ..conf import settings from ..utils import notice_setting_for_user class BaseBackend(object): """ The base backend. """ def __init__(self, medium_id, spam_sensiti...
{ "repo_name": "coldmind/pinax-notifications", "path": "pinax/notifications/backends/base.py", "copies": "4", "size": "2072", "license": "mit", "hash": -2009318818228105200, "line_mean": 36, "line_max": 87, "alpha_frac": 0.6269305019, "autogenerated": false, "ratio": 4.272164948453608, "config_t...
from django.template import Context from django.template.loader import render_to_string from django.contrib.sites.models import Site from notifications.conf import settings from notifications.utils import notice_setting_for_user class BaseBackend(object): """ The base backend. """ def __init__(sel...
{ "repo_name": "haystack/eyebrowse-server", "path": "notifications/backends/base.py", "copies": "1", "size": "2124", "license": "mit", "hash": 1956766306711965700, "line_mean": 35, "line_max": 87, "alpha_frac": 0.6191148776, "autogenerated": false, "ratio": 4.406639004149378, "config_test": fals...
from django.template import Context def get_variables(template): """ Returns an ordered list of variable names in the given Template, by monkeypatching Django template internals to maintain a list of all variables that it attempted to resolve in the template. """ from django.template.base impo...
{ "repo_name": "boldprogressives/django-templateinspector", "path": "djtemplateinspector/__init__.py", "copies": "1", "size": "1227", "license": "bsd-3-clause", "hash": -6769614232282379000, "line_mean": 25.6739130435, "line_max": 68, "alpha_frac": 0.6316218419, "autogenerated": false, "ratio": 4....
from django.template import Context from wagtailmenus.models import MainMenu from wagtailmenus.tests import utils from wagtailmenus.tests.test_mainmenu_class import MainMenuTestCase class TestCreateDictFromParentContext(MainMenuTestCase): # -----------------------------------------------------------------------...
{ "repo_name": "ababic/wagtailmenus", "path": "wagtailmenus/tests/test_menu_class.py", "copies": "2", "size": "3383", "license": "mit", "hash": 8714554683795755000, "line_mean": 42.9350649351, "line_max": 84, "alpha_frac": 0.6204552173, "autogenerated": false, "ratio": 3.9200463499420626, "confi...
from django.template import Context try: from django.http.request import QueryDict except ImportError: from django.http import QueryDict from achilles import blocks, actions import json register = actions.Library('forms') class Button(object): """ Form button, execute some action on the specific f...
{ "repo_name": "exekias/django-achilles", "path": "achilles/forms.py", "copies": "1", "size": "5224", "license": "apache-2.0", "hash": 8003249855736352000, "line_mean": 28.8514285714, "line_max": 79, "alpha_frac": 0.5696784074, "autogenerated": false, "ratio": 4.250610252237592, "config_test": f...
from django.template import Context, RequestContext, loader from django.http import HttpResponse from FishTankApp.models import * from utils import JSONResponse #from django.utils import simplejson from datetime import datetime, timedelta def index(request): t = loader.get_template('index.html') c = RequestCon...
{ "repo_name": "joshvillbrandt/FishTankApp", "path": "django/FishTank/FishTankApp/views.py", "copies": "1", "size": "1535", "license": "apache-2.0", "hash": -8668060833430262000, "line_mean": 30.3469387755, "line_max": 92, "alpha_frac": 0.5915309446, "autogenerated": false, "ratio": 3.866498740554...
from django.template import Context, RequestContext, loader, Template from django.template.loader import render_to_string tpls = { 'xeditable': {'tpl': 'common/xeditable.html'}, 'xeditable_search': {'tpl': 'common/xeditable_search.html'}, } def to_html(model, fields, extra={}, html=True): """ return HTML...
{ "repo_name": "futurice/django-jsonmodel", "path": "djangojsonmodel/contrib/html/producer.py", "copies": "1", "size": "1731", "license": "mit", "hash": -2385536137775910000, "line_mean": 27.85, "line_max": 69, "alpha_frac": 0.4974003466, "autogenerated": false, "ratio": 3.651898734177215, "conf...
from django.template import Context, RequestContext from django.template.loader import get_template from mezzanine import template from mezzanine.pages.models import Page from mezzanine.forms.forms import FormForForm from mezzanine.utils.urls import slugify register = template.Library() @register.inclusion_tag('inc...
{ "repo_name": "lucmilland/mezzanine-onepage", "path": "onepage/templatetags/onepage_tags.py", "copies": "1", "size": "1471", "license": "bsd-2-clause", "hash": 3880456987362787300, "line_mean": 32.4318181818, "line_max": 98, "alpha_frac": 0.7090414684, "autogenerated": false, "ratio": 3.587804878...
from django.template import Context, TemplateDoesNotExist from django.template.loader import get_template from django.core.mail import EmailMessage from django.conf import settings import sys import uuid def send_html_email(subject, message, receipient): # Send an Email msg = EmailMessage(subject, message, se...
{ "repo_name": "nikhila05/micro-finance", "path": "core/utils.py", "copies": "2", "size": "1224", "license": "mit", "hash": 6712049505697115000, "line_mean": 31.2105263158, "line_max": 80, "alpha_frac": 0.6993464052, "autogenerated": false, "ratio": 3.9356913183279745, "config_test": false, "h...
from django.template import Context, TemplateDoesNotExist, TemplateSyntaxError from django.test import SimpleTestCase from .test_basic import basic_templates from ..utils import setup include_fail_templates = { 'include-fail1': '{% load bad_tag %}{% badtag %}', 'include-fail2': '{% load broken_tag %}', } c...
{ "repo_name": "jyotikamboj/container", "path": "dj-tests/template_tests/syntax_tests/test_include.py", "copies": "8", "size": "8060", "license": "mit", "hash": -1976763827370054400, "line_mean": 38.900990099, "line_max": 103, "alpha_frac": 0.6102977667, "autogenerated": false, "ratio": 4.09137055...
from django.template import Context, Template from django.template.loader import render_to_string from django.utils.encoding import force_unicode """ IMPORTANT: Sidebar Widget itself is not a django form widget, but a term of small block/pieces of information that lives on various part of web page, could be display so...
{ "repo_name": "ekaputra07/django-sidebar", "path": "sidebar/base.py", "copies": "1", "size": "2221", "license": "bsd-3-clause", "hash": 3051134899188625000, "line_mean": 29.4246575342, "line_max": 86, "alpha_frac": 0.626294462, "autogenerated": false, "ratio": 4.588842975206612, "config_test": ...
from django.template import Context, Template from django.template.loader import render_to_string from . utils import render_field class Layout(object): """ Form Layout. It is conformed by Layout objects: `Fieldset`, `Row`, `Column`, `MultiField`, `HTML`, `ButtonHolder`, `Button`, `Hidden`, `Reset`, `Su...
{ "repo_name": "CashStar/django-uni-form", "path": "uni_form/layout.py", "copies": "1", "size": "8824", "license": "mit", "hash": -1869016419667166000, "line_mean": 30.9710144928, "line_max": 141, "alpha_frac": 0.5931550317, "autogenerated": false, "ratio": 3.9729851418280053, "config_test": fal...
from django.template import Context, Template from django.template.loader import render_to_string from utils import render_field class Layout(object): """ Form Layout. It is conformed by Layout objects: `Fieldset`, `Row`, `Column`, `MultiField`, `HTML`, `ButtonHolder`, `Button`, `Hidden`, `Reset`, `Subm...
{ "repo_name": "pydanny/django-uni-form", "path": "uni_form/layout.py", "copies": "2", "size": "8822", "license": "mit", "hash": -7202094667791932000, "line_mean": 30.9637681159, "line_max": 141, "alpha_frac": 0.5932895035, "autogenerated": false, "ratio": 3.973873873873874, "config_test": false...
from django.template import Context, Template from django.test import TestCase from board.models import BoardMember import factory def render_template(input): t = Template("{% load board_tags %}" + input) c = Context() return t.render(c).strip() class BoardMemberFactory(factory.Factory): title = "Pr...
{ "repo_name": "dominicrodger/django-board", "path": "board/tests.py", "copies": "1", "size": "1487", "license": "mit", "hash": 4535416216907139000, "line_mean": 31.3260869565, "line_max": 71, "alpha_frac": 0.5655682582, "autogenerated": false, "ratio": 3.933862433862434, "config_test": true, ...
from django.template import Context, Template from django.test import TestCase from django.conf import settings from django.core.exceptions import ImproperlyConfigured def render_template(string, context=None): context = context or {} context = Context(context) return Template(string).render(c...
{ "repo_name": "pancentric/django-imgix", "path": "django_imgix/tests/tests.py", "copies": "1", "size": "14327", "license": "isc", "hash": 3164953305605076000, "line_mean": 31.7848970252, "line_max": 122, "alpha_frac": 0.504432191, "autogenerated": false, "ratio": 3.8276783328880577, "config_tes...
from django.template import Context, Template from django.test import TestCase from django.utils.html import escape from .compat import parse_qs, quote_plus, urlparse from .helpers import * class TestGravatarHelperMethods(TestCase): def test_gravatar_hash_generation(self): """ Verify the generat...
{ "repo_name": "twaddington/django-gravatar", "path": "django_gravatar/tests.py", "copies": "1", "size": "5682", "license": "mit", "hash": -7369382625634251000, "line_mean": 32.2280701754, "line_max": 96, "alpha_frac": 0.6133403731, "autogenerated": false, "ratio": 3.910529938059188, "config_tes...
from django.template import Context, Template from django.test import TestCase class TestTags(TestCase): def render_template(self, string, context=None): """ helper function for template tag testing, from https://stackoverflow.com/a/1690879/ :param string: :param context: ...
{ "repo_name": "Benoss/django-cookiecutter", "path": "{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/apps/core/templatetags/tests.py", "copies": "1", "size": "1136", "license": "apache-2.0", "hash": -6281156467531628000, "line_mean": 30.5555555556, "line_max": 120, "alpha_frac": 0.6038732...
from django.template import Context, Template from django.test import TestCase template_filter = "{% load md %}{{ content | markdown }}" template_tag = "{% load md %}{% markdown %}{{ content }}{% endmarkdown %}" template_tag_as = ( "{% load md %}{% markdown as my_variable %}{{ content }}{% endmarkdown %}" ) conte...
{ "repo_name": "bulv1ne/django-utils", "path": "utils/tests/test_markdown.py", "copies": "1", "size": "1116", "license": "mit", "hash": -7364219910476725000, "line_mean": 27.6153846154, "line_max": 78, "alpha_frac": 0.6299283154, "autogenerated": false, "ratio": 3.8482758620689657, "config_test"...
from django.template import Context, Template from django.utils.safestring import SafeText from markymark.templatetags.markymark import markdown_filter class TestMarkdownFilter: teststring = ( 'Test 123\n' '<strong>Test</strong>\n' '*foo*' ) def test_without_safe_extension(self):...
{ "repo_name": "moccu/django-markymark", "path": "tests/test_templatetags.py", "copies": "1", "size": "1100", "license": "mit", "hash": 689023215379895000, "line_mean": 27.9473684211, "line_max": 67, "alpha_frac": 0.5572727273, "autogenerated": false, "ratio": 3.900709219858156, "config_test": t...
from django.template import Context, Template from example_app.tests.factories import RelativeFactory from test_plus import TestCase class RelatedFilterTest(TestCase): def setUp(self): RelativeFactory.reset_sequence() self.template = Template( """ {% load common mvp_tags %} ...
{ "repo_name": "goodtune/vitriolic", "path": "touchtechnology/admin/tests/test_mvp_tags.py", "copies": "1", "size": "1576", "license": "bsd-3-clause", "hash": 4312868381324968400, "line_mean": 32.5319148936, "line_max": 88, "alpha_frac": 0.5532994924, "autogenerated": false, "ratio": 4.18037135278...
from django.template import Context, Template from bluebottle.accounts.serializers import UserPreviewSerializer from apps.pages.models import ContactMessage from fluent_contents.rendering import render_placeholder from rest_framework import serializers from .models import Page class PageContentsField(serializers.Fie...
{ "repo_name": "gannetson/sportschooldeopenlucht", "path": "apps/pages/serializers.py", "copies": "1", "size": "1077", "license": "bsd-3-clause", "hash": -3130808274223341000, "line_mean": 29.7714285714, "line_max": 78, "alpha_frac": 0.7186629526, "autogenerated": false, "ratio": 4.378048780487805...
from django.template import Context, Template from . import WPTestCase from ..factories import WPSiteFactory, WPPostFactory class WidgetTestCase(WPTestCase): def test_wjidget_missing_site_raises_exception(self): t = Template('{% load wjidget from wjordpress %}{% wjidget "foo" %}') # TODO Improper...
{ "repo_name": "texastribune/wjordpress", "path": "wjordpress/tests/test_templatetags.py", "copies": "1", "size": "1564", "license": "apache-2.0", "hash": 5064059238105928000, "line_mean": 35.3720930233, "line_max": 77, "alpha_frac": 0.550511509, "autogenerated": false, "ratio": 4.041343669250646,...
from django.template import Context, Template from lbworkflow.models import Process, ProcessInstance def get_event_transitions(process_instance): from lbworkflow.models import Event events = Event.objects.filter(instance=process_instance).order_by( "-created_on", "-id" ) transitions = [] ...
{ "repo_name": "vicalloy/django-lb-workflow", "path": "lbworkflow/views/flowchart.py", "copies": "1", "size": "2492", "license": "mit", "hash": 5143766441261677000, "line_mean": 30.9487179487, "line_max": 216, "alpha_frac": 0.6460674157, "autogenerated": false, "ratio": 3.9182389937106916, "conf...
from django.template import Context, Template __all__ = ('TemplateHintProvider', 'CompositeTemplateHintProvider', 'TemplateNameProvider', 'Renderable',) class TemplateHintProvider(object): ''' Use this mixin for objects which shall provide template hints. ''' def get_template_hints(self,...
{ "repo_name": "team23/django_mc", "path": "django_mc/mixins.py", "copies": "1", "size": "7548", "license": "bsd-3-clause", "hash": -2837295716216322600, "line_mean": 36.552238806, "line_max": 83, "alpha_frac": 0.6095654478, "autogenerated": false, "ratio": 4.610873549175321, "config_test": fals...
from django.template import Context, Template def test_table_of_contents(): template = Template( '{% load table_of_contents from cms_tags %}' '{% for anchor, label in html|table_of_contents %}' ' <a href="#{{ anchor }}">{{ label }}</a>' '{% endfor %}' ) context = Contex...
{ "repo_name": "uktrade/directory-ui-supplier", "path": "core/tests/test_templatetags.py", "copies": "1", "size": "3142", "license": "mit", "hash": 7361359402420683000, "line_mean": 23.9365079365, "line_max": 64, "alpha_frac": 0.4267982177, "autogenerated": false, "ratio": 3.5422773393461107, "c...
from django.template import Context, Template, RequestContext from django.contrib.auth import authenticate, login, logout from django.contrib import messages from django.shortcuts import render, render_to_response from django.views.generic import TemplateView from django.http import HttpResponse, HttpResponseRedirect f...
{ "repo_name": "makennajohnstone/CSS", "path": "css/views.py", "copies": "1", "size": "22471", "license": "mit", "hash": 8827517606943504000, "line_mean": 39.8563636364, "line_max": 262, "alpha_frac": 0.582617596, "autogenerated": false, "ratio": 4.261520955812631, "config_test": false, "has_n...
from django.template import Context, Template, TemplateSyntaxError from rest_framework import exceptions, serializers from rest_framework.reverse import reverse from rdmo.core.serializers import (MarkdownSerializerMixin, SiteSerializer, TranslationSerializerMixin) from rdmo.core.util...
{ "repo_name": "rdmorganiser/rdmo", "path": "rdmo/views/serializers/v1.py", "copies": "1", "size": "2240", "license": "apache-2.0", "hash": 8574022340943006000, "line_mean": 26.6543209877, "line_max": 80, "alpha_frac": 0.5709821429, "autogenerated": false, "ratio": 4.735729386892178, "config_tes...
from django.template import Context, Template, Variable, VariableDoesNotExist from django.test import SimpleTestCase from django.utils.translation import gettext_lazy class TemplateTests(SimpleTestCase): def test_lazy_template_string(self): template_string = gettext_lazy('lazy string') self.assert...
{ "repo_name": "freakboy3742/django", "path": "tests/template_tests/test_base.py", "copies": "11", "size": "1479", "license": "bsd-3-clause", "hash": -6471734126707300000, "line_mean": 35.975, "line_max": 102, "alpha_frac": 0.6240703178, "autogenerated": false, "ratio": 4.225714285714286, "confi...
from django.template import defaultfilters from django.core.urlresolvers import reverse from django.db.models.options import FieldDoesNotExist from django.db import connection from django.contrib.contenttypes.models import ContentType __all__ = ('OrderField', 'ForeignKeyAggregate', 'GenericForeignKeyAggregate', 'O...
{ "repo_name": "indro/t2c", "path": "apps/external_apps/things/fields.py", "copies": "2", "size": "7945", "license": "mit", "hash": -3683695592076008000, "line_mean": 35.4495412844, "line_max": 105, "alpha_frac": 0.6095657646, "autogenerated": false, "ratio": 3.847457627118644, "config_test": fa...
from django.template import defaultfilters from django.utils.translation import pgettext_lazy from cradmin_legacy import crapp from cradmin_legacy.crinstance import reverse_cradmin_url from devilry.devilry_cradmin import devilry_crmenu class Menu(devilry_crmenu.Menu): devilryrole = 'examiner' def add_role_m...
{ "repo_name": "devilry/devilry-django", "path": "devilry/devilry_examiner/cradminextensions/devilry_crmenu_examiner.py", "copies": "1", "size": "1777", "license": "bsd-3-clause", "hash": -8352115475532741000, "line_mean": 34.54, "line_max": 80, "alpha_frac": 0.6055149128, "autogenerated": false, ...
from django.template import defaultfilters from django.utils.translation import ugettext_lazy as _ # noqa from horizon import messages from horizon import tables from openstack_dashboard import api ENABLE = 0 DISABLE = 1 class CreateUserLink(tables.LinkAction): name = "create" verbose_name = _("Create Us...
{ "repo_name": "rickerc/horizon_audit", "path": "openstack_dashboard/dashboards/admin/users/tables.py", "copies": "1", "size": "4552", "license": "apache-2.0", "hash": 8808080772558405000, "line_mean": 32.7185185185, "line_max": 77, "alpha_frac": 0.5869947276, "autogenerated": false, "ratio": 4.18...
from django.template import defaulttags from django.template import Library, Node from django.templatetags import future register = Library() error_on_old_style_url_tag = False new_style_url_tag = False errors = [] def before_new_template(force_new_urls): """Reset state ready for new template""" global new_...
{ "repo_name": "pabulumm/neighbors", "path": "lib/python3.4/site-packages/django_extensions/utils/validatingtemplatetags.py", "copies": "2", "size": "2464", "license": "bsd-3-clause", "hash": -5432853037384602000, "line_mean": 25.7826086957, "line_max": 108, "alpha_frac": 0.6343344156, "autogenerate...
from django.template import Engine _dirs_undefined = object() class JsEngine(Engine): def __init__(self, dirs=None, app_dirs=False, allowed_include_roots=None, context_processors=None, debug=False, loaders=None, string_if_invalid='', file_charset='utf-8'): ...
{ "repo_name": "jonashagstedt/django-jsx", "path": "django_jsx/template/engine.py", "copies": "2", "size": "1119", "license": "bsd-3-clause", "hash": 2648703002347599400, "line_mean": 38.9642857143, "line_max": 100, "alpha_frac": 0.6112600536, "autogenerated": false, "ratio": 4.191011235955056, ...
from django.template import Engine _dirs_undefined = object() class JsEngine(Engine): def __init__(self, dirs=None, app_dirs=False, allowed_include_roots=None, context_processors=None, debug=False, loaders=None, string_if_invalid='', file_charset='utf-8'): ...
{ "repo_name": "wildfish/django-isomorphic", "path": "isomorphic/template/engine.py", "copies": "1", "size": "1139", "license": "bsd-3-clause", "hash": -6701389046478347000, "line_mean": 34.59375, "line_max": 95, "alpha_frac": 0.601404741, "autogenerated": false, "ratio": 4.218518518518518, "con...
from django.template import engines from django.urls import reverse from pyquery import PyQuery as pq from olympia.addons.models import Addon from olympia.amo.templatetags.jinja_helpers import absolutify from olympia.amo.tests import TestCase, addon_factory class HelpersTest(TestCase): def render(self, s, conte...
{ "repo_name": "diox/olympia", "path": "src/olympia/ratings/tests/test_helpers.py", "copies": "4", "size": "3677", "license": "bsd-3-clause", "hash": -110990661807216060, "line_mean": 38.9673913043, "line_max": 88, "alpha_frac": 0.5784607017, "autogenerated": false, "ratio": 3.41728624535316, "c...
from django.template import engines from django.utils.encoding import force_str import html5lib import jinja2 def truncate_text(text, limit, killwords=False, end='...'): """Return as many characters as possible without going over the limit. Return the truncated text and the characters left before the limit,...
{ "repo_name": "mozilla/olympia", "path": "src/olympia/translations/utils.py", "copies": "4", "size": "3578", "license": "bsd-3-clause", "hash": 2701795476305110000, "line_mean": 32.7547169811, "line_max": 88, "alpha_frac": 0.5883174958, "autogenerated": false, "ratio": 3.855603448275862, "confi...
from django.template import engines from django.utils.encoding import force_text import html5lib import jinja2 import six def truncate_text(text, limit, killwords=False, end='...'): """Return as many characters as possible without going over the limit. Return the truncated text and the characters left befor...
{ "repo_name": "kumar303/addons-server", "path": "src/olympia/translations/utils.py", "copies": "4", "size": "3570", "license": "bsd-3-clause", "hash": 2703960154868321300, "line_mean": 34, "line_max": 79, "alpha_frac": 0.5943977591, "autogenerated": false, "ratio": 3.8678223185265437, "config_t...
from django.template import engines from django.utils.encoding import force_text import html5lib import jinja2 def truncate_text(text, limit, killwords=False, end='...'): """Return as many characters as possible without going over the limit. Return the truncated text and the characters left before the limit...
{ "repo_name": "psiinon/addons-server", "path": "src/olympia/translations/utils.py", "copies": "3", "size": "3557", "license": "bsd-3-clause", "hash": 5259000987808848000, "line_mean": 34.2178217822, "line_max": 79, "alpha_frac": 0.5923531066, "autogenerated": false, "ratio": 3.866304347826087, ...
from django.template import engines from cms.models import CMSPlugin from cms.plugin_base import CMSPluginBase from cms.plugin_pool import plugin_pool from cms.utils.plugins import get_plugin_model from tests.test_app.models import DummyLink, DummySpacer from djangocms_text_ckeditor.cms_plugins import TextPlugin @...
{ "repo_name": "divio/djangocms-text-ckeditor", "path": "tests/test_app/cms_plugins.py", "copies": "1", "size": "1971", "license": "bsd-3-clause", "hash": -3532959806563665400, "line_mean": 27.9852941176, "line_max": 75, "alpha_frac": 0.7366818874, "autogenerated": false, "ratio": 3.57713248638838...
from django.template import engines from pyquery import PyQuery as pq from olympia.addons.models import Addon from olympia.amo.templatetags.jinja_helpers import absolutify from olympia.amo.tests import TestCase, addon_factory from olympia.amo.urlresolvers import reverse class HelpersTest(TestCase): def render(...
{ "repo_name": "eviljeff/olympia", "path": "src/olympia/ratings/tests/test_helpers.py", "copies": "2", "size": "3817", "license": "bsd-3-clause", "hash": 6668627142874140000, "line_mean": 38.3505154639, "line_max": 75, "alpha_frac": 0.5603877391, "autogenerated": false, "ratio": 3.5212177121771218...
from django.template import engines from pyquery import PyQuery as pq from olympia.addons.models import Addon from olympia.amo.tests import TestCase, addon_factory from olympia.amo.urlresolvers import reverse from olympia.ratings.forms import RatingForm from olympia.ratings.models import RatingFlag class HelpersTes...
{ "repo_name": "harry-7/addons-server", "path": "src/olympia/ratings/tests/test_helpers.py", "copies": "5", "size": "3999", "license": "bsd-3-clause", "hash": 8308735216455211000, "line_mean": 38.99, "line_max": 78, "alpha_frac": 0.5613903476, "autogenerated": false, "ratio": 3.3076923076923075, ...
from django.template import Lexer, Parser, tag_re, NodeList, VariableNode, TemplateSyntaxError from django.utils.encoding import force_unicode from django.utils.html import escape from django.utils.safestring import SafeData, EscapeData class DebugLexer(Lexer): def __init__(self, template_string, origin): ...
{ "repo_name": "sanjuro/RCJK", "path": "vendor/django/template/debug.py", "copies": "2", "size": "3624", "license": "apache-2.0", "hash": -2528664710893868500, "line_mean": 35.9795918367, "line_max": 104, "alpha_frac": 0.6167218543, "autogenerated": false, "ratio": 4.094915254237288, "config_tes...
from django.template import Lexer, Parser, tag_re, NodeList, VariableNode, TemplateSyntaxError from django.utils.encoding import force_unicode from django.utils.html import escape from django.utils.safestring import SafeData, EscapeData class DebugLexer(Lexer): def __init__(self, template_string, origin): ...
{ "repo_name": "greggian/TapdIn", "path": "django/template/debug.py", "copies": "1", "size": "3664", "license": "apache-2.0", "hash": -6123893137141945000, "line_mean": 35.7731958763, "line_max": 122, "alpha_frac": 0.6048034934, "autogenerated": false, "ratio": 4.216340621403913, "config_test": ...
from django.template import Library, defaultfilters from django.utils.translation import ungettext from django.conf import settings register = Library() # A tuple of standard large number to their converters intword_converters = ( (6, lambda number: ( ungettext('%(value).1f mil', '%(value).1f mil', number...
{ "repo_name": "ericmoritz/lottery-hydra-django-client", "path": "lottery_hydra/templatetags/lottery_tags.py", "copies": "1", "size": "1797", "license": "bsd-2-clause", "hash": 1471293388398788400, "line_mean": 31.6727272727, "line_max": 80, "alpha_frac": 0.6221480245, "autogenerated": false, "rat...
from django.template import Library, loader, Context from django.contrib.sites.models import Site from django.core.urlresolvers import reverse from django.utils.html import escape from django.utils.safestring import mark_safe from embed9.utils import get_embeddable, get_encoded_params, get_form_initial register = Lib...
{ "repo_name": "9dev/django-embed9", "path": "embed9/templatetags/embed.py", "copies": "1", "size": "2003", "license": "mit", "hash": -4025018399694407700, "line_mean": 33.5344827586, "line_max": 128, "alpha_frac": 0.6525212182, "autogenerated": false, "ratio": 3.5264084507042255, "config_test":...
from django.template import Library, loader, Context from django.template import RequestContext from menus.models import * register = Library() @register.simple_tag(takes_context=True) def menu_position(context, position, template='menus/menu_list.html', *args, **kwargs): try: menu = Menu.objects.prefetc...
{ "repo_name": "publica-io/django-publica-menus", "path": "menus/templatetags/menus_tags.py", "copies": "1", "size": "1487", "license": "bsd-3-clause", "hash": 267447074456329600, "line_mean": 29.3673469388, "line_max": 87, "alpha_frac": 0.5406859449, "autogenerated": false, "ratio": 4.70569620253...
from django.template import Library from api.models import Course from api.models import EnrolledCourse from api.models import Quiz from api.models import QuizSubmission from api.models import Question from api.models import QuestionSubmission register = Library() @register.filter def has_completed(user,course): ...
{ "repo_name": "Oinweb/py-fly", "path": "learning/templatetags/learning_extras.py", "copies": "3", "size": "1310", "license": "bsd-2-clause", "hash": -586997816595825000, "line_mean": 28.1333333333, "line_max": 73, "alpha_frac": 0.7030534351, "autogenerated": false, "ratio": 4.548611111111111, "...
from django.template import Library from badges.utils import badge_count from badges.models import LEVEL_CHOICES, Badge level_choices = dict(LEVEL_CHOICES) register = Library() @register.filter def is_in(value,arg): return value in arg @register.filter def level_count(badges, level): return badges.filter(lev...
{ "repo_name": "ngageoint/gamification-server", "path": "gamification/badges/templatetags/badges_tags.py", "copies": "1", "size": "1314", "license": "mit", "hash": -319996999755163460, "line_mean": 23.8113207547, "line_max": 76, "alpha_frac": 0.7404870624, "autogenerated": false, "ratio": 3.220588...
from django.template import Library from datetime import date from pari.faces.models import get_pinned_faces, get_pinned_face_images register = Library() @register.filter def get_file_path(image): return image.image_collection_image.file.path @register.filter def get_group_image(grouped_faces): pinned_fac...
{ "repo_name": "RuralIndia/pari", "path": "pari/faces/templatetags/faces_filters.py", "copies": "1", "size": "1773", "license": "bsd-3-clause", "hash": 5163527016806245000, "line_mean": 25.8636363636, "line_max": 86, "alpha_frac": 0.7005076142, "autogenerated": false, "ratio": 3.094240837696335, ...
from django.template import Library from django.conf import settings from django.contrib.auth.models import User from notification.models import NoticeType, get_notification_setting, NOTICE_MEDIA, NoticeSetting register = Library() @register.assignment_tag(takes_context=True) def notification_settings(context): '...
{ "repo_name": "arctelix/django-notification-automated", "path": "notification/templatetags/notification_tags.py", "copies": "1", "size": "1199", "license": "mit", "hash": 868235550819953900, "line_mean": 36.5, "line_max": 97, "alpha_frac": 0.658882402, "autogenerated": false, "ratio": 4.408088235...
from django.template import Library from django.conf import settings from django.contrib.sites.models import Site register = Library() CSS_URL = getattr(settings, 'BOOTSTRAP_CSS_URL', '') JS_URL = getattr(settings, 'BOOTSTRAP_JS_URL', '') @register.inclusion_tag('bootstrap/styles.inc.html') def bootstrap_styles(): ...
{ "repo_name": "iamsteadman/bambu-bootstrap", "path": "bambu_bootstrap/templatetags/bootstrap.py", "copies": "1", "size": "3046", "license": "apache-2.0", "hash": -5402123717701655000, "line_mean": 26.9541284404, "line_max": 109, "alpha_frac": 0.6214707814, "autogenerated": false, "ratio": 3.69212...
from django.template import Library from django.conf import settings from django import template from django.core.exceptions import ImproperlyConfigured from urllib import quote import socket from django.contrib.contenttypes.models import ContentType from django.contrib.sites.models import Site import re register = Li...
{ "repo_name": "arctelix/django-notification-automated", "path": "notification/templatetags/email.py", "copies": "1", "size": "7004", "license": "mit", "hash": 6060823222941587000, "line_mean": 40.9401197605, "line_max": 105, "alpha_frac": 0.6353512279, "autogenerated": false, "ratio": 3.705820105...
from django.template import Library #from django.conf import settings from djflow.apptools.models import ImageButton register = Library() def form_ext(form): ''' This will insert a form, in a bit more sophisticated way than {{ form }}. Required and optional fields are displayed differently. For details, ...
{ "repo_name": "glasslion/djflow", "path": "djflow/apptools/templatetags/apptools_lib.py", "copies": "1", "size": "2915", "license": "bsd-3-clause", "hash": -3668682590643821600, "line_mean": 29.0515463918, "line_max": 111, "alpha_frac": 0.661406518, "autogenerated": false, "ratio": 4.071229050279...
from django.template import Library #from django.conf import settings from goflow.apptools.models import ImageButton register = Library() def form_ext(form): ''' This will insert a form, in a bit more sophisticated way than {{ form }}. Required and optional fields are displayed differently. For details, ...
{ "repo_name": "mikewolfli/django-goflow", "path": "goflow/apptools/templatetags/apptools_lib.py", "copies": "1", "size": "2897", "license": "bsd-3-clause", "hash": 2875779041030860000, "line_mean": 28.8659793814, "line_max": 111, "alpha_frac": 0.661373835, "autogenerated": false, "ratio": 4.05174...
from django.template import Library from django.conf import settings from satchmo_store.contact.models import Contact from livesettings import config_value import sys register = Library() def show_tracker(secure=False): """ Output the google tracker code. """ return({"GOOGLE_CODE": config_value('GOOGL...
{ "repo_name": "ringemup/satchmo", "path": "satchmo/apps/satchmo_store/shop/templatetags/satchmo_google.py", "copies": "4", "size": "3052", "license": "bsd-3-clause", "hash": -7905211442286115000, "line_mean": 32.5384615385, "line_max": 183, "alpha_frac": 0.6641546527, "autogenerated": false, "rat...
from django.template import Library from django.conf import settings import json as parse_json from exile_ui.admin import admin_site, ExTabular, ExStacked import operator register = Library() @register.filter(name='is_exinline') def is_exinline(obj): print type(obj.opts).__bases__ bases = type(obj.opts).__bas...
{ "repo_name": "exildev/Piscix", "path": "exile_ui/templatetags/exfilters.py", "copies": "2", "size": "3626", "license": "mit", "hash": -7107530981382931000, "line_mean": 25.6617647059, "line_max": 119, "alpha_frac": 0.5741864313, "autogenerated": false, "ratio": 3.446768060836502, "config_test"...
from django.template import Library from django.conf import settings import json as parse_json from exile_ui.admin import admin_site import operator try: from exile_ui.admin import ExTabular, ExStacked except: pass # endtry register = Library() @register.filter(name='is_exinline') def is_exinline(obj): pr...
{ "repo_name": "exildev/webpage", "path": "exile_ui/templatetags/exfilters.py", "copies": "1", "size": "4193", "license": "mit", "hash": 2976367389538655000, "line_mean": 25.3710691824, "line_max": 119, "alpha_frac": 0.5633198187, "autogenerated": false, "ratio": 3.4825581395348837, "config_test...
from django.template import Library from django.conf import settings def _getdefault(name, default=None): try: default = getattr(settings, name) except: pass return default SHOW_DEPTH = _getdefault('NAVBAR_TREE_SHOW_DEPTH', -1) numbers = ['zero', 'one', 'two', 'three', 'four', 'five', 'six', 'sev...
{ "repo_name": "eculver/django-navbar", "path": "build/lib/navbar/templatetags/navbar.py", "copies": "4", "size": "1828", "license": "mit", "hash": -5210680439063265000, "line_mean": 28.4838709677, "line_max": 73, "alpha_frac": 0.6329321663, "autogenerated": false, "ratio": 3.3664825046040514, "...
from django.template import Library from django.conf import settings from .. import models from .. import utils register = Library() @register.filter def account_name(user): """ Helper filter for rendering a user object independently of the unicode-version of that object. """ return utils.get_a...
{ "repo_name": "zerok/pyconde-website-mirror", "path": "pyconde/accounts/templatetags/account_tags.py", "copies": "1", "size": "1138", "license": "bsd-3-clause", "hash": -3628453888186546700, "line_mean": 25.4651162791, "line_max": 82, "alpha_frac": 0.6502636204, "autogenerated": false, "ratio": 4...
from django.template import Library from django.conf import settings from .. import models from .. import utils register = Library() @register.filter def display_name(user): return utils.get_display_name(user) @register.filter def full_name(user): return utils.get_full_name(user) @register.filter def a...
{ "repo_name": "EuroPython/djep", "path": "pyconde/accounts/templatetags/account_tags.py", "copies": "1", "size": "1179", "license": "bsd-3-clause", "hash": -5912684209399631000, "line_mean": 23.0612244898, "line_max": 82, "alpha_frac": 0.6590330789, "autogenerated": false, "ratio": 3.778846153846...
from django.template import Library from django.conf import settings if "django.contrib.sites" in settings.INSTALLED_APPS: from django.contrib.sites.models import Site current_domain = lambda: Site.objects.get_current().domain elif getattr(settings, "SITE_DOMAIN", None): current_domain = lambda: settings....
{ "repo_name": "Rootbuzz/Django-Socialtags", "path": "templatetags/social_tags.py", "copies": "1", "size": "1440", "license": "mit", "hash": -5398549615336150000, "line_mean": 24.7321428571, "line_max": 62, "alpha_frac": 0.6902777778, "autogenerated": false, "ratio": 3.5910224438902745, "config_...
from django.template import Library from django.conf import settings register = Library() @register.inclusion_tag('admin/templatetags/themes/theme.css.html') def foundation_theme(variables={}, theme="default"): # TODO Fetch from settings defaults = { 'dark_blue': '#417690', 'light_blue': '#79...
{ "repo_name": "commite/django-foundation-admin", "path": "foundation_admin/templatetags/foundation_theme.py", "copies": "1", "size": "1225", "license": "apache-2.0", "hash": -2076665629026565600, "line_mean": 28.8780487805, "line_max": 67, "alpha_frac": 0.5853061224, "autogenerated": false, "rati...
from django.template import Library from django.contrib.admin.templatetags.admin_list import (result_hidden_fields, ResultList, items_for_result, result_headers) from django.db.models.fields import FieldDoesNotExist from mongodbforms.documentoptions import patc...
{ "repo_name": "carlware/django-mongoadmin", "path": "mongoadmin/templatetags/documenttags.py", "copies": "4", "size": "2218", "license": "bsd-3-clause", "hash": 1512681999669484500, "line_mean": 35.3606557377, "line_max": 109, "alpha_frac": 0.6469792606, "autogenerated": false, "ratio": 4.1303538...
from django.template import Library from django.contrib.contenttypes.models import ContentType register = Library() @register.filter def contenttype(obj): return ContentType.objects.get_for_model(obj) # truncatesmart from http://www.djangosnippets.org/snippets/1259/ @register.filter def truncatesmart(value, limi...
{ "repo_name": "maxcutler/Courant-News", "path": "courant/core/utils/templatetags/common_filters.py", "copies": "1", "size": "5083", "license": "bsd-3-clause", "hash": 4474976148796879000, "line_mean": 23.2095238095, "line_max": 80, "alpha_frac": 0.4902616565, "autogenerated": false, "ratio": 3.31...
from django.template import Library from django.core.urlresolvers import resolve from django.conf import settings import re register = Library() @register.simple_tag def renavactive(request, pattern): """ {% renavactive request "^/a_regex" %} """ if re.search(pattern, request.path): return ge...
{ "repo_name": "geelweb/django-navhelper", "path": "src/geelweb/django/navhelper/templatetags/navactive.py", "copies": "1", "size": "1649", "license": "mit", "hash": -451215149172609400, "line_mean": 39.2195121951, "line_max": 132, "alpha_frac": 0.6773802304, "autogenerated": false, "ratio": 3.632...
from django.template import Library from django.core.urlresolvers import reverse from django.conf import settings import r66.models menu = {} menu["home"] = ["interfaces", "bridges", "search", "ppp3g", "success"] menu["about"] = [] menu["bridges"] = ["bridge_profiles"] menu["interfaces"] = ["interface_profiles"] men...
{ "repo_name": "ataka-team/django-r66", "path": "r66/templatetags/r66_extras.py", "copies": "1", "size": "4237", "license": "mit", "hash": 9083368766368517000, "line_mean": 31.3435114504, "line_max": 106, "alpha_frac": 0.451970734, "autogenerated": false, "ratio": 3.416935483870968, "config_test...
from django.template import Library from django.db.models import Count from django.core.exceptions import FieldError from taggit import VERSION as TAGGIT_VERSION from taggit.managers import TaggableManager from taggit.models import TaggedItem, Tag T_MAX = 6.0 T_MIN = 2.0 register = Library() def get_weight_fun(t_min...
{ "repo_name": "iamsteadman/bambu-blog", "path": "bambu_blog/templatetags/blog.py", "copies": "1", "size": "1326", "license": "apache-2.0", "hash": -5625440498009917000, "line_mean": 27.847826087, "line_max": 84, "alpha_frac": 0.6025641026, "autogenerated": false, "ratio": 3.2106537530266346, "c...
from django.template import Library from django_flickr_gallery.base import Photoset from django_flickr_gallery import models from django_flickr_gallery import settings register = Library() PAGE_FIELD = getattr(settings, 'PAGE_FIELD') @register.inclusion_tag("gallery/flickr/tags/dummy.html", takes_context=True) def...
{ "repo_name": "arkanister/django-flickr-gallery", "path": "django_flickr_gallery/templatetags/flickr_tags.py", "copies": "1", "size": "3165", "license": "bsd-3-clause", "hash": 1589854367134402600, "line_mean": 29.4326923077, "line_max": 117, "alpha_frac": 0.6426540284, "autogenerated": false, "r...
from django.template import Library from django.forms.models import model_to_dict from django.contrib.auth.models import User from books.models import Book from libraries.models import BookCopy, Lending, Reading register = Library() @register.inclusion_tag('books/tags/book_tag.html') def render_book(book: Book): ...
{ "repo_name": "Nuurek/HomeLibrary", "path": "books/templatetags/books.py", "copies": "1", "size": "2412", "license": "mit", "hash": 4131497053998119000, "line_mean": 36.6875, "line_max": 116, "alpha_frac": 0.6853233831, "autogenerated": false, "ratio": 3.406779661016949, "config_test": false, ...
from django.template import Library from django.forms.widgets import CheckboxInput, ClearableFileInput, CheckboxSelectMultiple from django.forms import DateTimeField, DateField, FileField, TextInput, EmailField from django.utils.safestring import mark_safe register = Library() @register.filter() def is_checkbox(field...
{ "repo_name": "iamsteadman/bambu-bootstrap", "path": "bambu_bootstrap/templatetags/forms.py", "copies": "1", "size": "1201", "license": "apache-2.0", "hash": 1956449632321136600, "line_mean": 33.3428571429, "line_max": 90, "alpha_frac": 0.7243963364, "autogenerated": false, "ratio": 3.93770491803...
from django.template import Library from django import template from django.conf import settings def _getdefault(name, default=None): try: default = getattr(settings, name) except: pass return default SHOW_DEPTH = _getdefault('NAVBAR_TREE_SHOW_DEPTH', -1) numbers = ['zero', 'one', 'two',...
{ "repo_name": "coordt/django-navbar", "path": "navbar/templatetags/navbar_tags.py", "copies": "1", "size": "3568", "license": "mit", "hash": -7750636975674019000, "line_mean": 23.7777777778, "line_max": 73, "alpha_frac": 0.6264013453, "autogenerated": false, "ratio": 3.49119373776908, "config_t...
from django.template import Library from django import template from django.db.models import get_model from articles.models import Article, Issue from catalog.models import Subscription from django.contrib.auth.decorators import login_required from django.template import Context, loader from django.http import HttpResp...
{ "repo_name": "davogler/POSTv3", "path": "catalog/templatetags/catalog_tags.py", "copies": "1", "size": "1306", "license": "mit", "hash": -4177930353970653000, "line_mean": 31.65, "line_max": 107, "alpha_frac": 0.7664624809, "autogenerated": false, "ratio": 3.6997167138810196, "config_test": tr...
from django.template import Library from django import template from django.db.models import get_model from articles.models import Article, Issue from django.contrib.auth.decorators import login_required from django.template import Context, loader from django.http import HttpResponse from django.template import Request...
{ "repo_name": "davogler/POSTv3", "path": "articles/templatetags/article_tags.py", "copies": "1", "size": "2120", "license": "mit", "hash": 687109941604219800, "line_mean": 34.3333333333, "line_max": 112, "alpha_frac": 0.7462264151, "autogenerated": false, "ratio": 3.745583038869258, "config_tes...
from django.template import Library from django import template from django.db.models import get_model from django.contrib.auth.decorators import login_required from django.template import Context, loader from django.http import HttpResponse from django.template import RequestContext from django.core.exceptions import ...
{ "repo_name": "davogler/POSTv3", "path": "orders/templatetags/order_tags.py", "copies": "1", "size": "5104", "license": "mit", "hash": 6986950675381904000, "line_mean": 26.8907103825, "line_max": 104, "alpha_frac": 0.6694749216, "autogenerated": false, "ratio": 3.780740740740741, "config_test":...
from django.template import Library from django import template from django.template import Library, Node, Variable, loader from django.template.context import Context import datetime from datetime import date from dateutil.relativedelta import relativedelta from django.db.models import Max from orders.models import ...
{ "repo_name": "davogler/POSTv3", "path": "customers/templatetags/customer_tags.py", "copies": "1", "size": "1440", "license": "mit", "hash": 6921371444837772000, "line_mean": 24.7321428571, "line_max": 97, "alpha_frac": 0.6743055556, "autogenerated": false, "ratio": 3.9452054794520546, "config_...
from django.template import Library from django.template.base import Node, TemplateSyntaxError from sass_processor.processor import SassProcessor try: FileNotFoundError except NameError: FileNotFoundError = IOError register = Library() class SassSrcNode(Node): def __init__(self, path): self.sass...
{ "repo_name": "jrief/django-sass-processor", "path": "sass_processor/templatetags/sass_tags.py", "copies": "1", "size": "1520", "license": "mit", "hash": 8688048814709084000, "line_mean": 31.3404255319, "line_max": 107, "alpha_frac": 0.6664473684, "autogenerated": false, "ratio": 3.91752577319587...
from django.template import Library from django.template.defaultfilters import stringfilter from django.utils.html import conditional_escape from django.utils.safestring import mark_safe from storitell.cust_comments.models import CommentWithRank from storitell.quotes.models import Quote import re register = Library() ...
{ "repo_name": "esten/StoriTell", "path": "StoriTell/stories/templatetags/stories_extras.py", "copies": "1", "size": "1308", "license": "bsd-3-clause", "hash": -6401917403891976000, "line_mean": 29.4418604651, "line_max": 115, "alpha_frac": 0.7071865443, "autogenerated": false, "ratio": 3.54471544...
from django.template import Library from django.template.defaultfilters import stringfilter from django.utils.safestring import SafeData, mark_safe from django.utils.text import normalize_newlines from django.utils.html import escape from django.shortcuts import get_object_or_404 from invoice import models register =...
{ "repo_name": "pickleshb/PyInvoice", "path": "invoice/templatetags/invoice_tags.py", "copies": "1", "size": "1267", "license": "mit", "hash": -2131243303312491300, "line_mean": 27.1555555556, "line_max": 71, "alpha_frac": 0.726124704, "autogenerated": false, "ratio": 3.62, "config_test": false,...
from django.template import Library from django.template import Node, NodeList, Template, Context from django.template import TemplateSyntaxError, VariableDoesNotExist, BLOCK_TAG_START, BLOCK_TAG_END, VARIABLE_TAG_START, VARIABLE_TAG_END, SINGLE_BRACE_START, SINGLE_BRACE_END, COMMENT_TAG_START, COMMENT_TAG_END registe...
{ "repo_name": "zhiyzhan/micolog", "path": "app/recurse.py", "copies": "13", "size": "8374", "license": "mit", "hash": 1573828978455923700, "line_mean": 39.2596153846, "line_max": 213, "alpha_frac": 0.5767852878, "autogenerated": false, "ratio": 4.231430015159171, "config_test": false, "has_no...
from django.template import Library from django.template import RequestContext from gabaluu.synopsis.models import Election from gabaluu.synopsis.models import Synopsis # Setup register function for inclusion tags register = Library() @register.inclusion_tag('questions/comment.html') def render_comment(comment): ...
{ "repo_name": "CarlosGabaldon/zenopsis", "path": "synopsis/templatetags/model_tags.py", "copies": "1", "size": "5303", "license": "bsd-3-clause", "hash": -61543317660267096, "line_mean": 21.281512605, "line_max": 88, "alpha_frac": 0.6087120498, "autogenerated": false, "ratio": 3.8399710354815353,...
from django.template import Library from django.template import TemplateSyntaxError from django.conf import settings from importlib import import_module # works for Python >= 2.7 try: from django.template import InvalidTemplateLibrary except: # 1.8 # later it will change again... # > 1.8 from django.temp...
{ "repo_name": "philippeowagner/django-smart-load-tag", "path": "smart_load_tag/utils.py", "copies": "1", "size": "4849", "license": "bsd-3-clause", "hash": 5661978049069862000, "line_mean": 33.8848920863, "line_max": 121, "alpha_frac": 0.6207465457, "autogenerated": false, "ratio": 4.162231759656...
from django.template import Library from django.template.loader import get_template from django.utils.translation import ugettext_lazy as _ import datetime from openinghours.models import WEEKDAYS, OpeningHours from openinghours import utils register = Library() @register.filter(expects_localtime=True) def iso_day...
{ "repo_name": "arteria/django-openinghours", "path": "openinghours/templatetags/openinghours_tags.py", "copies": "1", "size": "5491", "license": "mit", "hash": 2971313469013464000, "line_mean": 30.7398843931, "line_max": 81, "alpha_frac": 0.5640138408, "autogenerated": false, "ratio": 3.650930851...
from django.template import Library from django.templatetags import i18n from django.utils.translation import get_language from polling_stations.i18n.cy import MUTATIONS, WelshMutationContextHelper register = Library() # Start with everything in the original i18n module register.filters.update(i18n.register.filters)...
{ "repo_name": "DemocracyClub/UK-Polling-Stations", "path": "polling_stations/templatetags/i18n_with_welsh.py", "copies": "1", "size": "2908", "license": "bsd-3-clause", "hash": 1655326334364658000, "line_mean": 40.5142857143, "line_max": 87, "alpha_frac": 0.7078458362, "autogenerated": false, "ra...
from django.template import Library from django.urls import resolve from django.template.defaultfilters import urlencode from django.template.loader import render_to_string from django_social_share.templatetags.social_share import _build_url from el_pagination.templatetags.el_pagination_tags import show_pages, paginate...
{ "repo_name": "APSL/puput", "path": "puput/templatetags/puput_tags.py", "copies": "1", "size": "4351", "license": "mit", "hash": 2382057970049059000, "line_mean": 33.808, "line_max": 104, "alpha_frac": 0.7069639163, "autogenerated": false, "ratio": 3.5088709677419354, "config_test": false, "h...
from django.template import Library from django.urls import resolve from django.template.loader import render_to_string from django.template.defaultfilters import urlencode from django_social_share.templatetags.social_share import _build_url from el_pagination.templatetags.el_pagination_tags import show_pages, paginate...
{ "repo_name": "csalom/puput", "path": "puput/templatetags/puput_tags.py", "copies": "1", "size": "3981", "license": "mit", "hash": 8020134943856742000, "line_mean": 32.7372881356, "line_max": 104, "alpha_frac": 0.7081135393, "autogenerated": false, "ratio": 3.3909710391822827, "config_test": fa...
from django.template import Library from django.urls import reverse from django.shortcuts import get_object_or_404 from video.models import TaggedVideo from video.forms import VideoUploadForm, VideoUploadTagForm register = Library() @register.inclusion_tag("video/uploadform.html") def uploadform(identifier=None, red...
{ "repo_name": "stevecassidy/signbank-video", "path": "video/templatetags/videotags.py", "copies": "1", "size": "1054", "license": "bsd-3-clause", "hash": 6119560779253437000, "line_mean": 24.7073170732, "line_max": 84, "alpha_frac": 0.665085389, "autogenerated": false, "ratio": 3.947565543071161,...
from django.template import Library from django.urls import reverse from ..forms import AttachmentForm from ..models import Attachment from ..views import add_url_for_obj register = Library() @register.inclusion_tag("attachments/add_form.html", takes_context=True) def attachment_form(context, obj, **kwargs): ""...
{ "repo_name": "bartTC/django-attachments", "path": "attachments/templatetags/attachments_tags.py", "copies": "2", "size": "2390", "license": "bsd-3-clause", "hash": -1074872601587397600, "line_mean": 31.2972972973, "line_max": 78, "alpha_frac": 0.6656903766, "autogenerated": false, "ratio": 4.163...
from django.template import Library from django.urls import reverse, NoReverseMatch from django.utils.encoding import smart_text from django.utils.safestring import mark_safe from django.contrib.admin.utils import lookup_field from django.core.exceptions import ObjectDoesNotExist from ..utils import get_admin_url, Gen...
{ "repo_name": "treyhunner/django-relatives", "path": "relatives/templatetags/relatives.py", "copies": "1", "size": "2771", "license": "mit", "hash": 3827327615918434000, "line_mean": 31.2209302326, "line_max": 78, "alpha_frac": 0.5965355467, "autogenerated": false, "ratio": 4.142002989536622, "...
from django.template import Library from django.utils.encoding import force_unicode import re register = Library() re_widont = re.compile(r'\s+(\S+\s*)$') def widont(value, count=1): """ Adds an HTML non-breaking space between the final two words of the string to avoid "widowed" words. Examples: ...
{ "repo_name": "yongshengwang/builthue", "path": "desktop/core/ext-py/django-extensions-0.5/django_extensions/templatetags/widont.py", "copies": "9", "size": "1879", "license": "apache-2.0", "hash": 4426959159472320000, "line_mean": 29.3064516129, "line_max": 161, "alpha_frac": 0.6279936136, "autoge...
from django.template import Library from django.utils.html import escape from django.utils.safestring import mark_safe from gallery.settings import ADMIN_IMAGE_SIZE from gallery.views import calculate_size register = Library() def get_size(size): if not size: return ADMIN_IMAGE_SIZE else: re...
{ "repo_name": "lucasvo/django-gallery", "path": "gallery/templatetags/gallery_extras.py", "copies": "1", "size": "1026", "license": "bsd-3-clause", "hash": 4196135481351556000, "line_mean": 21.8, "line_max": 73, "alpha_frac": 0.5955165692, "autogenerated": false, "ratio": 3.431438127090301, "co...
from django.template import Library from django.utils.html import format_html_join from ..admin.tools import admin_url_params, admin_url_params_encoded register = Library() assignment_tag = getattr(register, 'assignment_tag', register.simple_tag) def filer_actions(context): """ Track the number of times t...
{ "repo_name": "divio/django-filer", "path": "filer/templatetags/filer_admin_tags.py", "copies": "1", "size": "1702", "license": "bsd-3-clause", "hash": 940982263566161800, "line_mean": 29.9454545455, "line_max": 77, "alpha_frac": 0.7032902468, "autogenerated": false, "ratio": 3.7571743929359824, ...
from django.template import Library from django.utils.html import format_html_join from common.utils import get_image_style register = Library() @register.filter def image_style(image, style_str): image_dict = get_image_style(image, style_str) if image_dict: image_default = image_dict.get('default',...
{ "repo_name": "DylanMcCall/stuartmccall.ca", "path": "common/templatetags/image_tools.py", "copies": "1", "size": "1105", "license": "mit", "hash": 956789612127139300, "line_mean": 25.9512195122, "line_max": 62, "alpha_frac": 0.5665158371, "autogenerated": false, "ratio": 3.7457627118644066, "c...