-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Prepare test cases for RootModel issue
- Loading branch information
Showing
6 changed files
with
98 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
from django.contrib import admin | ||
|
||
from . import models | ||
|
||
|
||
@admin.register(models.SampleModel) | ||
class SampleModelAdmin(admin.ModelAdmin): | ||
pass | ||
|
||
|
||
@admin.register(models.SampleForwardRefModel) | ||
class SampleForwardRefModelAdmin(admin.ModelAdmin): | ||
pass | ||
|
||
|
||
@admin.register(models.ExampleModel) | ||
class ExampleModelAdmin(admin.ModelAdmin): | ||
pass |
46 changes: 46 additions & 0 deletions
46
tests/test_app/migrations/0003_samplemodel_sample_null_root_schema_and_more.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# Generated by Django 5.0.1 on 2024-03-08 14:35 | ||
|
||
import django.core.serializers.json | ||
import django_pydantic_field.compat.django | ||
import django_pydantic_field.fields | ||
import tests.test_app.models | ||
import types | ||
import typing | ||
from django.db import migrations | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("test_app", "0002_examplemodel"), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name="samplemodel", | ||
name="sample_null_root_schema", | ||
field=django_pydantic_field.fields.PydanticSchemaField( | ||
config=None, | ||
default=None, | ||
encoder=django.core.serializers.json.DjangoJSONEncoder, | ||
null=True, | ||
schema=django_pydantic_field.compat.django.GenericContainer( | ||
typing.Union, | ||
( | ||
tests.test_app.models.RootSchema, | ||
types.NoneType, | ||
), | ||
), | ||
), | ||
), | ||
migrations.AddField( | ||
model_name="samplemodel", | ||
name="sample_root_schema", | ||
field=django_pydantic_field.fields.PydanticSchemaField( | ||
config=None, | ||
default=[], | ||
encoder=django.core.serializers.json.DjangoJSONEncoder, | ||
schema=tests.test_app.models.RootSchema, | ||
), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import pytest | ||
|
||
|
||
def test_model_admin_not_failing(): | ||
try: | ||
from .test_app import admin | ||
except: | ||
pytest.fail("Django admin handlers should not fail") |