hash stringlengths 64 64 | content stringlengths 0 1.51M |
|---|---|
4ebe83cfc20975e2584fe9953fb33e0d49706d171bd62921826459a2c369b80a | from datetime import date, timedelta
from django.template.defaultfilters import add
from django.test import SimpleTestCase
from ..utils import setup
class AddTests(SimpleTestCase):
"""
Tests for #11687 and #16676
"""
@setup({'add01': '{{ i|add:"5" }}'})
def test_add01(self):
output = se... |
961ea40add1c0c5fe12d955de645be97fd9a2a9a416e9d2ec8001601fee03e3b | from django.template.defaultfilters import iriencode, urlencode
from django.test import SimpleTestCase
from django.utils.safestring import mark_safe
from ..utils import setup
class IriencodeTests(SimpleTestCase):
"""
Ensure iriencode keeps safe strings.
"""
@setup({'iriencode01': '{{ url|iriencode }... |
5ffcee5d6ee07d72774aa13361b4f9bb0c2b6e3052ed46a0a7a248914f6b4c35 | from django.template.defaultfilters import yesno
from django.test import SimpleTestCase
class FunctionTests(SimpleTestCase):
def test_true(self):
self.assertEqual(yesno(True), 'yes')
def test_false(self):
self.assertEqual(yesno(False), 'no')
def test_none(self):
self.assertEqual... |
7ee3c1b7950d32081d2c252069d93a7ea15cb5ff30b4900ca535773ff8486fc6 | from datetime import datetime, timedelta
from django.template.defaultfilters import timeuntil_filter
from django.test import SimpleTestCase
from django.test.utils import requires_tz_support
from ..utils import setup
from .timezone_utils import TimezoneTestCase
class TimeuntilTests(TimezoneTestCase):
# Default ... |
9b6fe6323d2b20b3ec18e4494b402a7dc480ff8026c4dabf924fce44a3386acd | from django.test import SimpleTestCase
from ..utils import setup
class TruncatecharsTests(SimpleTestCase):
@setup({'truncatechars01': '{{ a|truncatechars:5 }}'})
def test_truncatechars01(self):
output = self.engine.render_to_string('truncatechars01', {'a': 'Testing, testing'})
self.assertEqu... |
c2f866faa69f3038b52b4b61fa0c26d9667e9d848d3998c3b36043e4aebb7a9d | from decimal import Decimal, localcontext
from django.template.defaultfilters import floatformat
from django.test import SimpleTestCase
from django.utils.safestring import mark_safe
from ..utils import setup
class FloatformatTests(SimpleTestCase):
@setup({'floatformat01': '{% autoescape off %}{{ a|floatformat ... |
c3f43bd1d0b168116b9370ceee3bf25f5af437f0bca2e939ee5752bd382fc5c4 | from django.template.defaultfilters import upper
from django.test import SimpleTestCase
from django.utils.safestring import mark_safe
from ..utils import setup
class UpperTests(SimpleTestCase):
"""
The "upper" filter messes up entities (which are case-sensitive),
so it's not safe for non-escaping purpose... |
de4a44fde0127bc80646f3d6186162e8bd8c9ca7737aa446d382752cd4c4a251 | from django.test import SimpleTestCase
from ..utils import setup
class JsonScriptTests(SimpleTestCase):
@setup({'json-tag01': '{{ value|json_script:"test_id" }}'})
def test_basic(self):
output = self.engine.render_to_string(
'json-tag01',
{'value': {'a': 'testing\r\njson \'st... |
0d83fed863455645706207637ad35034197cb6041406b91aadd905db4b47c2b2 | from datetime import time
from django.template.defaultfilters import time as time_filter
from django.test import SimpleTestCase, override_settings
from django.utils import timezone, translation
from ..utils import setup
from .timezone_utils import TimezoneTestCase
class TimeTests(TimezoneTestCase):
"""
#206... |
825c787c8b030285b68a7f66801caf9c88eb670a46232b6929e2c574ed627c58 | from django.template.defaultfilters import phone2numeric_filter
from django.test import SimpleTestCase
from django.utils.safestring import mark_safe
from ..utils import setup
class Phone2numericTests(SimpleTestCase):
@setup({'phone2numeric01': '{{ a|phone2numeric }} {{ b|phone2numeric }}'})
def test_phone2n... |
6e1eeb872f0e78fb9c4b0fe75ca4945aa45f395aff1791550e91aebb1ae7e658 | from django.template.defaultfilters import dictsort
from django.test import SimpleTestCase
class FunctionTests(SimpleTestCase):
def test_sort(self):
sorted_dicts = dictsort(
[{'age': 23, 'name': 'Barbara-Ann'},
{'age': 63, 'name': 'Ra Ra Rasputin'},
{'name': 'Jonny B... |
6a645e9c3549a8194de025374eeee69728b56d218f924feba3b817ee93e8bfc3 | from django import template
register = template.Library()
@register.tag
def badtag(parser, token):
parser.parse(('endbadtag',))
parser.delete_first_token()
return BadNode()
class BadNode(template.Node):
def render(self, context):
raise template.TemplateSyntaxError('error')
|
054bc18a417a04a6b3c59f4612ec33019e934219beb05a4f7978a9d5446dcab2 | from django.template import Library, Node
register = Library()
class EchoNode(Node):
def __init__(self, contents):
self.contents = contents
def render(self, context):
return ' '.join(self.contents)
@register.tag
def echo(parser, token):
return EchoNode(token.contents.split()[1:])
reg... |
a53f59fc65e982b8867f15d4c24d2a7dabbb14407857f9025c9ddd5b9d4410f8 | import operator
from django import template
from django.template.defaultfilters import stringfilter
from django.utils.html import escape, format_html
from django.utils.safestring import mark_safe
register = template.Library()
@register.filter
@stringfilter
def trim(value, num):
return value[:num]
@register.fi... |
b3abd453edf4196826641d1422ad91759582e1e8e0a56f9ecbdc9069bf592e25 | import operator
from django.template import Engine, Library
engine = Engine(app_dirs=True)
register = Library()
@register.inclusion_tag('inclusion.html')
def inclusion_no_params():
"""Expected inclusion_no_params __doc__"""
return {"result": "inclusion_no_params - Expected result"}
inclusion_no_params.any... |
a6187c19f7c9167953157755eab51aa96d33d3fdb0630f84e1b04de5c2720942 | from django import template
register = template.Library()
@register.tag
def badtag(parser, token):
raise RuntimeError("I am a bad tag")
@register.simple_tag
def badsimpletag():
raise RuntimeError("I am a bad simpletag")
|
affe53616048492134a9ec9e0724b4f9ae8f826652f70a768727c65f709ac663 | from template_tests.utils import setup
from django.template import TemplateSyntaxError
from django.test import SimpleTestCase
class I18nGetCurrentLanguageTagTests(SimpleTestCase):
libraries = {'i18n': 'django.templatetags.i18n'}
@setup({'template': '{% load i18n %} {% get_current_language %}'})
def test... |
c47f1a7e513e9478d4186e6f92cd9250d74c5e7fe83f0affa80a85a2452c6d17 | from django.test import SimpleTestCase
from django.utils import translation
from ...utils import setup
class I18nFiltersTests(SimpleTestCase):
libraries = {
'custom': 'template_tests.templatetags.custom',
'i18n': 'django.templatetags.i18n',
}
@setup({'i18n32': '{% load i18n %}{{ "hu"|lan... |
b1fcc331a35edbcf9f093b36388735d55d86bffca15b88fcfff764d21fe64439 | from django.template import TemplateSyntaxError
from django.test import SimpleTestCase
from django.utils import translation
from ...utils import setup
class I18nGetLanguageInfoTagTests(SimpleTestCase):
libraries = {
'custom': 'template_tests.templatetags.custom',
'i18n': 'django.templatetags.i18n... |
295d3f483ea6e4ff79e7a8bc7573a444f6552670f00324e4b58a74ebf0336020 | from django.template import TemplateSyntaxError
from django.test import SimpleTestCase
from ...utils import setup
class GetAvailableLanguagesTagTests(SimpleTestCase):
libraries = {'i18n': 'django.templatetags.i18n'}
@setup({'i18n12': '{% load i18n %}'
'{% get_available_languages as lan... |
30ac0e0f78ae233ac87049a09df9ac76253f73d5c340c492fdfbd4dd408d47a1 | from django.template import Context, Template
from django.test import SimpleTestCase
from django.utils import translation
from ...utils import setup
from .base import MultipleLocaleActivationTestCase
class MultipleLocaleActivationTests(MultipleLocaleActivationTestCase):
def test_single_locale_activation(self):
... |
4910ab78389b80a9b48733bcd78bb2c2098710c08ee5ac44d826004c49471e76 | import os
from django.conf import settings
from django.test import SimpleTestCase
from django.utils.translation import activate, get_language
here = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
pdir = os.path.split(os.path.split(os.path.abspath(here))[0])[0]
extended_locale_paths = settings.LOCALE_PATH... |
f70dd7f125d3352b58d7a830b1f651ef65c69f447407556e7a797436500ae312 | from template_tests.utils import setup
from django.template import TemplateSyntaxError
from django.test import SimpleTestCase
class I18nGetCurrentLanguageBidiTagTests(SimpleTestCase):
libraries = {'i18n': 'django.templatetags.i18n'}
@setup({'template': '{% load i18n %} {% get_current_language_bidi %}'})
... |
ee31889bedc95f5de72798feee15de98ccbfbdc600e6476d1eb1ff96820dec92 | from template_tests.utils import setup
from django.template import TemplateSyntaxError
from django.test import SimpleTestCase
class I18nLanguageTagTests(SimpleTestCase):
libraries = {'i18n': 'django.templatetags.i18n'}
@setup({'i18n_language': '{% load i18n %} {% language %} {% endlanguage %}'})
def tes... |
634c9c692014e38e195cbb6a71e51e29d5a6fa51c66e7fa4f93dfa59aea6d664 | import os
from threading import local
from django.template import Context, Template, TemplateSyntaxError
from django.test import SimpleTestCase, override_settings
from django.utils import translation
from django.utils.safestring import mark_safe
from django.utils.translation import trans_real
from ...utils import set... |
326c53475c95b8f84356e39b105343d96ec5d462578351f64360c3886897acae | from threading import local
from django.template import Context, Template, TemplateSyntaxError
from django.templatetags.l10n import LocalizeNode
from django.test import SimpleTestCase, override_settings
from django.utils import translation
from django.utils.safestring import mark_safe
from django.utils.translation imp... |
2dfb230e6858e7285a11c7061b6d52c2cae90fce40dced297efacbc20fc4c999 | from django.template import TemplateSyntaxError
from django.test import SimpleTestCase
from django.utils import translation
from ...utils import setup
class GetLanguageInfoListTests(SimpleTestCase):
libraries = {
'custom': 'template_tests.templatetags.custom',
'i18n': 'django.templatetags.i18n',
... |
5a63962d0eb1f6e6a3e97ea426a14dd663669259a92043f592063bf386eda015 | from django import template
register = template.Library()
@register.simple_tag
def echo2(arg):
return arg
|
6475f2c2b9dac457327982e1439ee558e4addd045886c53dadfde214130211d6 | from django.conf.urls import url
from django.contrib.sitemaps import views
from .http import simple_sitemaps
urlpatterns = [
url(r'^simple/index\.xml$', views.index, {'sitemaps': simple_sitemaps},
name='django.contrib.sitemaps.views.index'),
]
|
e801c848cf78d9cfedce5ad18e4c4b54363d9128e5210678f7adddedefe8faa1 | from django.conf.urls import url
from django.contrib.sitemaps import views
from .http import SimpleSitemap
class HTTPSSitemap(SimpleSitemap):
protocol = 'https'
secure_sitemaps = {
'simple': HTTPSSitemap,
}
urlpatterns = [
url(r'^secure/index\.xml$', views.index, {'sitemaps': secure_sitemaps}),
ur... |
5415443769e380e054eb13adeea9b652317b70916b3b5f86b0ade80ee647e7bb | from collections import OrderedDict
from datetime import date, datetime
from django.conf.urls import url
from django.conf.urls.i18n import i18n_patterns
from django.contrib.sitemaps import GenericSitemap, Sitemap, views
from django.http import HttpResponse
from django.utils import timezone
from django.views.decorators... |
06375ec2cb258edd0b21e7e38b105e9bd24dd2492084fbe6ac81138f719d5db6 | urlpatterns = []
|
a75200bc7e77ef6fd372aca588ceff627c4d1468c17e4f26cb4c46f393e5aeb9 | import unittest
from django.db import connection
from django.db.models.fields import BooleanField, NullBooleanField
from django.db.utils import DatabaseError
from django.test import TransactionTestCase
from ..models import Square
@unittest.skipUnless(connection.vendor == 'oracle', 'Oracle tests')
class Tests(unitte... |
f023340afea15ef96ce6ca98253023966500114e181b7e1da89d96adb2417550 | import unittest
from django.db import connection
@unittest.skipUnless(connection.vendor == 'oracle', 'Oracle tests')
class OperationsTests(unittest.TestCase):
def test_sequence_name_truncation(self):
seq_name = connection.ops._get_no_autofield_sequence_name('schema_authorwithevenlongee869')
self... |
d670e40276717cca9bdf5244a839bacb50a7b3cba4f995b3624b15bedd0a3779 | import unittest
from django.db import connection
from django.test import TransactionTestCase
from ..models import Person
@unittest.skipUnless(connection.vendor == 'oracle', 'Oracle tests')
class DatabaseSequenceTests(TransactionTestCase):
available_apps = []
def test_get_sequences(self):
with conne... |
a24d68ec2fef133129c31f2ac5f6c86c0ead77a53041f2ee71b233b2de52436d | import unittest
from io import StringIO
from unittest import mock
from django.db import connection
from django.db.backends.oracle.creation import DatabaseCreation
from django.db.utils import DatabaseError
from django.test import TestCase
@unittest.skipUnless(connection.vendor == 'oracle', 'Oracle tests')
@mock.patch... |
9018732b3c99f1cae990a4712e4358081d32dd8136d77a48a0ff486c46e2b04c | import re
import threading
import unittest
from django.db import connection
from django.db.models import Avg, StdDev, Sum, Variance
from django.db.models.fields import CharField
from django.db.utils import NotSupportedError
from django.test import TestCase, TransactionTestCase, override_settings
from django.test.utils... |
95fce282b61e4108a06736e6ea38d8df65aeda9bb85bcc291cc91da4fbb18d41 | import unittest
from django.db import connection
from django.test import TestCase
@unittest.skipUnless(connection.vendor == 'sqlite', 'SQLite tests')
class IntrospectionTests(TestCase):
def test_get_primary_key_column(self):
"""
Get the primary key column regardless of whether or not it has
... |
a5c1b1644162a77c79c19aad76363edb71d1b5fa2b5c1acadfa783eec45e709e | import decimal
from django.db import NotSupportedError, connection
from django.db.backends.base.operations import BaseDatabaseOperations
from django.db.models import DurationField
from django.test import SimpleTestCase, override_settings, skipIfDBFeature
from django.utils import timezone
class DatabaseOperationTests... |
99a1a3bc1d52eeef1250c2f6a4b969e3ba097a0a3c21949573ff52ba6ee9e5b3 | from unittest.mock import MagicMock
from django.db import DEFAULT_DB_ALIAS, connection, connections
from django.db.backends.base.base import BaseDatabaseWrapper
from django.test import SimpleTestCase, TestCase
from ..models import Square
class DatabaseWrapperTests(SimpleTestCase):
def test_initialization_class... |
dcdee321445333e7e612d41fc5a02dfb0e38b578dd377946e5bbb3bcae0a9db3 | from django.db import connection
from django.test import TestCase
class TestDatabaseFeatures(TestCase):
def test_nonexistent_feature(self):
self.assertFalse(hasattr(connection.features, 'nonexistent'))
|
902846511c86ba84b8b64a94223752a9eea995c6d5a76e2e67ac83aa8c3c241e | import copy
from django.db import DEFAULT_DB_ALIAS, connections
from django.db.backends.base.creation import (
TEST_DATABASE_PREFIX, BaseDatabaseCreation,
)
from django.test import SimpleTestCase
class TestDbSignatureTests(SimpleTestCase):
def get_connection_copy(self):
# Get a copy of the default c... |
e74aee67430236fb9c61c321a05030abd0a6d650a43e432ed13269b021be3fb4 | import unittest
from contextlib import contextmanager
from django.core.exceptions import ImproperlyConfigured
from django.db import connection
from django.test import TestCase, override_settings
@contextmanager
def get_connection():
new_connection = connection.copy()
yield new_connection
new_connection.c... |
073392542a45def25ac1e646d55bb04dd398bb70a1eff19970b230a1711f5293 | import unittest
from django.db import connection
from django.test import TestCase
@unittest.skipUnless(connection.vendor == 'mysql', 'MySQL tests')
class SchemaEditorTests(TestCase):
def test_quote_value(self):
editor = connection.schema_editor()
tested_values = [
('string', "'string'... |
d5dbaef3118384c1b1796ff8f1dd0d640f9e315aa4941f63ff48189695bf6755 | from unittest import mock, skipUnless
from django.db import connection
from django.db.backends.mysql.features import DatabaseFeatures
from django.test import TestCase
@skipUnless(connection.vendor == 'mysql', 'MySQL tests')
class TestFeatures(TestCase):
def test_supports_transactions(self):
"""
... |
8a677c4f7d7b226ba6d1fb882172a2bbcd1440d26d5d16feeef0968421e33b0b | import unittest
from io import StringIO
from unittest import mock
from django.db import connection
from django.db.backends.base.creation import BaseDatabaseCreation
from django.db.backends.mysql.creation import DatabaseCreation
from django.db.utils import DatabaseError
from django.test import SimpleTestCase
@unittes... |
8ee01153d30f0815db6393682b6672c9bbc4451905795e0c44baefc50fa7140d | import unittest
from unittest import mock
from django.core.exceptions import ImproperlyConfigured
from django.db import DatabaseError, connection, connections
from django.test import TestCase
@unittest.skipUnless(connection.vendor == 'postgresql', 'PostgreSQL tests')
class Tests(TestCase):
def test_nodb_connect... |
11456b1ebfee60828ed93f365ddf394590d89b7230dc0ad071d683ccc5e6daf9 | import unittest
from django.db import connection
from django.test import TestCase
from ..models import Person
@unittest.skipUnless(connection.vendor == 'postgresql', "Test only for PostgreSQL")
class DatabaseSequenceTests(TestCase):
def test_get_sequences(self):
with connection.cursor() as cursor:
... |
947b9912ecee3b95d8185d1ba98ee9c2af108549ddbab1afe9c208b4aa1d4e2f | import operator
import unittest
from collections import namedtuple
from contextlib import contextmanager
from django.db import connection, models
from django.test import TestCase
from ..models import Person
@unittest.skipUnless(connection.vendor == 'postgresql', 'PostgreSQL tests')
class ServerSideCursorsPostgres(T... |
57181c4791e6303921691493a6b4f8b3da40a67877471ad439795fbebb85e315 | import unittest
from contextlib import contextmanager
from io import StringIO
from unittest import mock
from django.db import connection
from django.db.backends.base.creation import BaseDatabaseCreation
from django.db.utils import DatabaseError
from django.test import SimpleTestCase
try:
import psycopg2 # NOQA
e... |
314dadfab9f3b824040fc0455ef3e147b992ad958cfede78a65cf5fd513dea3b | from django.conf.urls import url
urlpatterns = [
url(r'^$', lambda x: x, name='name_with:colon'),
]
|
31da95c2de5e5437b572cd10004927a4f33ffdeea8dd4c7cbf65ae50b8088393 | urlpatterns = [
(r'^tuple/$', lambda x: x),
]
|
d43b83bd0c7aa8a77953d47c7fc724f8a12cae6dac66f33625c5da6aeb2814b8 | from django.conf.urls import include, url
urlpatterns = [
url(r'^', include([
url(r'^include-with-dollar$', include([])),
])),
]
|
75f77f4afa35fdffc381892171808acff1b579b3c109df4ed876edb91b2d0c32 | from django.conf.urls import url
from django.urls import path
urlpatterns = [
path('/path-starting-with-slash/', lambda x: x),
url(r'/url-starting-with-slash/$', lambda x: x),
]
|
5e48c09221675acbcca480c71cf7324471455990d53f6d5521e92605cde58942 | from django.conf.urls import include, url
urlpatterns = [
url(r'^include-with-dollar$', include([])),
]
|
59b5512954bcb91d43462cd9213ec01f72861d339b1844ccda6234ad74a77158 | from django.conf.urls import include, url
common_url_patterns = ([
url(r'^app-ns1/', include([])),
url(r'^app-url/', include([])),
], 'common')
nested_url_patterns = ([
url(r'^common/', include(common_url_patterns, namespace='nested')),
], 'nested')
urlpatterns = [
url(r'^app-ns1-0/', include(common_... |
95f7e34721204bf62f468a2bd35afa75af74f2d458a1adbca9a6a28dd3594944 | from django.conf.urls import include, url
common_url_patterns = ([
url(r'^app-ns1/', include([])),
url(r'^app-url/', include([])),
], 'app-ns1')
urlpatterns = [
url(r'^app-ns1-0/', include(common_url_patterns)),
url(r'^app-ns1-1/', include(common_url_patterns)),
url(r'^app-some-url/', include(([],... |
4350506dd93cbf0bed7df92a963f3dd64bc00b28ffa19d7625a4d640f3182807 | from django.conf.urls import include, url
urlpatterns = [
url(r'^foo/', lambda x: x, name='foo'),
# This dollar is ok as it is escaped
url(r'^\$', include([
url(r'^bar/$', lambda x: x, name='bar'),
])),
]
|
8ca2ea265e13d287a2d911836391661222fcdfff5dd609914b3da5bfc3de9bde | from django.urls import include, path
urlpatterns = [
path('', include([(r'^tuple/$', lambda x: x)])),
]
|
f1473300907d44b6ea0856e2e05b9dc7d4996b11fbe065657b77e59af0370315 | from django.conf.urls import url
from django.conf.urls.i18n import i18n_patterns
from django.utils.translation import gettext_lazy as _
urlpatterns = i18n_patterns(
url(_('translated/'), lambda x: x, name='i18n_prefixed'),
)
|
a36011aab6d0b3ba03946bcc922655bd8c071a4cb44bb99001bb3009afaa00cb | from django.urls import path
urlpatterns = [
path('^beginning-with-caret', lambda x: x),
]
|
10b4c8ed29317e08af4517ca8f9fbad8d89523a1552e60158ed85b3bf1ae3a85 | from django.urls import path
urlpatterns = [
path(r'(?P<named-group>\d+)', lambda x: x),
]
|
c7bc612fb0e79707e39476ee79e5b28d35e221d7123b684939181963d8a807e3 | from django.urls import path
urlpatterns = [
path('ending-with-dollar$', lambda x: x),
]
|
4a4fc571aad530585c7f10aaf5728283abae00a51324d72c2b2e0ad9cc6e8a83 | from django.db import modelz # NOQA
|
b00ae5c2a7ded872a65b0090d830c7961dc58ddea69b9f5928b660f7688d5929 | from django.core import checks
from django.db import models
class ModelRaisingMessages(models.Model):
@classmethod
def check(self, **kwargs):
return [checks.Warning('A warning')]
|
995741f02c26df5824b902ed26d141dd9737b35ebf60ecdfd2c8e7782717be0e | from django.db import models
class Bar(models.Model):
name = models.CharField(max_length=255)
class Meta:
app_label = 'app_waiting_migration'
|
b0a4912e52be289aa4c0f3305c1825aab9547e026ef7f69df40636281a0d5f2a | from django.contrib.auth.models import User
from django.db import models
# Regression for #13368. This is an example of a model
# that imports a class that has an abstract base class.
class UserProfile(models.Model):
user = models.OneToOneField(User, models.CASCADE, primary_key=True)
|
37ee725187c1123413ac2cbdaa39cf8d8535ff3171d1e55f5eefaefd7e6b7a0e | from django.core import checks
from django.db import models
class ModelRaisingMessages(models.Model):
@classmethod
def check(self, **kwargs):
return [
checks.Warning('First warning', hint='Hint', obj='obj'),
checks.Warning('Second warning', obj='a'),
checks.Error('A... |
7e2d751a10038f2c783eddbf71217047a2f71ccc5a4e611424b5d521ac9bdfec | from django.db import models
class Foo(models.Model):
name = models.CharField(max_length=255)
class Meta:
app_label = 'another_app_waiting_migration'
|
542ab2caba42e6d2f4e1697e36e7009406fde0bf8efb070ef2f02b1305661916 | from ..complex_app.models.bar import Bar
__all__ = ['Bar']
|
92ba86986d70dd86d05394bb909b4b3c3249fef14c522f212c986795b32dbc8c | # your API code
|
ebdec47943759bd2840c986d160a05bcd6fa829eb3d3023246d85cb2ab6c8e62 | # some file for {{ project_name }} test project
|
13fe5dce053df44d2ad539e414652741b63d8fa9566f6645bfb0f79026c17e92 | # Regression for #22699.
# Generated at {% now "DATE_FORMAT" %}
|
2693bc4d5c9abf3ae27e5aecc4ad4d737fbf7ac56ac970d58a3c79e3049f12b5 | # this file uses the {{ extra }} variable
|
ce74c626e5b70c1b0fceb4567823d87328c190cea7a9b78bc523d5f84c73755f | # Django settings for {{ project_name }} test project.
|
170a9cb6f7572cccc10d795eb4761aac6e7ddb118e890a9d5b196e5b0613a3ed | from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Bar',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False,... |
650d072450a2de2d3c81aeea6db91fb242010ddffa00cea0107c73b74a8889c6 | from .bar import Bar
from .foo import Foo
__all__ = ['Foo', 'Bar']
|
c9597132ffc21dff17ed1cf3641df6d34a75119a97c282bcbc1a672fc7548ff9 | from django.db import models
class Foo(models.Model):
name = models.CharField(max_length=5)
class Meta:
app_label = 'complex_app'
|
90f400d69739d5adbb2bccfb5d4724716b0690e03825f6395d99251928adf4eb | from django.db import models
class Bar(models.Model):
name = models.CharField(max_length=5)
class Meta:
app_label = 'complex_app'
|
bac6d5b6eca31bb697a010a23625b35a8faec28074da63f000f59827dd0cc891 | from django.contrib import admin
from ..models.foo import Foo
admin.site.register(Foo)
|
568f780f5ef0eae27921f6038a1b6d61c855a1b05194572248d2aa63e203212c | from django.core.management.base import BaseCommand
class Command(BaseCommand):
def handle(self, **options):
self.stdout.write('complex_app')
|
68bfefedd0336dd6f29e638e48a9f281a7c4937c2803d446efed3e8b658dbb8d | from django.core.management.commands.startproject import Command as BaseCommand
class Command(BaseCommand):
def add_arguments(self, parser):
super().add_arguments(parser)
parser.add_argument('--extra', help='An arbitrary extra value passed to the context')
|
ab983d79757d9a7c019989d6e9bfe067c931b4cc91f1140b8198a31a923722dd | from django.core.management.base import BaseCommand
class Command(BaseCommand):
help = 'Test basic commands'
requires_system_checks = False
def add_arguments(self, parser):
parser.add_argument('args', nargs='*')
parser.add_argument('--option_a', '-a', default='1')
parser.add_argum... |
c1b702883cff45987d3b421c6e24d331ce3a0717ca09da3afbad04b757afbed2 | from django.core.management.base import BaseCommand
class Command(BaseCommand):
help = "Test No-args commands"
requires_system_checks = False
def handle(self, **options):
print('EXECUTE: noargs_command options=%s' % sorted(options.items()))
|
c81147a68eca4000e5f75913edba28e1ea394af5259e27bf6bb0f49d450809a3 | from django.core.management.base import LabelCommand
class Command(LabelCommand):
help = "Test Label-based commands"
requires_system_checks = False
def handle_label(self, label, **options):
print('EXECUTE:LabelCommand label=%s, options=%s' % (label, sorted(options.items())))
|
9f94387990a88074531ffb30dd507a2238ed7dc56329c87fe9cdcd765338d619 | from django.core.management.base import AppCommand
class Command(AppCommand):
help = 'Test Application-based commands'
requires_system_checks = False
def handle_app_config(self, app_config, **options):
print('EXECUTE:AppCommand name=%s, options=%s' % (app_config.name, sorted(options.items())))
|
36c7123dc51cd7436f7a8acc259f3ce6643467eef678bf7313cd79fd576c8993 | from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Foo',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False,... |
71e1c67a2d9dce02ea52dcd6820f1b876d8bff721876a14423e2e8b6f092dd47 | from django.core.management.base import BaseCommand
class Command(BaseCommand):
def handle(self, **options):
self.stdout.write('simple_app')
|
effeb06d106cee2a673ca2f0625459f9aa5fd314eb82996b5bd602de1ec73f81 | from django.db import models
class NotInstalledModel(models.Model):
class Meta:
app_label = 'not_installed'
class RelatedModel(models.Model):
class Meta:
app_label = 'not_installed'
not_installed = models.ForeignKey(NotInstalledModel, models.CASCADE)
class M2MRelatedModel(models.Mod... |
02094a60ce74702591fcba73a6d3c205f0286ec8072db96fc420a34f171e2de7 | import os
import re
from io import StringIO
from django.contrib.gis.gdal import GDAL_VERSION, Driver, GDALException
from django.contrib.gis.utils.ogrinspect import ogrinspect
from django.core.management import call_command
from django.db import connection, connections
from django.test import TestCase, skipUnlessDBFeat... |
8bd63bd4dc023936c67970752cd080d8b3741f0332f20381d024073dcbc866a7 | from django.contrib.gis.db import models
class AllOGRFields(models.Model):
f_decimal = models.FloatField()
f_float = models.FloatField()
f_int = models.IntegerField()
f_char = models.CharField(max_length=10)
f_date = models.DateField()
f_datetime = models.DateTimeField()
f_time = models.T... |
2bc4429f489472dc099b9b5cb7a64044de9df2ed11e5559a5839590ed6d63e83 | import unittest
from django.contrib.gis.db.models.functions import (
Area, Distance, Length, Perimeter, Transform, Union,
)
from django.contrib.gis.geos import GEOSGeometry, LineString, Point
from django.contrib.gis.measure import D # alias for Distance
from django.db import NotSupportedError, connection
from dja... |
6d2b71c25f3a1afe5264973a8e0a0bd731636193f2f8fe926667c82ee37f2e46 | from django.contrib.gis.db import models
from ..utils import gisfield_may_be_null
class NamedModel(models.Model):
name = models.CharField(max_length=30)
class Meta:
abstract = True
def __str__(self):
return self.name
class SouthTexasCity(NamedModel):
"City model on projected coord... |
213423555199ce0d2aa4caa917f8a342591a3d360be18e860039f26693c0ee3b | import os
import unittest
from copy import copy
from decimal import Decimal
from django.conf import settings
from django.contrib.gis.gdal import DataSource
from django.contrib.gis.utils.layermapping import (
InvalidDecimal, InvalidString, LayerMapError, LayerMapping,
MissingForeignKey,
)
from django.db import ... |
11f43701271d42391a24afb00f21bec1080158e599ee9e031711bc8776a30405 | from django.contrib.gis.db import models
class NamedModel(models.Model):
name = models.CharField(max_length=25)
class Meta:
abstract = True
def __str__(self):
return self.name
class State(NamedModel):
pass
class County(NamedModel):
state = models.ForeignKey(State, models.CASC... |
8bcd17e9b0664992a2460d971387683da9004e4843caf3377ecf3f0032e24c09 | import os
import re
from django.contrib.gis.db.models import Extent3D, Union
from django.contrib.gis.db.models.functions import (
AsGeoJSON, AsKML, Length, Perimeter, Scale, Translate,
)
from django.contrib.gis.geos import GEOSGeometry, LineString, Point, Polygon
from django.test import TestCase, skipUnlessDBFeatu... |
34f787ed050ab3c0775a782d274cd1fe4de1f283bbfa0c01f676e529f9144d6d | from django.contrib.gis.db import models
class NamedModel(models.Model):
name = models.CharField(max_length=30)
class Meta:
abstract = True
def __str__(self):
return self.name
class City3D(NamedModel):
point = models.PointField(dim=3)
pointg = models.PointField(dim=3, geography... |
178d895e09ea16a2b47da8d77aeb72249c703accd1c682cc3642217dce19eca2 | # Create your views here.
|
f3d978e8560a292b26b504a9ab4b9789499cad4e2a53c7510b44fff207fb7244 | from django.contrib.gis.db import models
class RasterModel(models.Model):
rast = models.RasterField('A Verbose Raster Name', null=True, srid=4326, spatial_index=True, blank=True)
rastprojected = models.RasterField('A Projected Raster Table', srid=3086, null=True)
geom = models.PointField(null=True)
c... |
8c2827fc86c40c9a1683eeb7ac7f5381e0dfeabe8520f37af460f3f1aa8c2ee9 | import json
from django.contrib.gis.db.models.fields import BaseSpatialField
from django.contrib.gis.db.models.functions import Distance
from django.contrib.gis.db.models.lookups import DistanceLookupBase, GISLookup
from django.contrib.gis.gdal import GDALRaster
from django.contrib.gis.geos import GEOSGeometry
from dj... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.