before send to remote
This commit is contained in:
205
env/lib/python3.8/site-packages/django/contrib/auth/migrations/0001_initial.py
vendored
Normal file
205
env/lib/python3.8/site-packages/django/contrib/auth/migrations/0001_initial.py
vendored
Normal file
@@ -0,0 +1,205 @@
|
||||
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(
|
||||
name="Permission",
|
||||
fields=[
|
||||
(
|
||||
"id",
|
||||
models.AutoField(
|
||||
verbose_name="ID",
|
||||
serialize=False,
|
||||
auto_created=True,
|
||||
primary_key=True,
|
||||
),
|
||||
),
|
||||
("name", models.CharField(max_length=50, verbose_name="name")),
|
||||
(
|
||||
"content_type",
|
||||
models.ForeignKey(
|
||||
to="contenttypes.ContentType",
|
||||
on_delete=models.CASCADE,
|
||||
verbose_name="content type",
|
||||
),
|
||||
),
|
||||
("codename", models.CharField(max_length=100, verbose_name="codename")),
|
||||
],
|
||||
options={
|
||||
"ordering": [
|
||||
"content_type__app_label",
|
||||
"content_type__model",
|
||||
"codename",
|
||||
],
|
||||
"unique_together": {("content_type", "codename")},
|
||||
"verbose_name": "permission",
|
||||
"verbose_name_plural": "permissions",
|
||||
},
|
||||
managers=[
|
||||
("objects", django.contrib.auth.models.PermissionManager()),
|
||||
],
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name="Group",
|
||||
fields=[
|
||||
(
|
||||
"id",
|
||||
models.AutoField(
|
||||
verbose_name="ID",
|
||||
serialize=False,
|
||||
auto_created=True,
|
||||
primary_key=True,
|
||||
),
|
||||
),
|
||||
(
|
||||
"name",
|
||||
models.CharField(unique=True, max_length=80, verbose_name="name"),
|
||||
),
|
||||
(
|
||||
"permissions",
|
||||
models.ManyToManyField(
|
||||
to="auth.Permission", verbose_name="permissions", blank=True
|
||||
),
|
||||
),
|
||||
],
|
||||
options={
|
||||
"verbose_name": "group",
|
||||
"verbose_name_plural": "groups",
|
||||
},
|
||||
managers=[
|
||||
("objects", django.contrib.auth.models.GroupManager()),
|
||||
],
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name="User",
|
||||
fields=[
|
||||
(
|
||||
"id",
|
||||
models.AutoField(
|
||||
verbose_name="ID",
|
||||
serialize=False,
|
||||
auto_created=True,
|
||||
primary_key=True,
|
||||
),
|
||||
),
|
||||
("password", models.CharField(max_length=128, verbose_name="password")),
|
||||
(
|
||||
"last_login",
|
||||
models.DateTimeField(
|
||||
default=timezone.now, verbose_name="last login"
|
||||
),
|
||||
),
|
||||
(
|
||||
"is_superuser",
|
||||
models.BooleanField(
|
||||
default=False,
|
||||
help_text=(
|
||||
"Designates that this user has all permissions without "
|
||||
"explicitly assigning them."
|
||||
),
|
||||
verbose_name="superuser status",
|
||||
),
|
||||
),
|
||||
(
|
||||
"username",
|
||||
models.CharField(
|
||||
help_text=(
|
||||
"Required. 30 characters or fewer. Letters, digits and "
|
||||
"@/./+/-/_ only."
|
||||
),
|
||||
unique=True,
|
||||
max_length=30,
|
||||
verbose_name="username",
|
||||
validators=[validators.UnicodeUsernameValidator()],
|
||||
),
|
||||
),
|
||||
(
|
||||
"first_name",
|
||||
models.CharField(
|
||||
max_length=30, verbose_name="first name", blank=True
|
||||
),
|
||||
),
|
||||
(
|
||||
"last_name",
|
||||
models.CharField(
|
||||
max_length=30, verbose_name="last name", blank=True
|
||||
),
|
||||
),
|
||||
(
|
||||
"email",
|
||||
models.EmailField(
|
||||
max_length=75, verbose_name="email address", blank=True
|
||||
),
|
||||
),
|
||||
(
|
||||
"is_staff",
|
||||
models.BooleanField(
|
||||
default=False,
|
||||
help_text=(
|
||||
"Designates whether the user can log into this admin site."
|
||||
),
|
||||
verbose_name="staff status",
|
||||
),
|
||||
),
|
||||
(
|
||||
"is_active",
|
||||
models.BooleanField(
|
||||
default=True,
|
||||
verbose_name="active",
|
||||
help_text=(
|
||||
"Designates whether this user should be treated as active. "
|
||||
"Unselect this instead of deleting accounts."
|
||||
),
|
||||
),
|
||||
),
|
||||
(
|
||||
"date_joined",
|
||||
models.DateTimeField(
|
||||
default=timezone.now, verbose_name="date joined"
|
||||
),
|
||||
),
|
||||
(
|
||||
"groups",
|
||||
models.ManyToManyField(
|
||||
to="auth.Group",
|
||||
verbose_name="groups",
|
||||
blank=True,
|
||||
related_name="user_set",
|
||||
related_query_name="user",
|
||||
help_text=(
|
||||
"The groups this user belongs to. A user will get all "
|
||||
"permissions granted to each of their groups."
|
||||
),
|
||||
),
|
||||
),
|
||||
(
|
||||
"user_permissions",
|
||||
models.ManyToManyField(
|
||||
to="auth.Permission",
|
||||
verbose_name="user permissions",
|
||||
blank=True,
|
||||
help_text="Specific permissions for this user.",
|
||||
related_name="user_set",
|
||||
related_query_name="user",
|
||||
),
|
||||
),
|
||||
],
|
||||
options={
|
||||
"swappable": "AUTH_USER_MODEL",
|
||||
"verbose_name": "user",
|
||||
"verbose_name_plural": "users",
|
||||
},
|
||||
managers=[
|
||||
("objects", django.contrib.auth.models.UserManager()),
|
||||
],
|
||||
),
|
||||
]
|
@@ -0,0 +1,16 @@
|
||||
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="name"),
|
||||
),
|
||||
]
|
@@ -0,0 +1,18 @@
|
||||
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_length=254, verbose_name="email address", blank=True
|
||||
),
|
||||
),
|
||||
]
|
28
env/lib/python3.8/site-packages/django/contrib/auth/migrations/0004_alter_user_username_opts.py
vendored
Normal file
28
env/lib/python3.8/site-packages/django/contrib/auth/migrations/0004_alter_user_username_opts.py
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
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 = [
|
||||
migrations.AlterField(
|
||||
model_name="user",
|
||||
name="username",
|
||||
field=models.CharField(
|
||||
error_messages={"unique": "A user with that username already exists."},
|
||||
max_length=30,
|
||||
validators=[validators.UnicodeUsernameValidator()],
|
||||
help_text=(
|
||||
"Required. 30 characters or fewer. Letters, digits and @/./+/-/_ "
|
||||
"only."
|
||||
),
|
||||
unique=True,
|
||||
verbose_name="username",
|
||||
),
|
||||
),
|
||||
]
|
@@ -0,0 +1,18 @@
|
||||
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=True, verbose_name="last login", blank=True
|
||||
),
|
||||
),
|
||||
]
|
14
env/lib/python3.8/site-packages/django/contrib/auth/migrations/0006_require_contenttypes_0002.py
vendored
Normal file
14
env/lib/python3.8/site-packages/django/contrib/auth/migrations/0006_require_contenttypes_0002.py
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
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_migrate signals (which create ContentTypes).
|
||||
]
|
@@ -0,0 +1,27 @@
|
||||
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",
|
||||
field=models.CharField(
|
||||
error_messages={"unique": "A user with that username already exists."},
|
||||
help_text=(
|
||||
"Required. 30 characters or fewer. Letters, digits and @/./+/-/_ "
|
||||
"only."
|
||||
),
|
||||
max_length=30,
|
||||
unique=True,
|
||||
validators=[validators.UnicodeUsernameValidator()],
|
||||
verbose_name="username",
|
||||
),
|
||||
),
|
||||
]
|
@@ -0,0 +1,27 @@
|
||||
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="username",
|
||||
field=models.CharField(
|
||||
error_messages={"unique": "A user with that username already exists."},
|
||||
help_text=(
|
||||
"Required. 150 characters or fewer. Letters, digits and @/./+/-/_ "
|
||||
"only."
|
||||
),
|
||||
max_length=150,
|
||||
unique=True,
|
||||
validators=[validators.UnicodeUsernameValidator()],
|
||||
verbose_name="username",
|
||||
),
|
||||
),
|
||||
]
|
@@ -0,0 +1,18 @@
|
||||
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=True, max_length=150, verbose_name="last name"
|
||||
),
|
||||
),
|
||||
]
|
@@ -0,0 +1,16 @@
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("auth", "0009_alter_user_last_name_max_length"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name="group",
|
||||
name="name",
|
||||
field=models.CharField(max_length=150, unique=True, verbose_name="name"),
|
||||
),
|
||||
]
|
76
env/lib/python3.8/site-packages/django/contrib/auth/migrations/0011_update_proxy_permissions.py
vendored
Normal file
76
env/lib/python3.8/site-packages/django/contrib/auth/migrations/0011_update_proxy_permissions.py
vendored
Normal file
@@ -0,0 +1,76 @@
|
||||
import sys
|
||||
|
||||
from django.core.management.color import color_style
|
||||
from django.db import IntegrityError, migrations, transaction
|
||||
from django.db.models import Q
|
||||
|
||||
WARNING = """
|
||||
A problem arose migrating proxy model permissions for {old} to {new}.
|
||||
|
||||
Permission(s) for {new} already existed.
|
||||
Codenames Q: {query}
|
||||
|
||||
Ensure to audit ALL permissions for {old} and {new}.
|
||||
"""
|
||||
|
||||
|
||||
def update_proxy_model_permissions(apps, schema_editor, reverse=False):
|
||||
"""
|
||||
Update the content_type of proxy model permissions to use the ContentType
|
||||
of the proxy model.
|
||||
"""
|
||||
style = color_style()
|
||||
Permission = apps.get_model("auth", "Permission")
|
||||
ContentType = apps.get_model("contenttypes", "ContentType")
|
||||
alias = schema_editor.connection.alias
|
||||
for Model in apps.get_models():
|
||||
opts = Model._meta
|
||||
if not opts.proxy:
|
||||
continue
|
||||
proxy_default_permissions_codenames = [
|
||||
"%s_%s" % (action, opts.model_name) for action in opts.default_permissions
|
||||
]
|
||||
permissions_query = Q(codename__in=proxy_default_permissions_codenames)
|
||||
for codename, name in opts.permissions:
|
||||
permissions_query = permissions_query | Q(codename=codename, name=name)
|
||||
content_type_manager = ContentType.objects.db_manager(alias)
|
||||
concrete_content_type = content_type_manager.get_for_model(
|
||||
Model, for_concrete_model=True
|
||||
)
|
||||
proxy_content_type = content_type_manager.get_for_model(
|
||||
Model, for_concrete_model=False
|
||||
)
|
||||
old_content_type = proxy_content_type if reverse else concrete_content_type
|
||||
new_content_type = concrete_content_type if reverse else proxy_content_type
|
||||
try:
|
||||
with transaction.atomic(using=alias):
|
||||
Permission.objects.using(alias).filter(
|
||||
permissions_query,
|
||||
content_type=old_content_type,
|
||||
).update(content_type=new_content_type)
|
||||
except IntegrityError:
|
||||
old = "{}_{}".format(old_content_type.app_label, old_content_type.model)
|
||||
new = "{}_{}".format(new_content_type.app_label, new_content_type.model)
|
||||
sys.stdout.write(
|
||||
style.WARNING(WARNING.format(old=old, new=new, query=permissions_query))
|
||||
)
|
||||
|
||||
|
||||
def revert_proxy_model_permissions(apps, schema_editor):
|
||||
"""
|
||||
Update the content_type of proxy model permissions to use the ContentType
|
||||
of the concrete model.
|
||||
"""
|
||||
update_proxy_model_permissions(apps, schema_editor, reverse=True)
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
dependencies = [
|
||||
("auth", "0010_alter_group_name_max_length"),
|
||||
("contenttypes", "0002_remove_content_type_name"),
|
||||
]
|
||||
operations = [
|
||||
migrations.RunPython(
|
||||
update_proxy_model_permissions, revert_proxy_model_permissions
|
||||
),
|
||||
]
|
@@ -0,0 +1,18 @@
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("auth", "0011_update_proxy_permissions"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name="user",
|
||||
name="first_name",
|
||||
field=models.CharField(
|
||||
blank=True, max_length=150, verbose_name="first name"
|
||||
),
|
||||
),
|
||||
]
|
0
env/lib/python3.8/site-packages/django/contrib/auth/migrations/__init__.py
vendored
Normal file
0
env/lib/python3.8/site-packages/django/contrib/auth/migrations/__init__.py
vendored
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
env/lib/python3.8/site-packages/django/contrib/auth/migrations/__pycache__/__init__.cpython-38.pyc
vendored
Normal file
BIN
env/lib/python3.8/site-packages/django/contrib/auth/migrations/__pycache__/__init__.cpython-38.pyc
vendored
Normal file
Binary file not shown.
Reference in New Issue
Block a user