hash
stringlengths
64
64
content
stringlengths
0
1.51M
3d75a72160028a17c3bd54c53088e1034b5a812e4c80c1fe38fef2cfa483e02c
from datetime import datetime from decimal import Decimal from django import forms from django.conf import settings from django.contrib.admin import helpers from django.contrib.admin.utils import ( NestedObjects, display_for_field, display_for_value, flatten, flatten_fieldsets, help_text_for_field, label_for_f...
16013120f384e055b822f449fe267d5e4ef2e36e3c01061b6629988e066f7fb5
from django.db import models from django.utils.translation import gettext_lazy as _ class Site(models.Model): domain = models.CharField(max_length=100) def __str__(self): return self.domain class Article(models.Model): """ A simple Article model for testing """ site = models.Foreign...
76690cafd6764ad4ba44ff07199c460f64db147e7fd3abc26ab253c33853e6e9
import datetime import os from decimal import Decimal from unittest import mock, skipUnless from django import forms from django.core.exceptions import ( NON_FIELD_ERRORS, FieldError, ImproperlyConfigured, ValidationError, ) from django.core.files.uploadedfile import SimpleUploadedFile from django.db import connec...
356de732d48f2b8ae0a986bec0532544a6e07d520466fd558721683f58acacbb
import datetime import os import tempfile import uuid from django.core import validators from django.core.exceptions import ValidationError from django.core.files.storage import FileSystemStorage from django.db import models temp_storage_dir = tempfile.mkdtemp() temp_storage = FileSystemStorage(temp_storage_dir) cl...
b8012205081cdc8ca3978a4413b353dcd28285bf73337a14a9c4dbe10bad5f6f
from enum import Enum from django.db.models.query_utils import Q from django.db.models.sql.query import Query __all__ = ['CheckConstraint', 'Deferrable', 'UniqueConstraint'] class BaseConstraint: def __init__(self, name): self.name = name def constraint_sql(self, model, schema_editor): rais...
849934a042b49c4191c0946d225eef2bd877f47e150601d987150fdd779dba18
import functools import inspect from functools import partial from django import forms from django.apps import apps from django.conf import SettingsReference, settings from django.core import checks, exceptions from django.db import connection, router from django.db.backends import utils from django.db.models import Q...
7a6291327f8144929ad6c8365c6ec98874b4de0814bef9a5c3796018ba2e94e3
from django.apps.registry import Apps from django.contrib.contenttypes.fields import GenericForeignKey from django.db import models from django.db.migrations.exceptions import InvalidBasesError from django.db.migrations.operations import ( AddField, AlterField, DeleteModel, RemoveField, ) from django.db.migrations....
16631be9fe1b263ddad873868e08f5fd9019ea34f7d01219ed71fb438e32e490
import os import stat import sys import tempfile import unittest from django.utils import archive class TestArchive(unittest.TestCase): def setUp(self): self.testdir = os.path.join(os.path.dirname(__file__), 'archives') self.old_cwd = os.getcwd() os.chdir(self.testdir) def tearDown(...
4ae5dc655cb504bafda42d0502b77fa5c6f3bad25c66f39103ad05c126471be9
from unittest import mock from django.core.exceptions import ValidationError from django.db import IntegrityError, connection, models from django.db.models.constraints import BaseConstraint from django.db.transaction import atomic from django.test import SimpleTestCase, TestCase, skipUnlessDBFeature from .models impo...
5cf8b27e27fa2f9147637677d890a60ca036102daf60e62ace842db59697c2b1
import itertools import json import os import re from urllib.parse import unquote from django.apps import apps from django.conf import settings from django.http import HttpResponse, HttpResponseRedirect, JsonResponse from django.template import Context, Engine from django.urls import translate_url from django.utils.fo...
042113bec17110eab0944699c8a4da487664a24b8aa9a5021a5583ac4a729cd7
import copy import datetime import inspect from decimal import Decimal from django.core.exceptions import EmptyResultSet, FieldError from django.db import NotSupportedError, connection from django.db.models import fields from django.db.models.constants import LOOKUP_SEP from django.db.models.query_utils import Q from ...
39b9fb21a41b2f4b6ffb0c4dcb470f7de36b11f5a2591251e68d7560fe345d71
import datetime import posixpath from django import forms from django.core import checks from django.core.files.base import File from django.core.files.images import ImageFile from django.core.files.storage import Storage, default_storage from django.db.models import signals from django.db.models.fields import Field f...
daeb05f3e17e2e84234ddbd95b696dd7d2a0f94f8343b12a572962d35147d31c
from collections import namedtuple import cx_Oracle from django.db import models from django.db.backends.base.introspection import ( BaseDatabaseIntrospection, FieldInfo as BaseFieldInfo, TableInfo, ) from django.utils.functional import cached_property FieldInfo = namedtuple('FieldInfo', BaseFieldInfo._fields + ...
e78526a2581e21a2e49bdb3da3db253d05980d3fa4515b8fba7cfd24442152db
""" Oracle database backend for Django. Requires cx_Oracle: https://oracle.github.io/python-cx_Oracle/ """ import datetime import decimal import os import platform from contextlib import contextmanager from django.conf import settings from django.core.exceptions import ImproperlyConfigured from django.db import Integ...
e832a098db21a233d04c04c57aa89e6ec49337d8388b4d8ee378fa341a2fdadc
import datetime import decimal from importlib import import_module import sqlparse from django.conf import settings from django.db import NotSupportedError, transaction from django.db.backends import utils from django.utils import timezone from django.utils.encoding import force_str class BaseDatabaseOperations: ...
9d7ae7e83f63a855505c54b755fa1143abcd787bca1d306195836dee3950e011
import uuid from django.conf import settings from django.db.backends.base.operations import BaseDatabaseOperations from django.utils import timezone from django.utils.encoding import force_str class DatabaseOperations(BaseDatabaseOperations): compiler_module = "django.db.backends.mysql.compiler" # MySQL sto...
b85c9fc41277557c94fed9aa1bd0f33f3ee1942b2c31bdabad6e2adcaf83d675
import datetime import decimal import uuid from functools import lru_cache from itertools import chain from django.conf import settings from django.core.exceptions import FieldError from django.db import DatabaseError, NotSupportedError, models from django.db.backends.base.operations import BaseDatabaseOperations from...
11f1947b1aa96b7c835f7210e0f571f408d55fca98f5d8d9b452f0762ab234bf
import cx_Oracle from django.db.backends.oracle.introspection import DatabaseIntrospection from django.utils.functional import cached_property class OracleIntrospection(DatabaseIntrospection): # Associating any OBJECTVAR instances with GeometryField. This won't work # right on Oracle objects that aren't MDSY...
c679561faeb1bab34b41d55e7ad748d6b2ba9fed737503ad24f888576b128e33
from datetime import date, datetime, timedelta from operator import attrgetter from django.db import IntegrityError from django.test import TestCase from .models import ( CustomMembership, Employee, Event, Friendship, Group, Ingredient, Invitation, Membership, Person, PersonSelfRefM2M, Recipe, RecipeIngredien...
744e8bcfc4b4aac028b9b182b511d4028e1e716652bc62607cfc6be5175c1766
import datetime import pickle import unittest import uuid from copy import deepcopy from unittest import mock from django.core.exceptions import FieldError from django.db import DatabaseError, NotSupportedError, connection from django.db.models import ( Avg, BooleanField, Case, CharField, Count, DateField, DateTim...
abee02e5b6ccdbab937db4da7c1061e8d3950f2b5d4b7df219d816f096d50b39
import decimal from django.core.management.color import no_style from django.db import NotSupportedError, connection, transaction from django.db.backends.base.operations import BaseDatabaseOperations from django.db.models import DurationField from django.test import ( SimpleTestCase, TestCase, TransactionTestCase,...
00db69458310e2c4039b7be74a842facb53bd82212434ac7679fb9e1f1ff96e1
import functools import inspect @functools.lru_cache(maxsize=512) def _get_signature(func): return inspect.signature(func) def get_func_args(func): sig = _get_signature(func) return [ arg_name for arg_name, param in sig.parameters.items() if param.kind == inspect.Parameter.POSITIONAL_OR_...
1edd382e6e9de61fbeffa0790240913921212b25a9960aa29fe6130b53032247
import copy import inspect import warnings from functools import partialmethod from itertools import chain import django from django.apps import apps from django.conf import settings from django.core import checks from django.core.exceptions import ( NON_FIELD_ERRORS, FieldDoesNotExist, FieldError, MultipleObjects...
5e0317a92d048715a2927ad547cf79ad86607dd6b32d5f6035a659d298df8080
import copy import datetime import inspect from decimal import Decimal from django.core.exceptions import EmptyResultSet, FieldError from django.db import NotSupportedError, connection from django.db.models import fields from django.db.models.constants import LOOKUP_SEP from django.db.models.query_utils import Q from ...
359496c7337b6dc1df7d21965cadfcbe133bb4e2194131620f08e2f668ea0e66
from django.db import NotSupportedError from django.db.models.expressions import Func, Value from django.db.models.fields import CharField, IntegerField from django.db.models.functions import Coalesce from django.db.models.lookups import Transform class MySQLSHA2Mixin: def as_mysql(self, compiler, connection, **e...
f0dd780ae7020fdeffb4b2be417e49da39bd0f8d12b0007cfc9457db0800facb
""" Create SQL statements for QuerySets. The code in here encapsulates all of the SQL construction so that QuerySets themselves do not have to (and could be backed by things other than SQL databases). The abstraction barrier only works one way: this module has to know all about the internals of models in order to get ...
09415ccaad7a3fe9802099b13ded15c6bfa77f6671b6a8d8d08e6777c8ecdc2e
from django.db import ProgrammingError from django.utils.functional import cached_property class BaseDatabaseFeatures: gis_enabled = False allows_group_by_pk = False allows_group_by_selected_pks = False empty_fetchmany_value = [] update_can_self_select = True # Does the backend distinguish be...
bad75b955d168e0153bf3380d45208d75d7b630dac603ba318c55b74d4ad0a19
import operator from django.db.backends.base.features import BaseDatabaseFeatures from django.utils.functional import cached_property class DatabaseFeatures(BaseDatabaseFeatures): empty_fetchmany_value = () allows_group_by_pk = True related_fields_match_type = True # MySQL doesn't support sliced subq...
0f3c41d5c603a2a883f5f534b89294298bb224462850ce4345884321f36f7a7b
""" SQLite backend for the sqlite3 module in the standard library. """ import datetime import decimal import functools import hashlib import json import math import operator import re import statistics import warnings from itertools import chain from sqlite3 import dbapi2 as Database import pytz from django.core.exce...
021aebe932af947cd4651c29947fdae2e8abe555f8d0870af85a920d92a7decf
from django.apps import apps from django.contrib import auth from django.contrib.auth.base_user import AbstractBaseUser, BaseUserManager from django.contrib.auth.hashers import make_password from django.contrib.contenttypes.models import ContentType from django.core.exceptions import PermissionDenied from django.core.m...
5300822f9b059facecb81abfe35cbfed4866533cb4126d849a5163c696650c0b
from unittest import mock from django.conf.global_settings import PASSWORD_HASHERS from django.contrib.auth import get_user_model from django.contrib.auth.backends import ModelBackend from django.contrib.auth.base_user import AbstractBaseUser from django.contrib.auth.hashers import get_hasher from django.contrib.auth....
352645b22ca25a80550d384eb6127cd343e94227a058d63c710ba42def794120
import datetime import pickle import sys import unittest from operator import attrgetter from threading import Lock from django.core.exceptions import EmptyResultSet, FieldError from django.db import DEFAULT_DB_ALIAS, connection from django.db.models import Count, Exists, F, OuterRef, Q from django.db.models.expressio...
8d048a42755d95661f594f80c379046c44889f8ebc9cb31a7e713adfb2892773
""" Various complex queries that have been problematic in the past. """ from django.db import models from django.db.models.functions import Now class DumbCategory(models.Model): pass class ProxyCategory(DumbCategory): class Meta: proxy = True class NamedCategory(DumbCategory): name = models.Ch...
4ad5275689a2711f881675aa904754f2fcab24bcf74b46e27892a3955735199f
import unittest from django.core.checks import Error, Warning from django.core.checks.model_checks import _check_lazy_references from django.db import connection, connections, models from django.db.models.functions import Lower from django.db.models.signals import post_init from django.test import SimpleTestCase, Test...
d72c6637a5654a2553513531201c58fdeda10ebc85fbe67555ff6773d2855cc1
import datetime import pickle import unittest import uuid from copy import deepcopy from unittest import mock from django.core.exceptions import FieldError from django.db import DatabaseError, NotSupportedError, connection from django.db.models import ( Avg, BooleanField, Case, CharField, Count, DateField, DateTim...
857710c1d9ed3f31e926a7033077265e03125e5cf3ede4ecdd0b35603d37c712
import ctypes import faulthandler import io import itertools import logging import multiprocessing import os import pickle import sys import textwrap import unittest from importlib import import_module from io import StringIO from django.core.management import call_command from django.db import connections from django...
3353a3b3d3780206885d94395448fd646b11a1d70f82b25098c29acaf1f8b0ac
import asyncio import difflib import json import posixpath import sys import threading import unittest import warnings from collections import Counter from contextlib import contextmanager from copy import copy, deepcopy from difflib import get_close_matches from functools import wraps from unittest.suite import _Debug...
7911b2c2337e2404108dddf40beb86b1a39e23c74949d08386acf4c3c13c7cbb
import functools import re import sys import types import warnings from pathlib import Path from django.conf import settings from django.http import Http404, HttpResponse, HttpResponseNotFound from django.template import Context, Engine, TemplateDoesNotExist from django.template.defaultfilters import pprint from djang...
af64b6805ec048f0eaf8bf06854322fb065028187a87d21e50576064a6d1e70a
from django.conf import settings from django.http import HttpResponseForbidden from django.template import Context, Engine, TemplateDoesNotExist, loader from django.utils.translation import gettext as _ from django.utils.version import get_docs_version # We include the template inline since we need to be able to relia...
cbe215bc7cceec34e008f364ec1d3e79c3c843be5b34dfdb04f9e757fe186145
""" Default Django settings. Override these with settings in the module pointed to by the DJANGO_SETTINGS_MODULE environment variable. """ # This is defined here as a do-nothing function because we can't import # django.utils.translation -- that module depends on the settings. def gettext_noop(s): return s ####...
2961e2aa9c2c0a5bfaae3b5f14bcd7e92ef732cda167d5183c0fe3647d04cba7
""" HTML Widget classes """ import copy import datetime import warnings from collections import defaultdict from itertools import chain from django.forms.utils import to_current_timezone from django.templatetags.static import static from django.utils import datetime_safe, formats from django.utils.datastructures impo...
a7c63d224340c4a7e7694c10d4e15491621c88c8ddd579ae0d79b512460fb986
""" LANG_INFO is a dictionary structure to provide meta information about languages. About name_local: capitalize it as if your language name was appearing inside a sentence in your language. The 'fallback' key can be used to specify a special fallback logic which doesn't follow the traditional 'fr-ca' -> 'fr' fallbac...
c7dcdabebf7fe0f70d872dc2b25a1b3f6bd8638784ca31dabcd158210b4cbbf4
# This file is distributed under the same license as the Django package. # # The *_FORMAT strings use the Django date format syntax, # see https://docs.djangoproject.com/en/dev/ref/templates/builtins/#date DATE_FORMAT = 'j F Y' TIME_FORMAT = 'P' DATETIME_FORMAT = 'j F Y P' YEAR_MONTH_FORMAT = 'F Y' MONTH_DAY_FORMAT = '...
7a3e43b71998a6ece0bf5ad1754beb3706e42de705d17e2600688389cdd4b952
import pkgutil import sys from importlib import import_module, reload from django.apps import apps from django.conf import settings from django.db.migrations.graph import MigrationGraph from django.db.migrations.recorder import MigrationRecorder from .exceptions import ( AmbiguityError, BadMigrationError, Inconsi...
6781dfbb475e7d3611a16a0e52a693690d016629fac0b104960503b644cbc74a
import copy import datetime import functools import inspect from decimal import Decimal from uuid import UUID from django.core.exceptions import EmptyResultSet, FieldError from django.db import NotSupportedError, connection from django.db.models import fields from django.db.models.constants import LOOKUP_SEP from djan...
c843824155a4025f0a39c7d2cf5fff19642903561759b9fac9ea34adafa7aab9
import itertools import math import warnings from copy import copy from django.core.exceptions import EmptyResultSet from django.db.models.expressions import Case, Exists, Func, Value, When from django.db.models.fields import ( CharField, DateTimeField, Field, IntegerField, UUIDField, ) from django.db.models.query...
f25e318a6faa761ec36ced7f4cddabba603064e88678c128fe36a1006586032e
""" Create SQL statements for QuerySets. The code in here encapsulates all of the SQL construction so that QuerySets themselves do not have to (and could be backed by things other than SQL databases). The abstraction barrier only works one way: this module has to know all about the internals of models in order to get ...
a3d9b9ad90f41254369b960c12621f88045c9042f8d4273d48509a04ce16f80b
import operator from django.db.backends.base.features import BaseDatabaseFeatures from django.utils.functional import cached_property class DatabaseFeatures(BaseDatabaseFeatures): empty_fetchmany_value = () allows_group_by_pk = True related_fields_match_type = True # MySQL doesn't support sliced subq...
165f5d4f3f2ba63f0cd7c388772fb302b5f9e0c7f721cc4b32875a4452425a1e
from django.core.exceptions import FieldError from django.db.models.sql import compiler class SQLCompiler(compiler.SQLCompiler): def as_subquery_condition(self, alias, columns, compiler): qn = compiler.quote_name_unless_alias qn2 = self.connection.ops.quote_name sql, params = self.as_sql()...
9ca9a1cfcdd332e5677356de43d5164ffc2480b1eed4b0bcc992fba9ba3a580b
from psycopg2.extras import Inet from django.conf import settings from django.db.backends.base.operations import BaseDatabaseOperations class DatabaseOperations(BaseDatabaseOperations): cast_char_field_without_max_length = 'varchar' explain_prefix = 'EXPLAIN' cast_data_types = { 'AutoField': 'int...
b16df910ef642de1145e8c0c9ed1036a4e054c488d43c93c8d14a190379d2f25
import datetime import json from psycopg2.extras import DateRange, DateTimeTZRange, NumericRange, Range from django.contrib.postgres import forms, lookups from django.db import models from django.db.models.lookups import PostgresOperatorLookup from .utils import AttributeSetter __all__ = [ 'RangeField', 'Intege...
20155ad24e75afeb84dc7b52a91ba8a81b8c521ba02cb7e7d19bbb0787de4d2a
from decimal import Decimal from django.contrib.gis.db.models.fields import BaseSpatialField, GeometryField from django.contrib.gis.db.models.sql import AreaField, DistanceField from django.contrib.gis.geos import GEOSGeometry from django.core.exceptions import FieldError from django.db import NotSupportedError from d...
0c66d39f34852caa6fb96e66d25d06ea78eed38b191e99be31579f5f486b813e
import json import os import sys import uuid from ctypes import ( addressof, byref, c_buffer, c_char_p, c_double, c_int, c_void_p, string_at, ) from django.contrib.gis.gdal.driver import Driver from django.contrib.gis.gdal.error import GDALException from django.contrib.gis.gdal.prototypes import raster as capi fro...
d2be4ea5146bf9d39be0b6b83e0f898082ca7da6a5b104847c71b9185948292e
import datetime import importlib import io import os import sys from unittest import mock from django.apps import apps from django.core.management import CommandError, call_command from django.db import ( ConnectionHandler, DatabaseError, OperationalError, connection, connections, models, ) from django.db.back...
7d86651c0fa70a97b0f073a1e8853274e286804358d57c9bb222932d7c2fe237
import datetime import itertools import re from importlib import import_module from unittest import mock from urllib.parse import quote, urljoin from django.apps import apps from django.conf import settings from django.contrib.admin.models import LogEntry from django.contrib.auth import ( BACKEND_SESSION_KEY, HASH...
ed1c6c1319a041e1fc11d73d92e9247ddf520b53bb199838c665f588fc8b403a
import datetime import re from decimal import Decimal from unittest import skipIf from django.core.exceptions import FieldError from django.db import connection from django.db.models import ( Avg, Case, Count, DecimalField, DurationField, Exists, F, FloatField, Func, IntegerField, Max, Min, OuterRef, Subquery,...
8478152ebe5f2140003ca62fcfb6394f27441c1c602ab25ab0953a1c3e00a8c8
import os import unittest import warnings from io import StringIO from unittest import mock from django.conf import settings from django.contrib.staticfiles.finders import get_finder, get_finders from django.contrib.staticfiles.storage import staticfiles_storage from django.core.exceptions import ImproperlyConfigured ...
dc61225416903977c231bb83d2990a4aea57bdfceaa7e7e902ba52397941621a
import datetime import pickle from decimal import Decimal from operator import attrgetter from unittest import mock from django.contrib.contenttypes.models import ContentType from django.core.exceptions import FieldError from django.db import connection from django.db.models import ( Aggregate, Avg, Case, Count, D...
1fc7e097bacab4ef5a7144dbe9ac24ff77182e24d61fe81d615b3691b70f165e
import datetime import json from decimal import Decimal from django import forms from django.core import exceptions, serializers from django.db.models import DateField, DateTimeField, F, Func, Value from django.http import QueryDict from django.test import override_settings from django.test.utils import isolate_apps f...
fa4e3a98ab381589123821a3964e82c7bac9689ab6337defc2818f4d31a8ef10
import datetime from decimal import Decimal from unittest import skipIf from django.core.exceptions import FieldDoesNotExist, FieldError from django.db import connection from django.db.models import ( BooleanField, Case, Count, DateTimeField, Exists, ExpressionWrapper, F, FloatField, Func, IntegerField, Max, N...
cdf0bff7ce243e754264e58964ce85a9f3be01ace57de04c2e777373588dfcbd
import unittest from datetime import date, datetime, time, timedelta from decimal import Decimal from operator import attrgetter, itemgetter from uuid import UUID from django.core.exceptions import FieldError from django.db.models import ( BinaryField, BooleanField, Case, Count, DecimalField, F, GenericIPAddre...
3c9c9384e56195192b1736c0f7d246f65f260b42f91158025042b93365846d80
import unittest from django.core.exceptions import FieldError from django.db import IntegrityError, connection, transaction from django.db.models import Count, F, Max from django.db.models.functions import Concat, Lower from django.test import TestCase from .models import A, B, Bar, D, DataPoint, Foo, RelatedPoint, U...
8b3fab79d217355204a19d94821434fec2cd00f4bab1788367e1b9f7e090805a
""" Tests for the update() queryset method that allows in-place, multi-object updates. """ from django.db import models class DataPoint(models.Model): name = models.CharField(max_length=20) value = models.CharField(max_length=20) another_value = models.CharField(max_length=20, blank=True) class Related...
8588e885446e88a2464697af77446dd94236c38d71d8f5798e2b6c846b3b8a8b
import os from argparse import ArgumentParser from contextlib import contextmanager from unittest import ( TestSuite, TextTestRunner, defaultTestLoader, mock, skipUnless, ) from django.db import connections from django.test import SimpleTestCase from django.test.runner import DiscoverRunner from django.test.utils ...
9cf16e1bea2de625f2a1e85e3c28cbe5fcf89389fa43df0f47a1199796c5df9b
import operator from django.db import DatabaseError, NotSupportedError, connection from django.db.models import Exists, F, IntegerField, OuterRef, Value from django.test import TestCase, skipIfDBFeature, skipUnlessDBFeature from .models import Number, ReservedName @skipUnlessDBFeature('supports_select_union') class...
218a0c7b1868b625d2f5b0d1f244189a2c836ce62d88604a0330fbacd82c6d47
from datetime import datetime from operator import attrgetter from django.db.models import ( CharField, DateTimeField, F, Max, OuterRef, Subquery, Value, ) from django.db.models.functions import Upper from django.test import TestCase from .models import Article, Author, ChildArticle, OrderedByFArticle, Reference ...
7a3965fe19dacc86461929b87974ade292d3fa9a0cc36423c207abb6ce9d9b78
import datetime import pickle import unittest import uuid from copy import deepcopy from decimal import Decimal from unittest import mock from django.core.exceptions import FieldError from django.db import DatabaseError, NotSupportedError, connection from django.db.models import ( Avg, BinaryField, BooleanField, C...
02384f1f6e82787d7aab2c8e49e0a5eb82a4f3f2d711fa76104b5ec9a2ddbaff
from datetime import date from decimal import Decimal from unittest import mock from django.db import connection, transaction from django.db.models import ( Case, Count, DecimalField, F, FilteredRelation, Q, Sum, When, ) from django.test import TestCase from django.test.testcases import skipUnlessDBFeature from ....
8499bf88db03742257e2198e5fd07344850055cf829bd23a3365b543d66c1e1a
from django.contrib.contenttypes.fields import ( GenericForeignKey, GenericRelation, ) from django.contrib.contenttypes.models import ContentType from django.db import models class Author(models.Model): name = models.CharField(max_length=50, unique=True) favorite_books = models.ManyToManyField( 'B...
de0adbff1fcb50b8c596efa00ad73c002eca30716f72acc6ed45bc9982432485
from datetime import date from django.forms import DateField, Form, SelectDateWidget from django.test import override_settings from django.utils import translation from django.utils.dates import MONTHS_AP from .base import WidgetTest class SelectDateWidgetTest(WidgetTest): maxDiff = None widget = SelectDate...
beb7523deaaf0b8096745f1db0dfe0fd02b716580185b587a53410fb65becda1
import importlib import inspect import os import re import sys import tempfile import threading from io import StringIO from pathlib import Path from unittest import mock from django.core import mail from django.core.files.uploadedfile import SimpleUploadedFile from django.db import DatabaseError, connection from djan...
8e668b06c9501bb3ee3eaf99eb1abf58e7dfe612d980450dea59f41d384d938a
import json import math import re from decimal import Decimal from django.contrib.gis.db.models import GeometryField, PolygonField, functions from django.contrib.gis.geos import ( GEOSGeometry, LineString, Point, Polygon, fromstr, ) from django.contrib.gis.measure import Area from django.db import NotSupportedErro...
85fbd6da91a9859f8672e78ce14ea390ef30755f0ec4bfc9a7dcd35004cff484
import os import shutil import struct import tempfile from django.contrib.gis.gdal import GDAL_VERSION, GDALRaster, SpatialReference from django.contrib.gis.gdal.error import GDALException from django.contrib.gis.gdal.raster.band import GDALBand from django.contrib.gis.shortcuts import numpy from django.test import Si...
3e613bdbfa71ad7d1649c3fc70860a107ae51330c8a4ae79324a0951505b5c8e
import inspect import os import warnings from importlib import import_module from django.core.exceptions import ImproperlyConfigured from django.utils.deprecation import RemovedInDjango41Warning from django.utils.module_loading import import_string, module_has_submodule APPS_MODULE_NAME = 'apps' MODELS_MODULE_NAME = ...
936f9f44908a9f8e66c2a13897cae04a36d7e9ad8559253d90f5d75acb63d9ee
import calendar import datetime from django.utils.html import avoid_wrapping from django.utils.timezone import is_aware, utc from django.utils.translation import gettext, ngettext_lazy TIME_STRINGS = { 'year': ngettext_lazy('%d year', '%d years'), 'month': ngettext_lazy('%d month', '%d months'), 'week': n...
9dcebffbe517b5060cf834fef6cc26409c5e552bcceabf23c079071f205948de
import datetime import json import mimetypes import os import re import sys import time from email.header import Header from http.client import responses from urllib.parse import quote, urlparse from django.conf import settings from django.core import signals, signing from django.core.exceptions import DisallowedRedir...
7dca66d253358f3dfbda3d68ceffb8b9fee4d0f47d8ddef2fa4d25e78ff1b05c
import pkgutil import sys from importlib import import_module, reload from django.apps import apps from django.conf import settings from django.db.migrations.graph import MigrationGraph from django.db.migrations.recorder import MigrationRecorder from .exceptions import ( AmbiguityError, BadMigrationError, Inconsi...
b777f47282b2ffbd6c9a82ba5bc6a304f19d285cc486d3bd66a7395f94f1843e
import datetime import posixpath from django import forms from django.core import checks from django.core.files.base import File from django.core.files.images import ImageFile from django.core.files.storage import Storage, default_storage from django.db.models import signals from django.db.models.fields import Field f...
baeaa052f504aadd0575f534a5120580221266c9ef356a6ad060f2a19d60184a
import datetime import uuid from functools import lru_cache from django.conf import settings from django.db import DatabaseError, NotSupportedError from django.db.backends.base.operations import BaseDatabaseOperations from django.db.backends.utils import strip_quotes, truncate_name from django.db.models import AutoFie...
10fd573c22ae727903601a78bbd2477a95f869fa3d073ab559941dcedc6fb247
from django.db import ProgrammingError from django.utils.functional import cached_property class BaseDatabaseFeatures: gis_enabled = False allows_group_by_pk = False allows_group_by_selected_pks = False empty_fetchmany_value = [] update_can_self_select = True # Does the backend distinguish be...
7f060185ce45a65934deb960c726465898318e5f5bac3bcf05bd8e31a9349fb8
import operator from django.db.backends.base.features import BaseDatabaseFeatures from django.utils.functional import cached_property class DatabaseFeatures(BaseDatabaseFeatures): empty_fetchmany_value = () allows_group_by_pk = True related_fields_match_type = True # MySQL doesn't support sliced subq...
1df21ed6c35401e4e2cd447550aa2ccf9cdcf06cae9b4634c6c448d2776719c3
import uuid from django.conf import settings from django.db.backends.base.operations import BaseDatabaseOperations from django.utils import timezone from django.utils.encoding import force_str class DatabaseOperations(BaseDatabaseOperations): compiler_module = "django.db.backends.mysql.compiler" # MySQL sto...
0961b94da0d1e7a170bac31e75806207c882a30b7c4967fb8e1a2e8c4537b248
from psycopg2.extras import Inet from django.conf import settings from django.db.backends.base.operations import BaseDatabaseOperations class DatabaseOperations(BaseDatabaseOperations): cast_char_field_without_max_length = 'varchar' explain_prefix = 'EXPLAIN' cast_data_types = { 'AutoField': 'int...
996c39c7fb030806ceb469403e95effb1b6472ef07bc427cbc57871951e9280f
import psycopg2 from django.db.backends.base.schema import BaseDatabaseSchemaEditor from django.db.backends.ddl_references import IndexColumns from django.db.backends.utils import strip_quotes class DatabaseSchemaEditor(BaseDatabaseSchemaEditor): sql_create_sequence = "CREATE SEQUENCE %(sequence)s" sql_dele...
1b2dfad2323176c92393e35b7d73da18facd398687dd05bbd320ba24e85e9d53
import operator import platform from django.db import transaction from django.db.backends.base.features import BaseDatabaseFeatures from django.db.utils import OperationalError from django.utils.functional import cached_property from .base import Database class DatabaseFeatures(BaseDatabaseFeatures): # SQLite c...
7c17249f247e94b1262e2f15e5ea9ffa1ce66c8e5aaae4e9be56bfe55ebbfc8d
from itertools import chain from django.utils.itercompat import is_iterable class Tags: """ Built-in tags for internal checks. """ admin = 'admin' async_support = 'async_support' caches = 'caches' compatibility = 'compatibility' database = 'database' models = 'models' security...
93b7f23d893a79c4131c389aea07ce4a0bfb2caae647b2f784b92ee5e8152fc6
import mimetypes from email import ( charset as Charset, encoders as Encoders, generator, message_from_string, ) from email.errors import HeaderParseError from email.header import Header from email.headerregistry import Address, parser from email.message import Message from email.mime.base import MIMEBase from emai...
23b358aed0711c2ef847861de1a8f2f41bab117a73e5506ae341901183a4b2bc
import os import sys import warnings from itertools import takewhile from django.apps import apps from django.conf import settings from django.core.management.base import ( BaseCommand, CommandError, no_translations, ) from django.db import DEFAULT_DB_ALIAS, OperationalError, connections, router from django.db.mig...
036a61f4c1c97cd35d5f279cae80a575c2d98e0b6e038c1b061aeef6d4bc7d15
from urllib.parse import urlencode from urllib.request import urlopen from django.apps import apps as django_apps from django.conf import settings from django.core import paginator from django.core.exceptions import ImproperlyConfigured from django.urls import NoReverseMatch, reverse from django.utils import translati...
ea6c9023020581cdd20321f93f5b28223c042d111581bc60c4ff397c97207b4e
from django.contrib.messages.api import * # NOQA from django.contrib.messages.constants import * # NOQA
adc2916e774d3bd9d2514e27344b295aebfe701039c728a98712adfcaf96239c
import inspect import re from django.apps import apps as django_apps from django.conf import settings from django.core.exceptions import ImproperlyConfigured, PermissionDenied from django.middleware.csrf import rotate_token from django.utils.crypto import constant_time_compare from django.utils.module_loading import i...
85fc28f6b9daec815fcc9c687d0459211a078a8a93b1afd3e37ed49f6c08f179
from django.contrib.admin.decorators import register from django.contrib.admin.filters import ( AllValuesFieldListFilter, BooleanFieldListFilter, ChoicesFieldListFilter, DateFieldListFilter, EmptyFieldListFilter, FieldListFilter, ListFilter, RelatedFieldListFilter, RelatedOnlyFieldListFilter, SimpleListFilt...
1c89944b3e624709090ec8b5901c1e222022c0bdc19f154dd1b8e694182bb387
from django.apps import AppConfig from django.contrib.admin.checks import check_admin_app, check_dependencies from django.core import checks from django.utils.translation import gettext_lazy as _ class SimpleAdminConfig(AppConfig): """Simple AppConfig which does not do automatic discovery.""" default_site = ...
854acccb45930e4bfe5928e778f978ae474e8b7eaa40b81e9ea5e9bbae70f0d3
from django.conf import settings from django.core.checks import Error def check_site_id(app_configs, **kwargs): if ( hasattr(settings, 'SITE_ID') and not isinstance(settings.SITE_ID, (type(None), int)) ): return [ Error('The SITE_ID setting must be an integer', id='sites.E1...
09a155d2212f12083bb78ffc9f23e61418560cbacc7f040a3ff548f33c382f98
from django.apps import AppConfig from django.contrib.sites.checks import check_site_id from django.core import checks from django.db.models.signals import post_migrate from django.utils.translation import gettext_lazy as _ from .management import create_default_site class SitesConfig(AppConfig): name = 'django....
d8d7862fd3137b15c516dff9318a252a24a39c166ea8f6c70eb3d0444f5c7051
import time from importlib import import_module from django.conf import settings from django.contrib.sessions.backends.base import UpdateError from django.core.exceptions import SuspiciousOperation from django.utils.cache import patch_vary_headers from django.utils.deprecation import MiddlewareMixin from django.utils....
d9dde2aca6ae5078dd2b4820440be409d1671e85a9f2538d9e598dfe93b6e337
import json from django.conf import settings from django.contrib.messages.storage.base import BaseStorage, Message from django.core import signing from django.http import SimpleCookie from django.utils.crypto import constant_time_compare, salted_hmac from django.utils.safestring import SafeData, mark_safe class Mess...
36d62260bc7bf890cb52c168cc377f84923d87064470b5b5a35e7c7459cc07ac
from django.contrib.postgres.fields import ArrayField from django.db.models import Aggregate, BooleanField, JSONField, Value from .mixins import OrderableAggMixin __all__ = [ 'ArrayAgg', 'BitAnd', 'BitOr', 'BoolAnd', 'BoolOr', 'JSONBAgg', 'StringAgg', ] class ArrayAgg(OrderableAggMixin, Aggregate): function...
669532b4d5a437a4fdcb713bab9bf079567c9fa7abb6a2760f9beb1d6817d1e3
import datetime import importlib import io import os import sys from unittest import mock from django.apps import apps from django.core.management import CommandError, call_command from django.db import ( ConnectionHandler, DatabaseError, OperationalError, connection, connections, models, ) from django.db.back...
776ab6a1f6d09c250d67445c01296317512aa483781fbabe66c96e25f41427ac
import compileall import os from django.db import connection, connections from django.db.migrations.exceptions import ( AmbiguityError, InconsistentMigrationHistory, NodeNotFoundError, ) from django.db.migrations.loader import MigrationLoader from django.db.migrations.recorder import MigrationRecorder from django....