hash
stringlengths
64
64
content
stringlengths
0
1.51M
0ac828f6b951a95bad0d81fb3c8d5c3ee36bc1383da5db9e56044a7bb405ade2
import json from django.conf import settings from django.contrib.admin.utils import quote from django.contrib.contenttypes.models import ContentType from django.db import models from django.urls import NoReverseMatch, reverse from django.utils import timezone from django.utils.text import get_text_list from django.uti...
d1b051ec7a035d1a91a75d612ac37f05fd623ad91bd4eb396b0550da9853ec98
import copy import json import operator import re from collections import OrderedDict 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, ...
95602ea5af074c144e8196c37984b59ffbce97ff3975c98f843c33d3e29ed6e8
from django.core.exceptions import SuspiciousOperation class DisallowedModelAdminLookup(SuspiciousOperation): """Invalid filter was passed to admin view via URL querystring""" pass class DisallowedModelAdminToField(SuspiciousOperation): """Invalid to_field was passed to admin view via URL query string""...
ee4ac4cc686101d6088ebf5ecf6190fb7d01faf3e2e66f8992e50921f90f628f
from functools import update_wrapper from weakref import WeakSet from django.apps import apps from django.contrib.admin import ModelAdmin, actions from django.contrib.auth import REDIRECT_FIELD_NAME from django.core.exceptions import ImproperlyConfigured from django.db.models.base import ModelBase from django.http imp...
4bba743694400cdc213e276b377aca37f2c225a1422875d7f70709c95a6996cc
""" Built-in, globally-available admin actions. """ from django.contrib import messages from django.contrib.admin import helpers from django.contrib.admin.utils import model_ngettext from django.core.exceptions import PermissionDenied from django.template.response import TemplateResponse from django.utils.translation ...
cc45192f0191578b52b7b89b413a04d012363082561cb39508913090021fff3c
""" Form Widget classes specific to the Django admin site. """ import copy import json from django import forms from django.conf import settings from django.core.exceptions import ValidationError from django.db.models.deletion import CASCADE from django.urls import reverse from django.urls.exceptions import NoReverseM...
a7410a6d564453cd89c842ab180e65218eae3c25a0246cf224cfe48a3f89baf8
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 = ...
85c4c352d9a24d2716f8b7c10edea30753b20c6a1447944dedfe2a964ae2a485
import datetime import decimal from collections import defaultdict from django.core.exceptions import FieldDoesNotExist from django.db import models, router from django.db.models.constants import LOOKUP_SEP from django.db.models.deletion import Collector from django.forms.utils import pretty_name from django.urls impo...
34378eef0516ed94fa420c7b7319300eb19d507292a342ccafb378dc73626e25
""" This encapsulates the logic for displaying filters in the Django admin. Filters are specified in models with the "list_filter" option. Each filter subclass knows how to display a filter for a field that passes a certain test -- e.g. being a DateField or ForeignKey. """ import datetime from django.contrib.admin.op...
843141a8228b2e9f3f79ad13d20b21b20507c3446052d3681c2a774397e43a10
from django import forms from django.contrib.auth.forms import AuthenticationForm, PasswordChangeForm from django.utils.translation import gettext_lazy as _ class AdminAuthenticationForm(AuthenticationForm): """ A custom authentication form used in the admin app. """ error_messages = { **Authe...
f3c824c09c6a6d1a668a0446d06bb718d4245c6b5336989c6b89dfde0a3efdc2
default_app_config = 'django.contrib.humanize.apps.HumanizeConfig'
3837c3ad21fc9b7cb7c58972208c26ec3666acd72860a1b62bc979994eb857b8
from django.apps import AppConfig from django.utils.translation import gettext_lazy as _ class HumanizeConfig(AppConfig): name = 'django.contrib.humanize' verbose_name = _("Humanize")
6b8e92816c90c4a95963f51d7c19ce2d5bc8b3c1c743b35cf31cb612abae883e
import functools import os from collections import OrderedDict from django.apps import apps from django.conf import settings from django.contrib.staticfiles import utils from django.core.checks import Error from django.core.exceptions import ImproperlyConfigured from django.core.files.storage import ( FileSystemSt...
786c4c51120ac62bfe744eeb3f58703605217f350ddfaf81739f230a91e09821
default_app_config = 'django.contrib.staticfiles.apps.StaticFilesConfig'
ac7f40f0d218b44900fcf4585d02719dd9b6e373ba333e86c32a964947b77f6e
from django.contrib.staticfiles.finders import get_finders def check_finders(app_configs=None, **kwargs): """Check all registered staticfiles finders.""" errors = [] for finder in get_finders(): try: finder_errors = finder.check() except NotImplementedError: pass ...
e829b2eca540ee7822bc1e34a6d6a6474daf19f3fe45ee8ac657acfbcca55854
from urllib.parse import urlparse from urllib.request import url2pathname from django.conf import settings from django.contrib.staticfiles import utils from django.contrib.staticfiles.views import serve from django.core.handlers.exception import response_for_exception from django.core.handlers.wsgi import WSGIHandler,...
ab44df81adb745f37d80244f868a600a1a8e16a6ed19f91cdfe55e1f50910a58
from django.apps import AppConfig from django.contrib.staticfiles.checks import check_finders from django.core import checks from django.utils.translation import gettext_lazy as _ class StaticFilesConfig(AppConfig): name = 'django.contrib.staticfiles' verbose_name = _("Static Files") ignore_patterns = ['C...
6ea1d63415de7253619823c81889e4ed2c0d1b204d8e55806dbee45f9462ebae
import fnmatch import os from django.conf import settings from django.core.exceptions import ImproperlyConfigured def matches_patterns(path, patterns=None): """ Return True or False depending on whether the ``path`` should be ignored (if it matches any pattern in ``ignore_patterns``). """ return ...
a300ccfe17723de466c58c598ac48ca299709f35aba6d23f5bcfb72b67fb2130
from django.conf import settings from django.conf.urls.static import static from django.contrib.staticfiles.views import serve urlpatterns = [] def staticfiles_urlpatterns(prefix=None): """ Helper function to return a URL pattern for serving static files. """ if prefix is None: prefix = setti...
09a599ab800711b3865bb9a0ff499b90650ff0a253955367a1f0c1348851528e
""" Views and functions for serving static files. These are only to be used during development, and SHOULD NOT be used in a production setting. """ import os import posixpath from django.conf import settings from django.contrib.staticfiles import finders from django.http import Http404 from django.views import static...
c0e886dce6da2ebc3d63c96a31ce1c1f84a5d13daafdffa5984e8043eb7202d6
import hashlib import json import os import posixpath import re from collections import OrderedDict from urllib.parse import unquote, urldefrag, urlsplit, urlunsplit from django.conf import settings from django.contrib.staticfiles.utils import check_settings, matches_patterns from django.core.cache import ( Invali...
e17f84b4e7d79f0909032153f2a7b81f8b1b5532a033ae6494b52d63cd4a1e21
from django.contrib.staticfiles.handlers import StaticFilesHandler from django.test import LiveServerTestCase class StaticLiveServerTestCase(LiveServerTestCase): """ Extend django.test.LiveServerTestCase to transparently overlay at test execution-time the assets provided by the staticfiles app finders. Th...
a5ae8c9abdec7d9d8a0645c702f608c3f85a471f2d4aa4cd665b942a0e734029
default_app_config = 'django.contrib.flatpages.apps.FlatPagesConfig'
2c39f23332db9929a99847a6760cebc76bab83c3ed9d1818da3c5b0beb901fd8
from django.contrib.sites.models import Site from django.db import models from django.urls import get_script_prefix from django.utils.encoding import iri_to_uri from django.utils.translation import gettext_lazy as _ class FlatPage(models.Model): url = models.CharField(_('URL'), max_length=100, db_index=True) ...
9bf4ec151037e9bba73eb8367527710c9a562df26489a56613791c6003bdb6b6
from django.contrib import admin from django.contrib.flatpages.forms import FlatpageForm from django.contrib.flatpages.models import FlatPage from django.utils.translation import gettext_lazy as _ @admin.register(FlatPage) class FlatPageAdmin(admin.ModelAdmin): form = FlatpageForm fieldsets = ( (None,...
10c2ab1aeba5430a9795c18a46f9884956a2a92355c3051eb44784a373d38f10
from django.apps import AppConfig from django.utils.translation import gettext_lazy as _ class FlatPagesConfig(AppConfig): name = 'django.contrib.flatpages' verbose_name = _("Flat Pages")
d1618c2dfafad47e5a557d629c4e17fc1261c766ff970e0b28c3b83901a20d7e
from django.apps import apps as django_apps from django.contrib.sitemaps import Sitemap from django.core.exceptions import ImproperlyConfigured class FlatPageSitemap(Sitemap): def items(self): if not django_apps.is_installed('django.contrib.sites'): raise ImproperlyConfigured("FlatPageSitemap ...
bff6cff00c657f45cb81bda42557443c3a96f1663b464c12c26eff047ff47961
from django.contrib.flatpages import views from django.urls import path urlpatterns = [ path('<path:url>', views.flatpage, name='django.contrib.flatpages.views.flatpage'), ]
9cf7faa984689e51168d630dc083cff8c1f47e9f026c1e0a4aab5d94e52a337d
from django import forms from django.conf import settings from django.contrib.flatpages.models import FlatPage from django.utils.translation import gettext, gettext_lazy as _ class FlatpageForm(forms.ModelForm): url = forms.RegexField( label=_("URL"), max_length=100, regex=r'^[-\w/\.~]+$',...
69778e78e9149a976418ecaa667911fa5d55ac3435eb54562166b758f06119a7
from django.conf import settings from django.contrib.flatpages.views import flatpage from django.http import Http404 from django.utils.deprecation import MiddlewareMixin class FlatpageFallbackMiddleware(MiddlewareMixin): def process_response(self, request, response): if response.status_code != 404: ...
0cbae897fc7b9587ef77f6fc11880578e62579ddd3812a11f8a64e39a4f32404
from django.conf import settings from django.contrib.flatpages.models import FlatPage from django.contrib.sites.shortcuts import get_current_site from django.http import Http404, HttpResponse, HttpResponsePermanentRedirect from django.shortcuts import get_object_or_404 from django.template import loader from django.uti...
2ba72048e74de229ecfd38968d4224185c2e89b266b214e51689ea613d902abc
""" Creates the default Site object. """ from django.apps import apps as global_apps from django.conf import settings from django.core.management.color import no_style from django.db import DEFAULT_DB_ALIAS, connections, router def create_default_site(app_config, verbosity=2, interactive=True, using=DEFAULT_DB_ALIAS...
459af5893f3363fcfca39d8f21610114240bd37a44dbca69ebbd3c2ef792db8d
from django.apps import apps def get_current_site(request): """ Check if contrib.sites is installed and return either the current ``Site`` object or a ``RequestSite`` object based on the request. """ # Imports are inside the function because its point is to avoid importing # the Site models wh...
ef846138dcdb46a106a0d5cbbb84fb663005298bc22e663f5d05a7191cfa8ddc
class RequestSite: """ A class that shares the primary interface of Site (i.e., it has ``domain`` and ``name`` attributes) but gets its data from an HttpRequest object rather than from a database. The save() and delete() methods raise NotImplementedError. """ def __init__(self, request): ...
a888fa3ec6f24ff0d592f8eb012bdefbd17c19ea022afeac3b4fa394485126fe
default_app_config = 'django.contrib.sites.apps.SitesConfig'
3897ca89c10ebaa703d01ecdb87e2c72cceb927419f97d4d7f53cbd17816a8b3
from django.conf import settings from django.core import checks from django.core.exceptions import FieldDoesNotExist from django.db import models class CurrentSiteManager(models.Manager): "Use this to limit objects to those associated with the current site." use_in_migrations = True def __init__(self, f...
823e2eea6afc96f3a504935a177a52a804fab64e189e4b6668a96906e0cd1340
import string from django.core.exceptions import ImproperlyConfigured, ValidationError from django.db import models from django.db.models.signals import pre_delete, pre_save from django.http.request import split_domain_port from django.utils.translation import gettext_lazy as _ SITE_CACHE = {} def _simple_domain_na...
0a5cc2467e1f50f58ed5d36511610f8d20c89e72bced76cd46669dbe362cd60a
from django.contrib import admin from django.contrib.sites.models import Site @admin.register(Site) class SiteAdmin(admin.ModelAdmin): list_display = ('domain', 'name') search_fields = ('domain', 'name')
c516249fc6dbc4e2bbad2b0388b1cf93152a00de22b1c54cbf02888e2c1d8fde
from django.apps import AppConfig 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.contrib.sites' verbose_name = _("Sites") def ready(self): post_migra...
a987151ec1ce83457140d4b8b1aa0b1e4745e74de7251f83ed9d35bc4d12bd43
from django.utils.deprecation import MiddlewareMixin from .shortcuts import get_current_site class CurrentSiteMiddleware(MiddlewareMixin): """ Middleware that sets `site` attribute to request object. """ def process_request(self, request): request.site = get_current_site(request)
395728087605f6116cf809c57e0dad8e675eb6eab1f7e6618bda5d18f020c07e
default_app_config = 'django.contrib.contenttypes.apps.ContentTypesConfig'
a285bdf7b8c4d72e60a1680edddcdceed7c9b79678b493d6451486d4fd7e01c5
from itertools import chain from django.apps import apps from django.core.checks import Error def check_generic_foreign_keys(app_configs=None, **kwargs): from .fields import GenericForeignKey if app_configs is None: models = apps.get_models() else: models = chain.from_iterable(app_config...
417fa7634f18303379714a8a3457fa1b421516cf6821e29af213889798e44e31
from collections import defaultdict from django.apps import apps from django.db import models from django.utils.translation import gettext_lazy as _ class ContentTypeManager(models.Manager): use_in_migrations = True def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) # Cac...
41e12516d660214cc259ad507cb85bf6ba5bf9765263ec5a971f913403790a84
from functools import partial from django.contrib.admin.checks import InlineModelAdminChecks from django.contrib.admin.options import InlineModelAdmin, flatten_fieldsets from django.contrib.contenttypes.fields import GenericForeignKey from django.contrib.contenttypes.forms import ( BaseGenericInlineFormSet, generi...
9559a7256ec3808738dae734579bd92fcab19ec9d58a342681e961b379f26c81
from django.apps import AppConfig from django.contrib.contenttypes.checks import ( check_generic_foreign_keys, check_model_name_lengths, ) from django.core import checks from django.db.models.signals import post_migrate, pre_migrate from django.utils.translation import gettext_lazy as _ from .management import ( ...
dcce57b2554be1eaec338e92de78c1c59c5ba62b85783686e579d71417cbf070
from collections import defaultdict from django.contrib.contenttypes.models import ContentType from django.core import checks from django.core.exceptions import FieldDoesNotExist, ObjectDoesNotExist from django.db import DEFAULT_DB_ALIAS, models, router, transaction from django.db.models import DO_NOTHING from django....
f79b465ff1762a4223a014c541c76fadaca92f3e858f72dd08b387c7ef200ab4
from django.contrib.contenttypes.models import ContentType from django.db import models from django.forms import ModelForm, modelformset_factory from django.forms.models import BaseModelFormSet class BaseGenericInlineFormSet(BaseModelFormSet): """ A formset for generic inline objects to a parent. """ ...
d20cb2dc08c49970fd4567f2f6cb7cc0e47b25a99c51110c9943559647ff5483
from django.apps import apps from django.contrib.contenttypes.models import ContentType from django.contrib.sites.shortcuts import get_current_site from django.core.exceptions import ObjectDoesNotExist from django.http import Http404, HttpResponseRedirect from django.utils.translation import gettext as _ def shortcut...
e45a1fc02941fee9300ac5cf7c96f352f2a861a310efc07f9565d4d1fa928359
""" This module allows importing AbstractBaseSession even when django.contrib.sessions is not in INSTALLED_APPS. """ from django.db import models from django.utils.translation import gettext_lazy as _ class BaseSessionManager(models.Manager): def encode(self, session_dict): """ Return the given se...
5bb90ab7e80244eceb500e94a484408addd21daf9ca0de3f0387e98468a40849
default_app_config = 'django.contrib.sessions.apps.SessionsConfig'
be644ea2ccec5c79cf1e849b15c6bc93e53d67c5a0e8400761e10af3b5471e4f
from django.contrib.sessions.base_session import ( AbstractBaseSession, BaseSessionManager, ) class SessionManager(BaseSessionManager): use_in_migrations = True class Session(AbstractBaseSession): """ Django provides full support for anonymous sessions. The session framework lets you store and r...
7a9bdf1bd85a1dcf29df821ce88a94482f988f4e91ba1d934a6f46e8740c767a
from django.core.exceptions import SuspiciousOperation class InvalidSessionKey(SuspiciousOperation): """Invalid characters in session key""" pass class SuspiciousSession(SuspiciousOperation): """The session may be tampered with""" pass
abf7e4a7b6bbff5193d785c790780d2044f4b08b607c17854fb075dfbfca7993
from django.apps import AppConfig from django.utils.translation import gettext_lazy as _ class SessionsConfig(AppConfig): name = 'django.contrib.sessions' verbose_name = _("Sessions")
154518f975f08a9200d3ce6025234d713c5542aa35d9813d1056a29c8c4d3dd5
import pickle from django.core.signing import JSONSerializer as BaseJSONSerializer class PickleSerializer: """ Simple wrapper around pickle to be used in signing.dumps and signing.loads. """ def dumps(self, obj): return pickle.dumps(obj, pickle.HIGHEST_PROTOCOL) def loads(self, data)...
ddf5524178ca38f8552c488bbe092917e3f174140ee5ae845f4ba0af28f34a5f
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....
7c77f71d83fa30ff067ae056e86df2e9ddf4323c5ae882f6c6d99b9438d2f24e
import zipfile from io import BytesIO from django.conf import settings from django.http import HttpResponse from django.template import loader # NumPy supported? try: import numpy except ImportError: numpy = False def compress_kml(kml): "Return compressed KMZ from the given KML string." kmz = BytesI...
b135d9761dc3d541860c13fe599da3bcb515b2d709ff62a7d7f3e5289b21343a
import re # Regular expression for recognizing HEXEWKB and WKT. A prophylactic measure # to prevent potentially malicious input from reaching the underlying C # library. Not a substitute for good Web security programming practices. hex_regex = re.compile(r'^[0-9A-F]+$', re.I) wkt_regex = re.compile(r'^(SRID=(?P<srid...
19349025b2aa424362963599ca5632fe87d120225ea8891faa69c2f597716762
default_app_config = 'django.contrib.gis.apps.GISConfig'
62421b124e2b5a56cdd3366bbb6b9ec06b0bcea5ac30397bcaa03883fe694f5d
from django.apps import AppConfig from django.core import serializers from django.utils.translation import gettext_lazy as _ class GISConfig(AppConfig): name = 'django.contrib.gis' verbose_name = _("GIS") def ready(self): serializers.BUILTIN_SERIALIZERS.setdefault('geojson', 'django.contrib.gis.s...
dd8a144e8b06f2867672899a5bb39ccee0ad0103328a844f8c38db22ab3480b2
from ctypes import c_void_p class CPointerBase: """ Base class for objects that have a pointer access property that controls access to the underlying C pointer. """ _ptr = None # Initially the pointer is NULL. ptr_type = c_void_p destructor = None null_ptr_exception_class = AttributeE...
bc2621342eea46f3c83c62f0f069c0aa2f9cd520b0409970b81b59dfa9fb2d26
from django.contrib.syndication.views import Feed as BaseFeed from django.utils.feedgenerator import Atom1Feed, Rss201rev2Feed class GeoFeedMixin: """ This mixin provides the necessary routines for SyndicationFeed subclasses to produce simple GeoRSS or W3C Geo elements. """ def georss_coords(self...
1a9389f16e6093ec5b07ccb7c0f7b676fa15bad3ca66ab3085c3160844c19f1d
from django.http import Http404 from django.utils.translation import gettext as _ def feed(request, url, feed_dict=None): """Provided for backwards compatibility.""" if not feed_dict: raise Http404(_("No feeds are registered.")) slug = url.partition('/')[0] try: f = feed_dict[slug] ...
04b59390330cba7bda37d951f100ee8e628ec54ca10502b2d7402ea349e90da4
# Copyright (c) 2007, Robert Coup <robert.coup@onetrackmind.co.nz> # All rights reserved. # # Redistribution and use in source and binary forms, with or without modification, # are permitted provided that the following conditions are met: # # 1. Redistributions of source code must retain the above copyright notice, #...
233520f4e65ad9edc08f05f86c214495d5f368bb13e0ee169db52079429eeaa8
from django.contrib.sitemaps import ping_google from django.core.management.base import BaseCommand class Command(BaseCommand): help = "Ping Google with an updated sitemap, pass optional url of sitemap" def add_arguments(self, parser): parser.add_argument('sitemap_url', nargs='?', default=None) ...
8170c76d0f4a81075f8583a56bd423e7dfd2944f565114222b3200d1c147d034
from django.conf import settings from django.utils.module_loading import import_string def default_storage(request): """ Callable with the same interface as the storage classes. This isn't just default_storage = import_string(settings.MESSAGE_STORAGE) to avoid accessing the settings at the module lev...
bc0bd4601ce7491636ced7de65ee5adfccaeab56b5d4b1a40dc86cddcdc0c0c1
import json from django.conf import settings from django.contrib.messages.storage.base import BaseStorage, Message from django.http import SimpleCookie from django.utils.crypto import constant_time_compare, salted_hmac from django.utils.safestring import SafeData, mark_safe class MessageEncoder(json.JSONEncoder): ...
29302ababd4a30951cfa5883f88d2654361b69f312db7cf165f9c5cf85cf8a25
import json from django.conf import settings from django.contrib.messages.storage.base import BaseStorage from django.contrib.messages.storage.cookie import ( MessageDecoder, MessageEncoder, ) class SessionStorage(BaseStorage): """ Store messages in the session (that is, django.contrib.sessions). """...
e281ac4bc823310d396b1e24efeb570eba28861c47f622285cdc8e5d57e41bb7
from django.contrib.messages.storage.base import BaseStorage from django.contrib.messages.storage.cookie import CookieStorage from django.contrib.messages.storage.session import SessionStorage class FallbackStorage(BaseStorage): """ Try to store all messages in the first backend. Store any unstored messag...
4b22f25507917663ef56df523b8b2b09d21bd26da806ed47fe23b1e34338f013
from django.conf import settings from django.contrib.messages import constants, utils LEVEL_TAGS = utils.get_level_tags() class Message: """ Represent an actual message that can be stored in any of the supported storage classes (typically session- or cookie-based) and rendered in a view or template. ...
5e8f30b963f054d3a4298f84c15f54d73bac4360e33175ed2fbffc47fc408b9b
from .array import * # NOQA from .citext import * # NOQA from .hstore import * # NOQA from .jsonb import * # NOQA from .ranges import * # NOQA
1b8d1466fe33a29f19aeadaf32196e67e313ef23cb11cf081038b7859dbb806c
from django.db.models import CharField, EmailField, TextField __all__ = ['CICharField', 'CIEmailField', 'CIText', 'CITextField'] class CIText: def get_internal_type(self): return 'CI' + super().get_internal_type() def db_type(self, connection): return 'citext' class CICharField(CIText, Ch...
e3fca017c070d2f0474a5c8a27f36763f653b215593675691af6e398cd5d628d
import json from django.contrib.postgres import lookups from django.contrib.postgres.forms import SimpleArrayField from django.contrib.postgres.validators import ArrayMaxLengthValidator from django.core import checks, exceptions from django.db.models import Field, IntegerField, Transform from django.db.models.lookups ...
a33044b198ef1901963994cdf15ba90cc54bd7d9872d7332599a44495833582d
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 .utils import AttributeSetter __all__ = [ 'RangeField', 'IntegerRangeField', 'BigIntegerRangeField', 'FloatRangeField',...
4d5f808fd56905bd772368aece2483511b6d66dcf7e795da9315e7170bed1a2a
class AttributeSetter: def __init__(self, name, value): setattr(self, name, value)
798b57cd1d9e73c27ce7ae1bf9e694b04d7b50efc0224aab94a0fea741a54c6a
from django.core import checks class CheckFieldDefaultMixin: _default_hint = ('<valid default>', '<invalid default>') def _check_default(self): if self.has_default() and self.default is not None and not callable(self.default): return [ checks.Warning( "...
a197545d2032dcca59def65253a78a5839f0446428a451af194728fea3a530d8
import json from django.contrib.postgres import forms, lookups from django.contrib.postgres.fields.array import ArrayField from django.core import exceptions from django.db.models import Field, TextField, Transform from django.utils.translation import gettext_lazy as _ from .mixins import CheckFieldDefaultMixin __al...
1669a41aaf59d3c7d76675824b72337bc9ddbc838600070cc8ac6a5b2c58962c
import json from psycopg2.extras import Json from django.contrib.postgres import forms, lookups from django.core import exceptions from django.db.models import ( Field, TextField, Transform, lookups as builtin_lookups, ) from django.utils.translation import gettext_lazy as _ from .mixins import CheckFieldDefault...
192aae711e7423d8eb6546195055666fc9d5fc54a55eed41702a45724da95572
from .array import * # NOQA from .hstore import * # NOQA from .jsonb import * # NOQA from .ranges import * # NOQA
dc7a7843d252ce2b9a89ed9cd0a2c7f99ed11ecdedd0c81b89cb239cb2315769
import copy from itertools import chain from django import forms from django.contrib.postgres.validators import ( ArrayMaxLengthValidator, ArrayMinLengthValidator, ) from django.core.exceptions import ValidationError from django.utils.translation import gettext_lazy as _ from ..utils import prefix_validation_erro...
fcb597cac4f601dbe04ac02d3723f11cfd21813a25b10a143822d64fb2ae9280
from psycopg2.extras import DateRange, DateTimeTZRange, NumericRange from django import forms from django.core import exceptions from django.forms.widgets import MultiWidget from django.utils.translation import gettext_lazy as _ __all__ = [ 'BaseRangeField', 'IntegerRangeField', 'FloatRangeField', 'DateTimeRa...
7fb3c9e357ec77c0fb72fc891befee82c94cfa15cbeea9d93ddc74f146503576
import json from django import forms from django.core.exceptions import ValidationError from django.utils.translation import gettext_lazy as _ __all__ = ['HStoreField'] class HStoreField(forms.CharField): """ A field for HStore data which accepts dictionary JSON input. """ widget = forms.Textarea ...
d6d46668d52f1fc213c46480b60d1b214c0fce02d6fbca35b1182c6c2215d5e9
import json from django import forms from django.utils.translation import gettext_lazy as _ __all__ = ['JSONField'] class InvalidJSONInput(str): pass class JSONString(str): pass class JSONField(forms.CharField): default_error_messages = { 'invalid': _("'%(value)s' value must be valid JSON.")...
599a92b3b5dc9d15b8897209ee889bddaa0b3eb1c210e2e1f8afc40c1269b1e5
from django.contrib.postgres.fields import ArrayField, JSONField from django.db.models.aggregates import Aggregate __all__ = [ 'ArrayAgg', 'BitAnd', 'BitOr', 'BoolAnd', 'BoolOr', 'JSONBAgg', 'StringAgg', ] class ArrayAgg(Aggregate): function = 'ARRAY_AGG' template = '%(function)s(%(distinct)s%(expression...
402ce7a8c2aa3dba6b6b14a2d58f3e07bfcc6252f8d85d641166751de2e04cab
from .general import * # NOQA from .statistics import * # NOQA
356cb13200ec7d0ddfe72bea01cc49d772daca31a444f8fdd305496b893b41d3
from django.db.models import FloatField, IntegerField from django.db.models.aggregates import Aggregate __all__ = [ 'CovarPop', 'Corr', 'RegrAvgX', 'RegrAvgY', 'RegrCount', 'RegrIntercept', 'RegrR2', 'RegrSlope', 'RegrSXX', 'RegrSXY', 'RegrSYY', 'StatAggregate', ] class StatAggregate(Aggregate): output_f...
8e5f96e343fd018dd51d43faf539974b794a545970195207274e251050648046
from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('sites', '0001_initial'), ] operations = [ migrations.CreateModel( name='Redirect', fields=[ ('id', models.AutoField(verbose_name='ID', serialize=Fals...
d2cf593c658d3fd1d3ed399702e0a130b2f02f5325e52750c0db3da9fcb974de
from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('auth', '0004_alter_user_username_opts'), ] operations = [ migrations.AlterField( model_name='user', name='last_login', field=models.DateTimeField(null=Tr...
c5296132251bad508f30ec26c15340520623662877b7e89e00b366eeb435388d
from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('auth', '0001_initial'), ] operations = [ migrations.AlterField( model_name='permission', name='name', field=models.CharField(max_length=255, verbose_name...
fd2ee8fcc854d250273e10c4b74921d6c066a422d75bcf1506e01311188c0659
from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('auth', '0005_alter_user_last_login_null'), ('contenttypes', '0002_remove_content_type_name'), ] operations = [ # Ensure the contenttypes migration is applied before sending # post_m...
68dd281e8039ab66caa4937c4a723c4fd18db5304accb445a332fceed361f3f2
from django.contrib.auth import validators from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('auth', '0003_alter_user_email_max_length'), ] # No database changes; modifies validators and error_messages (#13147). operations = [ migration...
af02ece520f3149b032ad09fc8c3fa5ee7943c7891bd131e8a7df05cccc77839
from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('auth', '0008_alter_user_username_max_length'), ] operations = [ migrations.AlterField( model_name='user', name='last_name', field=models.CharField(blank=...
6f3ec1d762b93afb346a25df6463046d5b5601e574e49c8b2831b232b84277f7
import django.contrib.auth.models from django.contrib.auth import validators from django.db import migrations, models from django.utils import timezone class Migration(migrations.Migration): dependencies = [ ('contenttypes', '__first__'), ] operations = [ migrations.CreateModel( ...
6cf7290933c0255d8d82bc046ba5857f19216cf9a3e49f84a94d47337457b6ad
from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('auth', '0002_alter_permission_name_max_length'), ] operations = [ migrations.AlterField( model_name='user', name='email', field=models.EmailField(max_len...
2a9795ba49edffb584ad03bf58b0d208c835b099170978cd439238bbf97df647
from django.contrib.auth import validators from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('auth', '0007_alter_validators_add_error_messages'), ] operations = [ migrations.AlterField( model_name='user', name='usern...
25e2699bf8f2bb609b05c930e3126dd039704384838367f21ea76e44b6751c52
from django.contrib.auth import validators from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('auth', '0006_require_contenttypes_0002'), ] operations = [ migrations.AlterField( model_name='user', name='username', ...
379b08e148a09a6acebc3967e7f45cfa8ee26cdda3b20766b949ae5542246cb5
""" Creates permissions for all installed apps that need permissions. """ import getpass import unicodedata from django.apps import apps as global_apps from django.contrib.auth import get_permission_codename from django.contrib.contenttypes.management import create_contenttypes from django.core import exceptions from ...
8744f4eb94626703008776a2d8831e88441dce658aeb6a9a87b5a63a5a2ee822
from django import db from django.contrib import auth from django.utils.encoding import force_bytes UserModel = auth.get_user_model() def check_password(environ, username, password): """ Authenticate against Django's auth database. mod_wsgi docs specify None, True, False as return value depending on...
187299209d98073416e12bea7b39234cf8fe5bb5703450f5c28924a3dac54052
import getpass from django.contrib.auth import get_user_model from django.contrib.auth.password_validation import validate_password from django.core.exceptions import ValidationError from django.core.management.base import BaseCommand, CommandError from django.db import DEFAULT_DB_ALIAS UserModel = get_user_model() ...
3884d3328802f910aa3495be1dcb6605138ab52d7017bbea896cdbd937a357ca
""" Management utility to create superusers. """ import getpass import sys from django.contrib.auth import get_user_model from django.contrib.auth.management import get_default_username from django.contrib.auth.password_validation import validate_password from django.core import exceptions from django.core.management....
ffb5c55ae6ed43b346d1e434d8caadc574268c199873a39de6bc1c0224f5682b
from django.db import migrations, models from django.utils import timezone class Migration(migrations.Migration): dependencies = [ ('admin', '0001_initial'), ] # No database changes; removes auto_add and adds default/editable. operations = [ migrations.AlterField( model_n...