Skip to content

Commit

Permalink
tests + migration file updated
Browse files Browse the repository at this point in the history
  • Loading branch information
mathiasag7 committed Mar 29, 2024
1 parent b011b1b commit 7fb9e7c
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 62 deletions.
27 changes: 26 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand All @@ -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`.
Expand All @@ -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

Expand Down
27 changes: 10 additions & 17 deletions eav/migrations/0010_dynamic_pk_type_for_models.py
Original file line number Diff line number Diff line change
@@ -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'),
Expand All @@ -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
),
),
]

This file was deleted.

6 changes: 2 additions & 4 deletions test_project/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,11 @@
# 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
Expand Down

0 comments on commit 7fb9e7c

Please sign in to comment.