repo
stringlengths
7
90
file_url
stringlengths
81
315
file_path
stringlengths
4
228
content
stringlengths
0
32.8k
language
stringclasses
1 value
license
stringclasses
7 values
commit_sha
stringlengths
40
40
retrieved_at
stringdate
2026-01-04 14:38:15
2026-01-05 02:33:18
truncated
bool
2 classes
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/string_lookup/tests.py
tests/string_lookup/tests.py
from django.test import TestCase from .models import Article, Bar, Base, Child, Foo, Whiz class StringLookupTests(TestCase): def test_string_form_referencing(self): """ Regression test for #1661 and #1662 String form referencing of models works, both as pre and post reference, on...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/admin_checks/models.py
tests/admin_checks/models.py
""" Tests of ModelAdmin system checks logic. """ from django.contrib.contenttypes.fields import GenericForeignKey from django.contrib.contenttypes.models import ContentType from django.db import models class Album(models.Model): title = models.CharField(max_length=150) class Song(models.Model): title = mod...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/admin_checks/__init__.py
tests/admin_checks/__init__.py
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/admin_checks/tests.py
tests/admin_checks/tests.py
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...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
true
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/custom_pk/models.py
tests/custom_pk/models.py
""" Using a custom primary key By default, Django adds an ``"id"`` field to each model. But you can override this behavior by explicitly adding ``primary_key=True`` to a field. """ from django.db import models from .fields import MyAutoField, MyWrapperField class Employee(models.Model): employee_code = models....
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/custom_pk/fields.py
tests/custom_pk/fields.py
import random import string from django.db import models class MyWrapper: def __init__(self, value): self.value = value def __repr__(self): return "<%s: %s>" % (self.__class__.__name__, self.value) def __str__(self): return self.value def __eq__(self, other): if isi...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/custom_pk/__init__.py
tests/custom_pk/__init__.py
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/custom_pk/tests.py
tests/custom_pk/tests.py
from django.db import IntegrityError, transaction from django.test import TestCase, skipIfDBFeature, skipUnlessDBFeature from .fields import MyWrapper from .models import Bar, Business, CustomAutoFieldModel, Employee, Foo class BasicCustomPKTests(TestCase): @classmethod def setUpTestData(cls): cls.da...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/model_package/__init__.py
tests/model_package/__init__.py
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/model_package/tests.py
tests/model_package/tests.py
from django.db import connection, models from django.db.backends.utils import truncate_name from django.test import TestCase from .models.article import Article, Site from .models.publication import Publication class Advertisement(models.Model): customer = models.CharField(max_length=100) publications = mode...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/model_package/models/publication.py
tests/model_package/models/publication.py
from django.db import models class Publication(models.Model): title = models.CharField(max_length=30)
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/model_package/models/article.py
tests/model_package/models/article.py
from django.db import models class Site(models.Model): name = models.CharField(max_length=100) class Article(models.Model): sites = models.ManyToManyField(Site) headline = models.CharField(max_length=100) publications = models.ManyToManyField("model_package.Publication", blank=True)
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/model_package/models/__init__.py
tests/model_package/models/__init__.py
# Import all the models from subpackages from .article import Article from .publication import Publication __all__ = ["Article", "Publication"]
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/queryset_pickle/models.py
tests/queryset_pickle/models.py
import datetime from django.db import DJANGO_VERSION_PICKLE_KEY, models from django.utils.translation import gettext_lazy as _ def standalone_number(): return 1 class Numbers: @staticmethod def get_static_number(): return 2 class PreviousDjangoVersionQuerySet(models.QuerySet): def __getst...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/queryset_pickle/__init__.py
tests/queryset_pickle/__init__.py
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/queryset_pickle/tests.py
tests/queryset_pickle/tests.py
import datetime import pickle import django from django.db import models from django.test import TestCase from .models import ( BinaryFieldModel, Container, Event, Group, Happening, M2MModel, MyEvent, ) class PickleabilityTestCase(TestCase): @classmethod def setUpTestData(cls): ...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/max_lengths/models.py
tests/max_lengths/models.py
from django.db import models class PersonWithDefaultMaxLengths(models.Model): email = models.EmailField() vcard = models.FileField() homepage = models.URLField() avatar = models.FilePathField() class PersonWithCustomMaxLengths(models.Model): email = models.EmailField(max_length=250) vcard = ...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/max_lengths/__init__.py
tests/max_lengths/__init__.py
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/max_lengths/tests.py
tests/max_lengths/tests.py
import unittest from django.test import TestCase from .models import PersonWithCustomMaxLengths, PersonWithDefaultMaxLengths class MaxLengthArgumentsTests(unittest.TestCase): def verify_max_length(self, model, field, length): self.assertEqual(model._meta.get_field(field).max_length, length) def tes...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/conditional_processing/views.py
tests/conditional_processing/views.py
from django.http import HttpResponse from django.views.decorators.http import condition, etag, last_modified from .tests import ETAG, FULL_RESPONSE, LAST_MODIFIED, WEAK_ETAG @condition(lambda r: ETAG, lambda r: LAST_MODIFIED) def index(request): return HttpResponse(FULL_RESPONSE) @condition(last_modified_func=...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/conditional_processing/__init__.py
tests/conditional_processing/__init__.py
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/conditional_processing/tests.py
tests/conditional_processing/tests.py
from datetime import datetime from django.test import SimpleTestCase, override_settings FULL_RESPONSE = "Test conditional get response" LAST_MODIFIED = datetime(2007, 10, 21, 23, 21, 47) LAST_MODIFIED_STR = "Sun, 21 Oct 2007 23:21:47 GMT" LAST_MODIFIED_NEWER_STR = "Mon, 18 Oct 2010 16:56:23 GMT" LAST_MODIFIED_INVALID...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/conditional_processing/urls.py
tests/conditional_processing/urls.py
from django.urls import path from . import views urlpatterns = [ path("condition/", views.index), path("condition/last_modified/", views.last_modified_view1), path("condition/last_modified2/", views.last_modified_view2), path("condition/etag/", views.etag_view1), path("condition/etag2/", views.eta...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/custom_managers/models.py
tests/custom_managers/models.py
""" Giving models a custom manager You can use a custom ``Manager`` in a particular model by extending the base ``Manager`` class and instantiating your custom ``Manager`` in your model. There are two reasons you might want to customize a ``Manager``: to add extra ``Manager`` methods, and/or to modify the initial ``Q...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/custom_managers/__init__.py
tests/custom_managers/__init__.py
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/custom_managers/tests.py
tests/custom_managers/tests.py
from django.db import models from django.test import TestCase from .models import ( Book, Car, CustomManager, CustomQuerySet, DeconstructibleCustomManager, FastCarAsBase, FastCarAsDefault, FunPerson, OneToOneRestrictedModel, Person, PersonFromAbstract, PersonManager, ...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/nested_foreign_keys/models.py
tests/nested_foreign_keys/models.py
from django.db import models class Person(models.Model): name = models.CharField(max_length=200) class Movie(models.Model): title = models.CharField(max_length=200) director = models.ForeignKey(Person, models.CASCADE) class Event(models.Model): pass class Screening(Event): movie = models.For...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/nested_foreign_keys/__init__.py
tests/nested_foreign_keys/__init__.py
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/nested_foreign_keys/tests.py
tests/nested_foreign_keys/tests.py
from django.test import TestCase from .models import ( Event, Movie, Package, PackageNullFK, Person, Screening, ScreeningNullFK, ) # These are tests for #16715. The basic scheme is always the same: 3 models # with 2 relations. The first relation may be null, while the second is # non-null...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/utils_tests/test_lorem_ipsum.py
tests/utils_tests/test_lorem_ipsum.py
import unittest from unittest import mock from django.utils.lorem_ipsum import paragraph, paragraphs, sentence, words class LoremIpsumTests(unittest.TestCase): def test_negative_words(self): """words(n) returns n + 19 words, even if n is negative.""" self.assertEqual( words(-5), ...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/utils_tests/test_lazyobject.py
tests/utils_tests/test_lazyobject.py
import copy import pickle import sys import unittest import warnings from django.test import TestCase from django.utils.functional import LazyObject, SimpleLazyObject, empty from .models import Category, CategoryInfo class Foo: """ A simple class with just one attribute. """ foo = "bar" def __...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/utils_tests/test_numberformat.py
tests/utils_tests/test_numberformat.py
from decimal import Decimal from sys import float_info from django.test import SimpleTestCase from django.utils.numberformat import format as nformat class TestNumberFormat(SimpleTestCase): def test_format_number(self): self.assertEqual(nformat(1234, "."), "1234") self.assertEqual(nformat(1234.2,...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/utils_tests/test_functional.py
tests/utils_tests/test_functional.py
from django.test import SimpleTestCase from django.utils.functional import cached_property, classproperty, lazy class FunctionalTests(SimpleTestCase): def test_lazy(self): t = lazy(lambda: tuple(range(3)), list, tuple) for a, b in zip(t(), range(3)): self.assertEqual(a, b) def tes...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/utils_tests/test_termcolors.py
tests/utils_tests/test_termcolors.py
import unittest from django.utils.termcolors import ( DARK_PALETTE, DEFAULT_PALETTE, LIGHT_PALETTE, NOCOLOR_PALETTE, PALETTES, colorize, parse_color_setting, ) class TermColorTests(unittest.TestCase): def test_empty_string(self): self.assertEqual(parse_color_setting(""), PALET...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/utils_tests/test_archive.py
tests/utils_tests/test_archive.py
import os import stat import sys import tempfile import unittest import zipfile from django.core.exceptions import SuspiciousOperation from django.test import SimpleTestCase from django.utils import archive try: import bz2 # NOQA HAS_BZ2 = True except ImportError: HAS_BZ2 = False try: import lzma ...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/utils_tests/test_html.py
tests/utils_tests/test_html.py
import math import os import sys from datetime import datetime from django.core.exceptions import SuspiciousOperation from django.core.serializers.json import DjangoJSONEncoder from django.test import SimpleTestCase from django.test.utils import override_settings from django.utils.deprecation import RemovedInDjango70W...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/utils_tests/test_module_loading.py
tests/utils_tests/test_module_loading.py
import os import sys import unittest from importlib import import_module from zipimport import zipimporter from django.test import SimpleTestCase, modify_settings from django.test.utils import extend_sys_path from django.utils.module_loading import ( autodiscover_modules, import_string, module_has_submodul...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/utils_tests/test_autoreload.py
tests/utils_tests/test_autoreload.py
import contextlib import os import py_compile import shutil import sys import tempfile import threading import time import types import weakref import zipfile import zoneinfo from importlib import import_module from pathlib import Path from subprocess import CompletedProcess from unittest import mock, skip, skipIf imp...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
true
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/utils_tests/test_feedgenerator.py
tests/utils_tests/test_feedgenerator.py
import datetime from unittest import mock from django.test import SimpleTestCase from django.utils import feedgenerator from django.utils.functional import SimpleLazyObject from django.utils.timezone import get_fixed_timezone class FeedgeneratorTests(SimpleTestCase): """ Tests for the low-level syndication f...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/utils_tests/test_timezone.py
tests/utils_tests/test_timezone.py
import datetime import zoneinfo from unittest import mock from django.test import SimpleTestCase, override_settings from django.utils import timezone PARIS_ZI = zoneinfo.ZoneInfo("Europe/Paris") EAT = timezone.get_fixed_timezone(180) # Africa/Nairobi ICT = timezone.get_fixed_timezone(420) # Asia/Bangkok UTC = datet...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/utils_tests/test_decorators.py
tests/utils_tests/test_decorators.py
from django.http import HttpResponse from django.template import engines from django.template.response import TemplateResponse from django.test import RequestFactory, SimpleTestCase from django.utils.decorators import decorator_from_middleware class ProcessViewMiddleware: def __init__(self, get_response): ...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/utils_tests/test_csp.py
tests/utils_tests/test_csp.py
from secrets import token_urlsafe from unittest.mock import patch from django.test import SimpleTestCase from django.utils.csp import CSP, LazyNonce, build_policy, generate_nonce from django.utils.functional import empty basic_config = { "default-src": [CSP.SELF], } alt_config = { "default-src": [CSP.SELF, CS...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/utils_tests/test_dateparse.py
tests/utils_tests/test_dateparse.py
import unittest from datetime import date, datetime, time, timedelta from django.utils.dateparse import ( parse_date, parse_datetime, parse_duration, parse_time, ) from django.utils.timezone import get_fixed_timezone class DateParseTests(unittest.TestCase): def test_parse_date(self): # Va...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/utils_tests/test_json.py
tests/utils_tests/test_json.py
import json from collections import UserList, defaultdict from datetime import datetime from decimal import Decimal from django.test import SimpleTestCase from django.utils.json import normalize_json class JSONNormalizeTestCase(SimpleTestCase): def test_converts_json_types(self): for test_case, expected ...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/utils_tests/test_hashable.py
tests/utils_tests/test_hashable.py
from django.test import SimpleTestCase from django.utils.hashable import make_hashable class TestHashable(SimpleTestCase): def test_equal(self): tests = ( ([], ()), (["a", 1], ("a", 1)), ({}, ()), ({"a"}, ("a",)), (frozenset({"a"}), {"a"}), ...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/utils_tests/test_http.py
tests/utils_tests/test_http.py
import platform import unittest from datetime import UTC, datetime from unittest import mock from django.test import SimpleTestCase from django.utils.datastructures import MultiValueDict from django.utils.http import ( MAX_HEADER_LENGTH, MAX_URL_LENGTH, base36_to_int, content_disposition_header, es...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/utils_tests/test_datastructures.py
tests/utils_tests/test_datastructures.py
""" Tests for stuff in django.utils.datastructures. """ import collections.abc import copy import pickle from django.test import SimpleTestCase from django.utils.datastructures import ( CaseInsensitiveMapping, DeferredSubDict, DictWrapper, ImmutableList, MultiValueDict, MultiValueDictKeyError,...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/utils_tests/test_inspect.py
tests/utils_tests/test_inspect.py
import subprocess import unittest from typing import TYPE_CHECKING from django.shortcuts import aget_object_or_404 from django.utils import inspect from django.utils.version import PY314 if TYPE_CHECKING: from django.utils.safestring import SafeString class Person: def no_arguments(self): return Non...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/utils_tests/models.py
tests/utils_tests/models.py
from django.db import models class Category(models.Model): name = models.CharField(max_length=100) class CategoryInfo(models.Model): category = models.OneToOneField(Category, models.CASCADE)
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/utils_tests/test_duration.py
tests/utils_tests/test_duration.py
import datetime import unittest from django.utils.dateparse import parse_duration from django.utils.duration import ( duration_iso_string, duration_microseconds, duration_string, ) class TestDurationString(unittest.TestCase): def test_simple(self): duration = datetime.timedelta(hours=1, minut...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/utils_tests/test_connection.py
tests/utils_tests/test_connection.py
from django.test import SimpleTestCase from django.utils.connection import BaseConnectionHandler class BaseConnectionHandlerTests(SimpleTestCase): def test_create_connection(self): handler = BaseConnectionHandler() msg = "Subclasses must implement create_connection()." with self.assertRais...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/utils_tests/test_tree.py
tests/utils_tests/test_tree.py
import copy import unittest from django.db.models.sql import AND, OR from django.utils.tree import Node class NodeTests(unittest.TestCase): def setUp(self): self.node1_children = [("a", 1), ("b", 2)] self.node1 = Node(self.node1_children) self.node2 = Node() def test_str(self): ...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/utils_tests/test_regex_helper.py
tests/utils_tests/test_regex_helper.py
import re import unittest from django.test import SimpleTestCase from django.utils import regex_helper class NormalizeTests(unittest.TestCase): def test_empty(self): pattern = r"" expected = [("", [])] result = regex_helper.normalize(pattern) self.assertEqual(result, expected) ...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/utils_tests/utils.py
tests/utils_tests/utils.py
import platform def on_macos_with_hfs(): """ MacOS 10.13 (High Sierra) and lower can use HFS+ as a filesystem. HFS+ has a time resolution of only one second which can be too low for some of the tests. """ macos_version = platform.mac_ver()[0] if macos_version != "": parsed_macos_ve...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/utils_tests/test_timesince.py
tests/utils_tests/test_timesince.py
import datetime import zoneinfo from django.test import TestCase from django.test.utils import override_settings, requires_tz_support from django.utils import timezone, translation from django.utils.timesince import timesince, timeuntil from django.utils.translation import npgettext_lazy class TimesinceTests(TestCas...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/utils_tests/test_deconstruct.py
tests/utils_tests/test_deconstruct.py
from django.test import SimpleTestCase from django.utils.deconstruct import deconstructible from django.utils.version import get_docs_version @deconstructible() class DeconstructibleClass: pass class DeconstructibleChildClass(DeconstructibleClass): pass @deconstructible( path="utils_tests.deconstructi...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/utils_tests/test_ipv6.py
tests/utils_tests/test_ipv6.py
import traceback from decimal import Decimal from io import StringIO from ipaddress import IPv6Address from django.core.exceptions import ValidationError from django.test import SimpleTestCase from django.utils.ipv6 import ( MAX_IPV6_ADDRESS_LENGTH, clean_ipv6_address, is_valid_ipv6_address, ) class Test...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/utils_tests/test_text.py
tests/utils_tests/test_text.py
import json import sys from unittest.mock import patch from django.core.exceptions import SuspiciousFileOperation from django.test import SimpleTestCase from django.utils import text from django.utils.functional import lazystr from django.utils.text import format_lazy from django.utils.translation import gettext_lazy,...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/utils_tests/test_no_submodule.py
tests/utils_tests/test_no_submodule.py
# Used to test for modules which don't have submodules.
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/utils_tests/test_choices.py
tests/utils_tests/test_choices.py
import collections.abc from unittest import mock from django.db.models import TextChoices from django.test import SimpleTestCase from django.utils.choices import ( BaseChoiceIterator, CallableChoiceIterator, flatten_choices, normalize_choices, ) from django.utils.translation import gettext_lazy as _ ...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/utils_tests/test_simplelazyobject.py
tests/utils_tests/test_simplelazyobject.py
import pickle from django.contrib.auth.models import User from django.test import TestCase from django.utils.functional import SimpleLazyObject class TestUtilsSimpleLazyObjectDjangoTestCase(TestCase): def test_pickle(self): user = User.objects.create_user("johndoe", "john@example.com", "pass") x ...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/utils_tests/__init__.py
tests/utils_tests/__init__.py
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/utils_tests/test_safestring.py
tests/utils_tests/test_safestring.py
from django.template import Context, Template from django.test import SimpleTestCase from django.utils import html, translation from django.utils.functional import Promise, lazy, lazystr from django.utils.safestring import SafeData, SafeString, mark_safe from django.utils.translation import gettext_lazy class custome...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/utils_tests/test_encoding.py
tests/utils_tests/test_encoding.py
import datetime import inspect import sys import unittest from pathlib import Path from unittest import mock from urllib.parse import quote, quote_plus from django.test import SimpleTestCase from django.utils.encoding import ( DjangoUnicodeDecodeError, escape_uri_path, filepath_to_uri, force_bytes, ...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/utils_tests/test_dateformat.py
tests/utils_tests/test_dateformat.py
from datetime import UTC, date, datetime, time, tzinfo from django.test import SimpleTestCase, override_settings from django.test.utils import TZ_SUPPORT, requires_tz_support from django.utils import dateformat, translation from django.utils.dateformat import format from django.utils.timezone import get_default_timezo...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/utils_tests/test_crypto.py
tests/utils_tests/test_crypto.py
import hashlib import unittest from django.test import SimpleTestCase from django.utils.crypto import ( InvalidAlgorithm, constant_time_compare, pbkdf2, salted_hmac, ) class TestUtilsCryptoMisc(SimpleTestCase): def test_constant_time_compare(self): # It's hard to test for constant time, j...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/utils_tests/test_os_utils.py
tests/utils_tests/test_os_utils.py
import os import unittest from pathlib import Path from django.core.exceptions import SuspiciousFileOperation from django.utils._os import safe_join, to_path class SafeJoinTests(unittest.TestCase): def test_base_path_ends_with_sep(self): drive, path = os.path.splitdrive(safe_join("/abc/", "abc")) ...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/utils_tests/deconstructible_classes.py
tests/utils_tests/deconstructible_classes.py
from .test_deconstruct import DeconstructibleWithPathClass # NOQA
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/utils_tests/test_module/another_bad_module.py
tests/utils_tests/test_module/another_bad_module.py
from . import site content = "Another Bad Module" site._registry.update( { "foo": "bar", } ) raise Exception("Some random exception.")
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/utils_tests/test_module/bad_module.py
tests/utils_tests/test_module/bad_module.py
import a_package_name_that_does_not_exist # NOQA content = "Bad Module"
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/utils_tests/test_module/another_good_module.py
tests/utils_tests/test_module/another_good_module.py
from . import site content = "Another Good Module" site._registry.update( { "lorem": "ipsum", } )
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/utils_tests/test_module/__main__.py
tests/utils_tests/test_module/__main__.py
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/utils_tests/test_module/main_module.py
tests/utils_tests/test_module/main_module.py
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/utils_tests/test_module/__init__.py
tests/utils_tests/test_module/__init__.py
class SiteMock: _registry = {} site = SiteMock()
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/utils_tests/test_module/good_module.py
tests/utils_tests/test_module/good_module.py
content = "Good Module"
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/utils_tests/test_module/child_module/grandchild_module.py
tests/utils_tests/test_module/child_module/grandchild_module.py
content = "Grandchild Module"
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/utils_tests/test_module/child_module/__init__.py
tests/utils_tests/test_module/child_module/__init__.py
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/select_related/models.py
tests/select_related/models.py
""" Tests for select_related() ``select_related()`` follows all relationships and pre-caches any foreign key values so that complex trees can be fetched in a single query. However, this isn't always a good idea, so the ``depth`` argument control how many "levels" the select-related behavior will traverse. """ from dj...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/select_related/__init__.py
tests/select_related/__init__.py
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/select_related/tests.py
tests/select_related/tests.py
import gc from django.core.exceptions import FieldError from django.db.models import FETCH_PEERS from django.test import SimpleTestCase, TestCase from django.test.utils import garbage_collect from .models import ( Bookmark, Domain, Family, Genus, HybridSpecies, Kingdom, Klass, Order, ...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/middleware_exceptions/views.py
tests/middleware_exceptions/views.py
from django.core.exceptions import PermissionDenied from django.http import HttpResponse from django.template import engines from django.template.response import TemplateResponse def normal_view(request): return HttpResponse("OK") def template_response(request): template = engines["django"].from_string( ...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/middleware_exceptions/middleware.py
tests/middleware_exceptions/middleware.py
from asgiref.sync import iscoroutinefunction, markcoroutinefunction from django.http import Http404, HttpResponse from django.template import engines from django.template.response import TemplateResponse from django.utils.decorators import ( async_only_middleware, sync_and_async_middleware, sync_only_middl...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/middleware_exceptions/__init__.py
tests/middleware_exceptions/__init__.py
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/middleware_exceptions/tests.py
tests/middleware_exceptions/tests.py
from django.conf import settings from django.core.exceptions import MiddlewareNotUsed from django.http import HttpResponse from django.test import RequestFactory, SimpleTestCase, override_settings from . import middleware as mw @override_settings(ROOT_URLCONF="middleware_exceptions.urls") class MiddlewareTests(Simpl...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/middleware_exceptions/urls.py
tests/middleware_exceptions/urls.py
from django.urls import path from . import views urlpatterns = [ path("middleware_exceptions/view/", views.normal_view), path("middleware_exceptions/error/", views.server_error), path("middleware_exceptions/permission_denied/", views.permission_denied), path("middleware_exceptions/exception_in_render/...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/transaction_hooks/models.py
tests/transaction_hooks/models.py
from django.db import models class Thing(models.Model): num = models.IntegerField()
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/transaction_hooks/__init__.py
tests/transaction_hooks/__init__.py
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/transaction_hooks/tests.py
tests/transaction_hooks/tests.py
from functools import partial from django.db import connection, transaction from django.test import TransactionTestCase, skipUnlessDBFeature from .models import Thing class ForcedError(Exception): pass @skipUnlessDBFeature("supports_transactions") class TestConnectionOnCommit(TransactionTestCase): """ ...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/lookup/models.py
tests/lookup/models.py
""" The lookup API This demonstrates features of the database API. """ from django.db import models from django.db.models.lookups import IsNull class Alarm(models.Model): desc = models.CharField(max_length=100) time = models.TimeField() def __str__(self): return "%s (%s)" % (self.time, self.des...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/lookup/test_decimalfield.py
tests/lookup/test_decimalfield.py
from django.db.models import F, Sum from django.test import TestCase from .models import Product, Stock class DecimalFieldLookupTests(TestCase): @classmethod def setUpTestData(cls): cls.p1 = Product.objects.create(name="Product1", qty_target=10) Stock.objects.create(product=cls.p1, qty_availa...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/lookup/__init__.py
tests/lookup/__init__.py
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/lookup/tests.py
tests/lookup/tests.py
import collections.abc from datetime import datetime from math import ceil from operator import attrgetter from unittest import mock, skipUnless from django.core.exceptions import FieldError from django.db import connection, models from django.db.models import ( BooleanField, Case, Exists, ExpressionWr...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
true
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/lookup/test_lookups.py
tests/lookup/test_lookups.py
from datetime import datetime from unittest import mock from django.db.models import DateTimeField, Value from django.db.models.lookups import Lookup, YearLookup from django.test import SimpleTestCase class CustomLookup(Lookup): pass class LookupTests(SimpleTestCase): def test_equality(self): looku...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/lookup/test_timefield.py
tests/lookup/test_timefield.py
from django.test import TestCase from .models import Alarm class TimeFieldLookupTests(TestCase): @classmethod def setUpTestData(self): # Create a few Alarms self.al1 = Alarm.objects.create(desc="Early", time="05:30") self.al2 = Alarm.objects.create(desc="Late", time="10:00") s...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/csrf_tests/views.py
tests/csrf_tests/views.py
from django.http import HttpResponse from django.middleware.csrf import get_token, rotate_token from django.template import Context, RequestContext, Template from django.template.context_processors import csrf from django.utils.decorators import decorator_from_middleware from django.utils.deprecation import MiddlewareM...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/csrf_tests/test_context_processor.py
tests/csrf_tests/test_context_processor.py
from django.http import HttpRequest from django.template.context_processors import csrf from django.test import SimpleTestCase from .tests import CsrfFunctionTestMixin class TestContextProcessor(CsrfFunctionTestMixin, SimpleTestCase): def test_force_token_to_string(self): request = HttpRequest() ...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/csrf_tests/csrf_token_error_handler_urls.py
tests/csrf_tests/csrf_token_error_handler_urls.py
urlpatterns = [] handler404 = "csrf_tests.views.csrf_token_error_handler"
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/csrf_tests/__init__.py
tests/csrf_tests/__init__.py
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/csrf_tests/tests.py
tests/csrf_tests/tests.py
import logging import re from django.conf import settings from django.contrib.sessions.backends.cache import SessionStore from django.core.exceptions import ImproperlyConfigured from django.http import HttpRequest, HttpResponse, UnreadablePostError from django.middleware.csrf import ( CSRF_ALLOWED_CHARS, CSRF_...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
true
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/m2m_multiple/models.py
tests/m2m_multiple/models.py
""" Multiple many-to-many relationships between the same two tables In this example, an ``Article`` can have many "primary" ``Category`` objects and many "secondary" ``Category`` objects. Set ``related_name`` to designate what the reverse relationship is called. """ from django.db import models class Category(mode...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false