From 69f03eb6293365f7a729072d7ea7ac159c86e9f8 Mon Sep 17 00:00:00 2001 From: amandasavluchinske Date: Thu, 20 Jun 2024 17:55:20 +0100 Subject: [PATCH] Revert "Changes example/movies models to use UUIDs by default" This reverts commit eecec62c813671dc4e81b5e65de2a5fa0fae5666. --- example/example/fields.py | 14 ------------- example/example/settings.py | 2 -- example/movies/apps.py | 2 +- .../0004_alter_moviebacklogitem_id.py | 20 ------------------- 4 files changed, 1 insertion(+), 37 deletions(-) delete mode 100644 example/example/fields.py delete mode 100644 example/movies/migrations/0004_alter_moviebacklogitem_id.py diff --git a/example/example/fields.py b/example/example/fields.py deleted file mode 100644 index 8b80997..0000000 --- a/example/example/fields.py +++ /dev/null @@ -1,14 +0,0 @@ -import uuid - -from django.db.backends.base.operations import BaseDatabaseOperations -from django.db.models import AutoField, UUIDField - - -BaseDatabaseOperations.integer_field_ranges["UUIDField"] = (0, 0) - - -class UUIDAutoField(UUIDField, AutoField): - def __init__(self, *args, **kwargs): - kwargs.setdefault("default", uuid.uuid4) - kwargs.setdefault("editable", False) - super().__init__(*args, **kwargs) diff --git a/example/example/settings.py b/example/example/settings.py index e19d61f..5116f69 100644 --- a/example/example/settings.py +++ b/example/example/settings.py @@ -171,5 +171,3 @@ WEATHER_API_KEY = os.getenv("WEATHER_API_KEY") # get for free at https://www.weatherapi.com/ DJANGO_DOCS_BRANCH = "stable/5.0.x" - -DEFAULT_AUTO_FIELD = "example.fields.UUIDAutoField" diff --git a/example/movies/apps.py b/example/movies/apps.py index 13aaebe..cced8a6 100644 --- a/example/movies/apps.py +++ b/example/movies/apps.py @@ -2,5 +2,5 @@ class MoviesConfig(AppConfig): - default_auto_field = "example.fields.UUIDAutoField" + default_auto_field = "django.db.models.BigAutoField" name = "movies" diff --git a/example/movies/migrations/0004_alter_moviebacklogitem_id.py b/example/movies/migrations/0004_alter_moviebacklogitem_id.py deleted file mode 100644 index 7d2f4de..0000000 --- a/example/movies/migrations/0004_alter_moviebacklogitem_id.py +++ /dev/null @@ -1,20 +0,0 @@ -# Generated by Django 5.0.6 on 2024-06-20 16:37 - -import example.fields -import uuid -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('movies', '0003_moviebacklogitem_imdb_rating'), - ] - - operations = [ - migrations.AlterField( - model_name='moviebacklogitem', - name='id', - field=example.fields.UUIDAutoField(auto_created=True, default=uuid.uuid4, editable=False, primary_key=True, serialize=False, verbose_name='ID'), - ), - ]