diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ba24fa0..7094e13 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -3,6 +3,7 @@ This is a [Jazzband](https://jazzband.co/) project. By contributing you agree to abide by the [Contributor Code of Conduct](https://jazzband.co/about/conduct) and follow the [guidelines](https://jazzband.co/about/guidelines). # Contributing + We love your input! We want to make contributing to this project as easy and transparent as possible, whether it's: - Reporting a bug @@ -23,6 +24,19 @@ poetry install To activate your `virtualenv` run `poetry shell`. +## Configuration + +Set EAV2_PRIMARY_KEY_FIELD value to `django.db.models.UUIDField` or `django.db.models.BigAutoField` in your settings. + +```python +EAV2_PRIMARY_KEY_FIELD = "django.db.models.UUIDField" # as example +``` + +and run +```bash +python manage.py makemigrations +python manage.py migrate +``` ## Tests @@ -34,10 +48,20 @@ To run all tests: pytest ``` +## Cleanup + +At the end of the test, ensure that you delete the migration file created by the EAV2_PRIMARY_KEY_FIELD change. Additionally, verify that the migration files are clean and reset the value to django.db.models.CharField in your settings. + +```python +EAV2_PRIMARY_KEY_FIELD = "django.db.models.CharField" +``` + ## We develop with Github + We use github to host code, to track issues and feature requests, as well as accept pull requests. ### We use [Github Flow](https://guides.github.com/introduction/flow/index.html), so all code changes from community happen through pull requests + Pull requests are the best way to propose changes to the codebase (we use [Github Flow](https://guides.github.com/introduction/flow/index.html)). We actively welcome your pull requests: 1. Fork the repo and create your branch from `master`. @@ -48,11 +72,12 @@ Pull requests are the best way to propose changes to the codebase (we use [Githu 6. Describe the pull request using [this](https://github.com/jazzband/django-eav2/blob/master/PULL_REQUEST_TEMPLATE.md) template. ### Any contributions you make will be under the GNU Lesser General Public License v3.0 + In short, when you submit code changes, your submissions are understood to be under the same [LGPLv3](https://choosealicense.com/licenses/lgpl-3.0/) that covers the project. Feel free to contact the maintainers if that's a concern. ### Report bugs using Github's [issues](https://github.com/jazzband/django-eav2/issues) -We use GitHub issues to track public bugs. Report a bug by opening a new issue. Use [this](https://github.com/jazzband/django-eav2/blob/master/.github/ISSUE_TEMPLATE/bug_report.md) template to describe your reports. +We use GitHub issues to track public bugs. Report a bug by opening a new issue. Use [this](https://github.com/jazzband/django-eav2/blob/master/.github/ISSUE_TEMPLATE/bug_report.md) template to describe your reports. ### Use a consistent coding style diff --git a/eav/migrations/0010_dynamic_pk_type_for_models.py b/eav/migrations/0010_dynamic_pk_type_for_models.py index 28028ac..c5054b6 100644 --- a/eav/migrations/0010_dynamic_pk_type_for_models.py +++ b/eav/migrations/0010_dynamic_pk_type_for_models.py @@ -1,8 +1,9 @@ +# Generated by Django 4.2.11 on 2024-03-26 09:01 + from django.db import migrations, models class Migration(migrations.Migration): - """Migration to use BigAutoField as default for all models.""" dependencies = [ ('eav', '0009_enchance_naming'), @@ -12,37 +13,29 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='attribute', name='id', - field=models.BigAutoField( - editable=False, - primary_key=True, - serialize=False, + field=models.CharField( + editable=False, max_length=40, primary_key=True, serialize=False ), ), migrations.AlterField( model_name='enumgroup', name='id', - field=models.BigAutoField( - editable=False, - primary_key=True, - serialize=False, + field=models.CharField( + editable=False, max_length=40, primary_key=True, serialize=False ), ), migrations.AlterField( model_name='enumvalue', name='id', - field=models.BigAutoField( - editable=False, - primary_key=True, - serialize=False, + field=models.CharField( + editable=False, max_length=40, primary_key=True, serialize=False ), ), migrations.AlterField( model_name='value', name='id', - field=models.BigAutoField( - editable=False, - primary_key=True, - serialize=False, + field=models.CharField( + editable=False, max_length=40, primary_key=True, serialize=False ), ), ] diff --git a/eav/migrations/0011_alter_attribute_id_alter_enumgroup_id_and_more.py b/eav/migrations/0011_alter_attribute_id_alter_enumgroup_id_and_more.py deleted file mode 100644 index 9380a1b..0000000 --- a/eav/migrations/0011_alter_attribute_id_alter_enumgroup_id_and_more.py +++ /dev/null @@ -1,40 +0,0 @@ -from django.db import migrations, models - - -class Migration(migrations.Migration): - """Migration to set CharField as default primary key for all models.""" - - dependencies = [ - ('eav', '0010_dynamic_pk_type_for_models'), - ] - - operations = [ - migrations.AlterField( - model_name='attribute', - name='id', - field=models.CharField( - editable=False, max_length=255, primary_key=True, serialize=False - ), - ), - migrations.AlterField( - model_name='enumgroup', - name='id', - field=models.CharField( - editable=False, max_length=255, primary_key=True, serialize=False - ), - ), - migrations.AlterField( - model_name='enumvalue', - name='id', - field=models.CharField( - editable=False, max_length=255, primary_key=True, serialize=False - ), - ), - migrations.AlterField( - model_name='value', - name='id', - field=models.CharField( - editable=False, max_length=255, primary_key=True, serialize=False - ), - ), - ] diff --git a/test_project/settings.py b/test_project/settings.py index d92e1c8..7cfab18 100644 --- a/test_project/settings.py +++ b/test_project/settings.py @@ -63,13 +63,11 @@ TEMPLATES = [ # Database # https://docs.djangoproject.com/en/3.1/ref/settings/#databases -DATABASES = { - 'default': {'ENGINE': 'django.db.backends.sqlite3', 'NAME': ':memory:'}, -} +DATABASES = {'default': {'ENGINE': 'django.db.backends.sqlite3', 'NAME': ':memory:'}} DEFAULT_AUTO_FIELD = 'django.db.models.AutoField' -EAV2_PRIMARY_KEY_FIELD = 'django.db.models.BigAutoField' +EAV2_PRIMARY_KEY_FIELD = 'django.db.models.CharField' # Password validation