hash
stringlengths
64
64
content
stringlengths
0
1.51M
7c7ba409202bfe75b8514954c769f016ec7f09885f1f470ee6513b3d317a7159
from django.db.models.expressions import Func, Value from django.db.models.fields import IntegerField from django.db.models.functions import Coalesce from django.db.models.lookups import Transform class BytesToCharFieldConversionMixin: """ Convert CharField results from bytes to str. MySQL returns long d...
aa5fe4ae78cfc5c6c3f06054264fb9e6051ae240189f4e705ebb855637732146
from .comparison import Cast, Coalesce, Greatest, Least, NullIf from .datetime import ( Extract, ExtractDay, ExtractHour, ExtractIsoYear, ExtractMinute, ExtractMonth, ExtractQuarter, ExtractSecond, ExtractWeek, ExtractWeekDay, ExtractYear, Now, Trunc, TruncDate, TruncDay, TruncHour, TruncMinute, TruncMo...
a46284ebb73fa23de869781121d062a4847178a5c579d5530d2b530d327eadaa
import collections import re import warnings from itertools import chain from django.core.exceptions import EmptyResultSet, FieldError from django.db.models.constants import LOOKUP_SEP from django.db.models.expressions import OrderBy, Random, RawSQL, Ref, Subquery from django.db.models.query_utils import QueryWrapper,...
eddbf4a3bb393c285138a471021ba6522b77b9c3c993b3dd4ce1a440ca5f5649
import copy import threading import time import warnings from collections import deque from contextlib import contextmanager import _thread import pytz from django.conf import settings from django.core.exceptions import ImproperlyConfigured from django.db import DEFAULT_DB_ALIAS from django.db.backends import utils f...
4adb0350077745ad40e4c87bf84bbe63567485c74790d757894152ee0d08b071
""" PostgreSQL database backend for Django. Requires psycopg 2: http://initd.org/projects/psycopg2 """ import threading import warnings from django.conf import settings from django.core.exceptions import ImproperlyConfigured from django.db import connections from django.db.backends.base.base import BaseDatabaseWrapp...
5b4ca108fb438bcfa9f1289fffa6937641e0f33dde8e448d34abbed08aad0852
import os import signal import subprocess from django.db.backends.base.client import BaseDatabaseClient class DatabaseClient(BaseDatabaseClient): executable_name = 'psql' @classmethod def runshell_db(cls, conn_params): args = [cls.executable_name] host = conn_params.get('host', '') ...
efdec6ee4570fa97c170d2ed9dedee99106b3a1569d323024c7761111dc4cb45
""" SQLite backend for the sqlite3 module in the standard library. """ import datetime import decimal import functools import hashlib 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.exceptions impor...
d25372283c3ef2c4afac42568f93380bc09e2dea3e0d0df3105bb6c7a41b9d56
import base64 import logging import string import warnings from datetime import datetime, timedelta from django.conf import settings from django.contrib.sessions.exceptions import SuspiciousSession from django.core.exceptions import SuspiciousOperation from django.utils import timezone from django.utils.crypto import ...
8f0d4d0c1835c5eae3d207e3e36414228fb12a9489046a49d1e8c36d395ef846
import datetime import itertools import os import re from importlib import import_module from unittest import mock from urllib.parse import quote 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, RED...
f222f72c03f33fc7628f433507b0412f8b68c7f258b14183a6a147dc7d6c6976
from django.contrib import admin from django.contrib.auth import views from django.contrib.auth.decorators import login_required, permission_required from django.contrib.auth.forms import AuthenticationForm from django.contrib.auth.urls import urlpatterns as auth_urlpatterns from django.contrib.messages.api import info...
28812fe09a1063a7b20b84582903f55e2ada3bbd611a94ad4bf3e27bffe7ecf4
from unittest import mock from django.db import connection, transaction from django.test import TestCase, skipUnlessDBFeature from django.test.utils import CaptureQueriesContext from .models import ( Article, InheritedArticleA, InheritedArticleB, NullablePublicationThrough, NullableTargetArticle, Publication,...
b305e0819f0e6dd64e2238157332f80eb8770b7f304cb48e8a49ace50b70d814
""" Testing using the Test Client The test client is a class that can act like a simple browser for testing purposes. It allows the user to compose GET and POST requests, and obtain the response that the server gave to those requests. The server Response objects are annotated with the details of the contexts and temp...
448c2cea567808eb232b0170b9d4f5df9ac30a521740fc5b4026796cc11f8df6
"""Tests related to django.db.backends that haven't been organized.""" import datetime import threading import unittest import warnings from django.core.management.color import no_style from django.db import ( DEFAULT_DB_ALIAS, DatabaseError, IntegrityError, connection, connections, reset_queries, transaction,...
7cbcf58c517ce7c5907ba1f714bef9f1cc2dd7814b0b369993f6ca4f2090b0ee
""" A series of tests to establish that the command-line management tools work as advertised - especially with regards to the handling of the DJANGO_SETTINGS_MODULE and default settings.py files. """ import os import re import shutil import socket import subprocess import sys import tempfile import unittest from io imp...
5ba07538b824f1808c36969f3909ba4da4f9ccc70c1530b67b77b309df0e818b
import datetime from unittest import mock, skipIf, skipUnless from django.core.exceptions import FieldError from django.db import NotSupportedError, connection from django.db.models import ( F, OuterRef, RowRange, Subquery, Value, ValueRange, Window, WindowFrame, ) from django.db.models.aggregates import Avg, Max,...
5125b2b4fe1b6be76e3249ec25749ac7433d455cfab354065a259d44c503030a
import datetime import pickle import unittest import uuid from copy import deepcopy from django.core.exceptions import FieldError from django.db import DatabaseError, connection, models from django.db.models import CharField, Q, TimeField, UUIDField from django.db.models.aggregates import ( Avg, Count, Max, Min, S...
714fd311e6fb09b4009cfee23dc651032d5d94986f9d0def3f876a97e5cf7131
import os import signal import subprocess from unittest import mock from django.db.backends.postgresql.client import DatabaseClient from django.test import SimpleTestCase class PostgreSqlDbshellCommandTestCase(SimpleTestCase): def _run_it(self, dbinfo): """ That function invokes the runshell com...
d62b5125f81cf08013b3852896858e238a6a1cd76474f4b8c853419cb4593e65
import gettext import json from os import path from django.conf import settings from django.test import ( RequestFactory, SimpleTestCase, TestCase, ignore_warnings, modify_settings, override_settings, ) from django.test.selenium import SeleniumTestCase from django.urls import reverse from django.utils.deprecat...
5127df8d4d5891079eae3ffc0aed7391b68abb27736897625c3d9c9241a62982
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...
94a1b09abc91cc97ce7b17c1ec5f6196f4b20acd5170188caea682a232cc715a
import json import mimetypes import os import re import sys from copy import copy from functools import partial from http import HTTPStatus from importlib import import_module from io import BytesIO from urllib.parse import unquote_to_bytes, urljoin, urlparse, urlsplit from django.conf import settings from django.core...
15347ed600c6ce7d5d55b7d2ff1757b393bdbeffcd6e15aed738f51295cd5c3b
"""Default variable filters.""" import random as random_module import re import types from decimal import ROUND_HALF_UP, Context, Decimal, InvalidOperation from functools import wraps from operator import itemgetter from pprint import pformat from urllib.parse import quote from django.utils import formats from django....
2308e49463528367426c59310e3ac144250741bdd719751cb1e69796c86af119
import copy import re from io import BytesIO from itertools import chain from urllib.parse import quote, urlencode, urljoin, urlsplit from django.conf import settings from django.core import signing from django.core.exceptions import ( DisallowedHost, ImproperlyConfigured, RequestDataTooBig, ) from django.core.fil...
cbaa4a72c3abd51c2afda4538ef498e8255602cbde70edf8d62cc3b50ecc6e92
import copy import datetime import inspect from decimal import Decimal from django.core.exceptions import EmptyResultSet, FieldError from django.db import connection from django.db.models import fields from django.db.models.query_utils import Q from django.db.utils import NotSupportedError from django.utils.deconstruc...
3b247985db8153e724603f5c1ce7a64cd8f87ee6c473102a8544f2c6eb57c12c
import collections import re import warnings from itertools import chain from django.core.exceptions import EmptyResultSet, FieldError from django.db.models.constants import LOOKUP_SEP from django.db.models.expressions import OrderBy, Random, RawSQL, Ref, Value from django.db.models.functions import Cast from django.d...
390e9605205f5116fda8ab5c37d58df74a499ef740829dfb7d641277ba6cdc30
import datetime import re import uuid from functools import lru_cache from django.conf import settings from django.db.backends.base.operations import BaseDatabaseOperations from django.db.backends.utils import strip_quotes, truncate_name from django.db.utils import DatabaseError from django.utils import timezone from ...
86c2b04bd9e7726f477801cc98bf1c5646731bb3d1f5ecd64a94a0764165fe7a
import uuid from django.conf import settings from django.db.backends.base.operations import BaseDatabaseOperations from django.utils import timezone from django.utils.duration import duration_microseconds from django.utils.encoding import force_str class DatabaseOperations(BaseDatabaseOperations): compiler_modul...
7dff1ed2f1b84cf35baca53f177c8b997dcf9e442fa96ed7257c3687f4922342
from psycopg2.extras import Inet from django.conf import settings from django.db import NotSupportedError from django.db.backends.base.operations import BaseDatabaseOperations class DatabaseOperations(BaseDatabaseOperations): cast_char_field_without_max_length = 'varchar' explain_prefix = 'EXPLAIN' cast_...
604fcbf4fe2965c877321b5a6457b2eff7cebdba2d727019a1b6543c7e20431f
""" SQLite backend for the sqlite3 module in the standard library. """ import datetime import decimal import functools import hashlib 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.exceptions impor...
1f408ae109a583a6163fd1933a0b6747e437dc110b0a67f933a36cb23dee5010
import inspect import warnings from django.contrib.auth import get_user_model from django.contrib.auth.models import Permission from django.utils.deprecation import RemovedInDjango31Warning UserModel = get_user_model() class BaseBackend: def authenticate(self, request, **kwargs): return None def ge...
daa6479a244c70428606374d1ce772703e4dc56f25403cf037d633a581c02614
import unicodedata from django import forms from django.contrib.auth import ( authenticate, get_user_model, password_validation, ) from django.contrib.auth.hashers import ( UNUSABLE_PASSWORD_PREFIX, identify_hasher, ) from django.contrib.auth.models import User from django.contrib.auth.tokens import default_to...
4e390b48f12bbb660a3141459cfba3882871eeed33db8582868f3bced6d9c050
from django.contrib.gis.db.backends.base.adapter import WKTAdapter from django.contrib.gis.db.backends.base.operations import ( BaseSpatialOperations, ) from django.contrib.gis.db.backends.utils import SpatialOperator from django.contrib.gis.db.models import aggregates from django.contrib.gis.geos.geometry import G...
b296e3a1cf0a49d9f3dadf271da6790a0844fd7d5f73e37a5e34c1d7651ecce5
import datetime import itertools import os import re from importlib import import_module from unittest import mock from urllib.parse import quote 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, RED...
7672fec6deffe3bface5ad16190b224cb985420c298f0ceb53b79d1c99339d34
from datetime import date from unittest import mock from django.contrib.auth import ( BACKEND_SESSION_KEY, SESSION_KEY, authenticate, get_user, signals, ) from django.contrib.auth.backends import BaseBackend, ModelBackend from django.contrib.auth.hashers import MD5PasswordHasher from django.contrib.auth.models imp...
6d2b677d0d95cc4a0ed2af8f202381e439468742e5a34a6bbe68296e0c111814
import datetime import re from unittest import mock from django import forms from django.contrib.auth.forms import ( AdminPasswordChangeForm, AuthenticationForm, PasswordChangeForm, PasswordResetForm, ReadOnlyPasswordHashField, ReadOnlyPasswordHashWidget, SetPasswordForm, UserChangeForm, UserCreationForm, ...
f0d5452ef837a22651b482eedefaced51d90e6f76f8bc0bba18657c036559cd1
import datetime import re from decimal import Decimal from django.core.exceptions import FieldError from django.db import connection from django.db.models import ( Avg, Count, DecimalField, DurationField, F, FloatField, Func, IntegerField, Max, Min, Sum, Value, ) from django.db.models.expressions import Case, ...
6006e86be6362e174cf298771cb0cc89273ba946e89d8d4749ae2fe6aa023d1c
import datetime import os import re import unittest from unittest import mock from urllib.parse import parse_qsl, urljoin, urlparse import pytz from django.contrib.admin import AdminSite, ModelAdmin from django.contrib.admin.helpers import ACTION_CHECKBOX_NAME from django.contrib.admin.models import ADDITION, DELETIO...
4959361b9199444cf96c96d1ceab8401712769823410c99d9b7e7eb1ade1cd4e
import datetime import os import tempfile import uuid from django.contrib.auth.models import User from django.contrib.contenttypes.fields import ( GenericForeignKey, GenericRelation, ) from django.contrib.contenttypes.models import ContentType from django.core.exceptions import ValidationError from django.core.fil...
9a8b9a3edee5816cc894419e914e5398c285be67f30301a7e1e04b7396626bf7
import datetime import os import tempfile from io import StringIO from wsgiref.util import FileWrapper from django import forms from django.contrib import admin from django.contrib.admin import BooleanFieldListFilter from django.contrib.admin.views.main import ChangeList from django.contrib.auth.admin import GroupAdmi...
9c93bfe3f1989c2ccc8628e0660bf59167387e3465e0c63bd260e04531675661
from urllib.parse import urlencode from django.conf import settings from django.contrib.auth.decorators import login_required from django.http import HttpResponse, HttpResponseRedirect, JsonResponse from django.shortcuts import render from django.template.loader import render_to_string from django.test import Client f...
b6579f64f2e1593eb8d0133d23b7b310d1d2616b9d0846f0858dcf81d7acee5b
import datetime import decimal import gettext as gettext_module import os import pickle import re import tempfile from contextlib import contextmanager from importlib import import_module from pathlib import Path from threading import local from unittest import mock import _thread from django import forms from django...
f5da38c8e319241faadee9b536634ed08ffa9d5a063c9fbdc79da4809cff0ac7
import json import math import re from decimal import Decimal from django.contrib.gis.db.models import functions from django.contrib.gis.geos import ( GEOSGeometry, LineString, Point, Polygon, fromstr, ) from django.contrib.gis.measure import Area from django.db import NotSupportedError, connection from django.db....
bd51d1982eb69429134a760fa769e9f38e58ecb4bd075fa23e9ec870e7bcd0cf
from datetime import datetime, timedelta import pytz from django.conf import settings from django.db.models import ( DateField, DateTimeField, F, IntegerField, Max, OuterRef, Subquery, TimeField, ) from django.db.models.functions import ( Extract, ExtractDay, ExtractHour, ExtractIsoYear, ExtractMinute, ...
0b12c7761eed564814c63d79346c357759e3ab7d7d1d8c9c421552aafae19b6e
#!/usr/bin/env python import argparse import atexit import copy import os import shutil import socket import subprocess import sys import tempfile import warnings try: import django except ImportError as e: raise RuntimeError( 'Django module not found, reference tests/README.rst for instructions.' ...
ebd2bf0c3fefd55a1db6b7f9dd90563afc03ff97f427d0c4560166a437370b9c
import functools import itertools import logging import os import pathlib import signal import subprocess import sys import threading import time import traceback import weakref from collections import defaultdict from pathlib import Path from types import ModuleType from zipimport import zipimporter from django.apps ...
7f2d56e343dc95b6c08413afe2c45db9ec196490b75908d61cc19a6dfe1dd4ed
""" Helper functions for creating Form classes from Django models and database field objects. """ from itertools import chain from django.core.exceptions import ( NON_FIELD_ERRORS, FieldError, ImproperlyConfigured, ValidationError, ) from django.forms.fields import ChoiceField, Field from django.forms.forms impor...
0ef8c9468ba11a701647140eec21435c8fa5e684600bddafa487af4813c2f642
from django.core.exceptions import ValidationError from django.forms import Form from django.forms.fields import BooleanField, IntegerField from django.forms.utils import ErrorList from django.forms.widgets import HiddenInput, NumberInput from django.utils.functional import cached_property from django.utils.html import...
71acd4499d179f1d692dd4f1b33518eef62a3c89cf09d6e804cc41df312bb05d
""" HTML Widget classes """ import copy import datetime import re import warnings from collections import defaultdict from itertools import chain from django.conf import settings from django.forms.utils import to_current_timezone from django.templatetags.static import static from django.utils import datetime_safe, fo...
1d73ceb4e85f2cb3316fe33a709edc40f7932b8dd6f11615f48f8bb301501419
""" Form classes """ import copy from django.core.exceptions import NON_FIELD_ERRORS, ValidationError # BoundField is imported for backwards compatibility in Django 1.9 from django.forms.boundfield import BoundField # NOQA from django.forms.fields import Field, FileField # pretty_name is imported for backwards compa...
b589b854a23ad8c0bdbfaf74d5a39aeb2434e879a9f6760aa385ae4e2da9ec18
""" Multi-part parsing for file uploads. Exposes one class, ``MultiPartParser``, which feeds chunks of uploaded data to file upload handlers for processing. """ import base64 import binascii import cgi import collections from urllib.parse import unquote from django.conf import settings from django.core.exceptions imp...
bd635a216accad0b38a09b691db6ed48833d07f114c7eddaabd2c059d1002cc4
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...
0baff00da0bfd49f5b7f896e4cb1dbbae28336abcfb76dcda86402313309c468
import copy import inspect import warnings from functools import partialmethod from itertools import chain 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, MultipleObjectsReturned, ...
a2d2b7f0aa1e0a69b54a0bb7e801e15476dd6444b54b700890d713cc6be5c3c0
from collections import Counter from operator import attrgetter from django.db import IntegrityError, connections, transaction from django.db.models import signals, sql class ProtectedError(IntegrityError): def __init__(self, msg, protected_objects): self.protected_objects = protected_objects sup...
06e7afa388f5fbfec67c79fae9fcae458185f8e4a6dfb2e2f026af8ebb792fc2
import itertools import math from copy import copy from django.core.exceptions import EmptyResultSet from django.db.models.expressions import Func, Value from django.db.models.fields import DateTimeField, Field, IntegerField from django.db.models.query_utils import RegisterLookupMixin from django.utils.datastructures ...
42372d99b57be5302323d4775c8e0ddb76eeec7493c9e6316b3835830ed0629b
import collections.abc import copy import datetime import decimal import operator import uuid import warnings from base64 import b64decode, b64encode from functools import partialmethod, total_ordering from django import forms from django.apps import apps from django.conf import settings from django.core import checks...
d14f78c742f749dfda1480a0a81fedbc7eb601e8bf7253f9ed21a64dee198fe7
import functools import inspect from functools import partial from django import forms from django.apps import apps from django.conf import SettingsReference from django.core import checks, exceptions from django.db import connection, router from django.db.backends import utils from django.db.models import Q from djan...
de3ffd38de9fda6ab98cc9c9f4214ab7d0acb8a5132ca824a388b090a31f42cd
""" Accessors for related objects. When a field defines a relation between two models, each model class provides an attribute to access related instances of the other model class (unless the reverse accessor has been disabled with related_name='+'). Accessors are implemented as descriptors in order to customize acces...
297ea4140e0def1d3d92d474a8b88ca5c6d248b5466d33055f1c86118a7d8522
""" 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 ...
ddea5e3d8f4222aa08ea23c45c23b47de963bec280f0b19e2c43dd86b84fbac9
import collections import re import warnings from itertools import chain from django.core.exceptions import EmptyResultSet, FieldError from django.db.models.constants import LOOKUP_SEP from django.db.models.expressions import OrderBy, Random, RawSQL, Ref from django.db.models.query_utils import QueryWrapper, select_re...
1a5190a7bab62e05ab59d5070472f3247328b8523fc980e64af7acbdd9359dd6
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: ...
7c4db39e16903fd677891b87ba68cb9f2ceed88c2ba88f01e7271ec7d617b5d3
import logging from datetime import datetime from django.db.backends.ddl_references import ( Columns, ForeignKeyName, IndexName, Statement, Table, ) from django.db.backends.utils import names_digest, split_identifier from django.db.models import Index from django.db.transaction import TransactionManagementError, a...
bb29cbecd642d6c27697eb612a2c84f3e16fa1b6eb4d42ce253c5d1b5ad08fc1
import uuid from django.conf import settings from django.db.backends.base.operations import BaseDatabaseOperations from django.utils import timezone from django.utils.duration import duration_microseconds class DatabaseOperations(BaseDatabaseOperations): compiler_module = "django.db.backends.mysql.compiler" ...
3541d192356e885b813da56243ab2bf6feb1abec61f4170c6fd23591cace4959
import psycopg2 from django.db.backends.base.schema import BaseDatabaseSchemaEditor from django.db.backends.ddl_references import IndexColumns class DatabaseSchemaEditor(BaseDatabaseSchemaEditor): sql_alter_column_type = "ALTER COLUMN %(column)s TYPE %(type)s USING %(column)s::%(type)s" sql_create_sequence...
9ff788b65710019069e46c732456386f428976bb0723ecfe06a5ee0e658c2149
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 utils from django.db.backends.base.operations import BaseDatabaseOperations from django.db.models import aggregates...
9620717cd97561147737c8903764ead87f9d703e185073ad491f2159bfb3aacc
from django.conf import settings from django.utils.translation.trans_real import language_code_re from . import Error, Tags, register E001 = Error( 'You have provided an invalid value for the LANGUAGE_CODE setting: {}.', id='translation.E001', ) E002 = Error( 'You have provided an invalid language code i...
c61010134acc580fc7ad1df01b44a45b189db8b28966d2d5e355cfc832a2a123
""" Base classes for writing management commands (named commands which can be executed through ``django-admin`` or ``manage.py``). """ import os import sys from argparse import ArgumentParser, HelpFormatter from io import TextIOBase import django from django.core import checks from django.core.exceptions import Improp...
5ebcf2447cac13c1306a151b04657e93a225ff40bbaf8b2899e5f2108c2b65b2
import cgi import mimetypes import os import posixpath import shutil import stat import tempfile from importlib import import_module from os import path from urllib.request import urlretrieve import django from django.conf import settings from django.core.management.base import BaseCommand, CommandError from django.co...
16c7d6d468084d3960b7c159dfff528460619ba2a1ed2dc84ba027899887aac9
import json from django import forms from django.conf import settings from django.contrib.admin.utils import ( display_for_field, flatten_fieldsets, help_text_for_field, label_for_field, lookup_field, ) from django.core.exceptions import ObjectDoesNotExist from django.db.models.fields.related import ManyToMany...
f37afb3f59c541dccee6fa90dad4eac822726b80a48cb9b8b5a6c026c97c019a
from itertools import chain from django.apps import apps from django.conf import settings from django.contrib.admin.utils import ( NotRelationField, flatten, get_fields_from_path, ) from django.core import checks from django.core.exceptions import FieldDoesNotExist from django.db import models from django.db.model...
1c1c99e857572c3279039ea83e24551d1e07c4552d601511bccc20c766846157
import copy import json import operator import re from functools import partial, reduce, update_wrapper from urllib.parse import quote as urlquote from django import forms from django.conf import settings from django.contrib import messages from django.contrib.admin import helpers, widgets from django.contrib.admin.ch...
ddf7c0d780d6d594f174ce2f56e205791e9e832b8f13c3d4d5a52e01adb540f2
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....
4b54fdb439573717855d5f2150883b99a951e21ab0a477cb8d8d5347055c9f37
from django.db.models.expressions import F, OrderBy class OrderableAggMixin: def __init__(self, expression, ordering=(), **extra): if not isinstance(ordering, (list, tuple)): ordering = [ordering] ordering = ordering or [] # Transform minus sign prefixed strings into an OrderB...
367431ebcecbecd642cc51207b21c5075abe3d09e03462b9ab09e95fabddbbb1
import datetime import itertools import os import re from importlib import import_module from unittest import mock from urllib.parse import quote 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, RED...
51eded06c5189033fd134fe3a1d03f8aae13bd7f72093a1b705e05fa5a610842
import datetime import re from unittest import mock from django import forms from django.contrib.auth.forms import ( AdminPasswordChangeForm, AuthenticationForm, PasswordChangeForm, PasswordResetForm, ReadOnlyPasswordHashField, ReadOnlyPasswordHashWidget, SetPasswordForm, UserChangeForm, UserCreationForm, ...
28534ed905a191ad469b67c8041e4909d16e1e998ec4b1506700599286c33d22
import datetime from decimal import Decimal from django.db.models import Case, Count, F, Q, Sum, When from django.test import TestCase from .models import Author, Book, Publisher class FilteredAggregateTests(TestCase): @classmethod def setUpTestData(cls): cls.a1 = Author.objects.create(name='test', ...
6e872c6a025e0bed030dbc895ffa499975e53391787618ffc1f089bb9c71e310
import json from django.db.models.expressions import F, Value from django.db.models.functions import Concat, Substr from django.test.utils import Approximate from . import PostgreSQLTestCase from .models import AggregateTestModel, StatTestModel try: from django.contrib.postgres.aggregates import ( ArrayA...
0df5591da308a50b8121cff66b5d9859440b7ddba0646b1510181eb7cfc14251
import datetime import uuid from decimal import Decimal from django.core import checks, exceptions, serializers from django.core.serializers.json import DjangoJSONEncoder from django.db.models import Q from django.forms import CharField, Form, widgets from django.test.utils import isolate_apps from django.utils.html i...
32cedb20ed568a348fbcfda3afb5990a5806bbd07be42d8a1d587562cc03faa2
import contextlib import os import py_compile import shutil import sys import tempfile import threading import time import types import weakref import zipfile from importlib import import_module from pathlib import Path from unittest import mock, skip from django.apps.registry import Apps from django.test import Simpl...
836d4aae4c328d5d6f98c6a35365a92de03e3298967ece8131ce92a01ee70bfd
import unittest from datetime import datetime from django.test import SimpleTestCase, ignore_warnings from django.utils.datastructures import MultiValueDict from django.utils.deprecation import RemovedInDjango40Warning from django.utils.http import ( base36_to_int, escape_leading_slashes, http_date, int_to_base36,...
00dbb7feed165951651f43d52510ba543dca717066882af57936142d600fcad1
import importlib import unittest from io import StringIO from django.core import management, serializers from django.core.serializers.base import DeserializationError from django.test import SimpleTestCase, TestCase, TransactionTestCase from .models import Author from .tests import SerializersTestBase, SerializersTra...
748e4fde02b8a5e2b0b86ea839b3e0db38f0b225328c64a5b34a687d8988d174
from unittest import mock from django.db import transaction from django.test import TestCase, skipUnlessDBFeature from .models import Article, InheritedArticleA, InheritedArticleB, Publication class ManyToManyTests(TestCase): def setUp(self): # Create a couple of Publications. self.p1 = Publica...
46de17a209033a9b3f24c3c3e2068fd1e4f898c33fd95f694a2933ae61ee8dfb
""" Many-to-many relationships To define a many-to-many relationship, use ``ManyToManyField()``. In this example, an ``Article`` can be published in multiple ``Publication`` objects, and a ``Publication`` has multiple ``Article`` objects. """ from django.db import models class Publication(models.Model): title =...
de936e4dd66d7c478c7f3c29d96a8d55457a1e157a421ad2bb87f0e2d8f7e7a7
from io import BytesIO from itertools import chain from urllib.parse import urlencode from django.core.exceptions import DisallowedHost from django.core.handlers.wsgi import LimitedStream, WSGIRequest from django.http import HttpRequest, RawPostDataException, UnreadablePostError from django.http.multipartparser import...
719ee5c7e5d0da51069fe5f12181bedefcb8d4f805b8c623c0f53607508b524c
import base64 import os import shutil import string import tempfile import unittest from datetime import timedelta from http import cookies from django.conf import settings from django.contrib.sessions.backends.base import UpdateError from django.contrib.sessions.backends.cache import SessionStore as CacheSession from...
b71356f5d0da9aebaad18e5c6fa86b2de4224be557f2d834d5f979b89e57b574
"""Tests related to django.db.backends that haven't been organized.""" import datetime import threading import unittest import warnings from django.core.management.color import no_style from django.db import ( DEFAULT_DB_ALIAS, DatabaseError, IntegrityError, connection, connections, reset_queries, transaction,...
8657a946ad5d8e6e4243565a861616c4a364fdda26633204c7ff17e4dd175a87
import datetime import itertools import unittest from copy import copy from unittest import mock from django.core.management.color import no_style from django.db import ( DatabaseError, IntegrityError, OperationalError, connection, ) from django.db.models import Model, Q from django.db.models.constraints import Ch...
11e2ac222dd51cae81a4b515f9eb261f215c82227db91df5a4b2215c4ff66e56
from django.contrib.admin import ModelAdmin, TabularInline from django.contrib.admin.helpers import InlineAdminForm from django.contrib.admin.tests import AdminSeleniumTestCase from django.contrib.auth.models import Permission, User from django.contrib.contenttypes.models import ContentType from django.test import Requ...
6c05248eb18df885c2d1c35a81cf89005f471bea070d523aab77039cf53d69c0
from django.core.checks import Error from django.core.checks.translation import ( check_language_settings_consistent, check_setting_language_code, check_setting_languages, check_setting_languages_bidi, ) from django.test import SimpleTestCase class TranslationCheckTests(SimpleTestCase): def setUp(self): ...
937a49874729cfd6075a6f9c225659cc003346145da0347150208b9b3e0b7003
""" A series of tests to establish that the command-line management tools work as advertised - especially with regards to the handling of the DJANGO_SETTINGS_MODULE and default settings.py files. """ import os import re import shutil import socket import subprocess import sys import tempfile import unittest from io imp...
58ce50808c79ea6658c6f0f3a97714e0ccd699dcedfc2814c0e938d8106af627
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, ) from django.core.files.uploadedfile import SimpleUploadedFile from django.core.validators import Validation...
78f5839cee74de0d4be201aea7646d345df28751026bd55a05564c460f59c481
""" Distance and Area objects to allow for sensible and convenient calculation and conversions. Here are some tests. """ import unittest from django.contrib.gis.measure import A, Area, D, Distance class DistanceTest(unittest.TestCase): "Testing the Distance object" def test_init(self): "Testing ini...
8d3d276f17af31538bfef241b140753793b516cd913e132bbba77ed648b8e3b7
from math import ceil from django.db import IntegrityError, connection, models from django.db.models.deletion import Collector from django.db.models.sql.constants import GET_ITERATOR_CHUNK_SIZE from django.test import TestCase, skipIfDBFeature, skipUnlessDBFeature from .models import ( MR, A, Avatar, Base, Child,...
bf693709dd4f9421210a9dc67257e7a890c260aacdbe40552d942e511a488e1f
import unittest from django.conf import settings from django.core.checks import Error, Warning from django.core.checks.model_checks import _check_lazy_references from django.core.exceptions import ImproperlyConfigured from django.db import connection, connections, models from django.db.models.functions import Lower fr...
d74c20a1c151fb0f9bfe6ad59dca855217d2a2d28eb386dc7c4646b43c836057
import unittest from django.core.checks import Error, Warning as DjangoWarning from django.db import connection, models from django.test import SimpleTestCase, TestCase, skipIfDBFeature from django.test.utils import isolate_apps, override_settings from django.utils.functional import lazy from django.utils.timezone imp...
8c9c7728d1286058539a3e92a9b674f7dc884c8db4f01a86e4d3c346a5293e02
from django import forms from django.contrib import admin from django.contrib.admin import AdminSite from django.contrib.auth.backends import ModelBackend from django.contrib.auth.middleware import AuthenticationMiddleware from django.contrib.contenttypes.admin import GenericStackedInline from django.contrib.messages.m...
8e310c2053fdc8cd2eff8b86e4c9a5ab2dcdf78820debabd5255855a2fe142d3
import datetime import pickle import unittest import uuid from copy import deepcopy from django.core.exceptions import FieldError from django.db import DatabaseError, connection, models from django.db.models import CharField, Q, TimeField, UUIDField from django.db.models.aggregates import ( Avg, Count, Max, Min, S...
c2cbd3566050c5f7ae76d7f690e01e5a0dacca28cd8a5b34149364ec05bc1081
from django.contrib.contenttypes.models import ContentType from django.core.exceptions import ObjectDoesNotExist from django.db import connection from django.db.models import Prefetch, QuerySet from django.db.models.query import get_prefetcher, prefetch_related_objects from django.test import TestCase, override_setting...
8ac11059b7dd43e849d484e6d64e37078fd5ee4d7ab0e7e816a8e10de2f77d8d
import copy import datetime import json import uuid from django.core.exceptions import NON_FIELD_ERRORS from django.core.files.uploadedfile import SimpleUploadedFile from django.core.validators import MaxValueValidator, RegexValidator from django.forms import ( BooleanField, CharField, CheckboxSelectMultiple, Choi...
10f51cca53f82ea6e27e547ff44eebfa2e42b8b8be4967528cec8c18d4b134c0
import gettext import json from os import path from django.conf import settings from django.test import ( RequestFactory, SimpleTestCase, TestCase, ignore_warnings, modify_settings, override_settings, ) from django.test.selenium import SeleniumTestCase from django.urls import reverse from django.utils.deprecat...
31c3d950926d01d5a896e6e433df8fa65866d793c0abc4425803a3eec8f8d437
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...
e79fbea6101be96cb9d56a227d2319591dd43acf50f7f0c2c00f25bcc8542807
from datetime import datetime, timedelta import pytz from django.conf import settings from django.db.models import ( DateField, DateTimeField, IntegerField, Max, OuterRef, Subquery, TimeField, ) from django.db.models.functions import ( Extract, ExtractDay, ExtractHour, ExtractIsoYear, ExtractMinute, Extra...