Skip to content

Commit

Permalink
Explicit default_auto_field. (#326)
Browse files Browse the repository at this point in the history
This is configurable since Django 3.2, which is already the required
version for oscar-api.

see:
https://docs.djangoproject.com/en/3.2/topics/db/models/#automatic-primary-key-fields

Explicitly telling which field to use if good, it avoids a supious
migration like:

    $ ./manage.py makemigrations
    Migrations for 'oscarapi':
      /home/mdk/src/django-oscar/.venv/lib/python3.11/site-packages/oscarapi/migrations/0002_alter_apikey_id.py
        - Alter field id on apikey

notice the migration is created in the venv, in oscarapi tree, not in
the user project, it won't work anyway.
  • Loading branch information
JulienPalard authored Sep 19, 2024
1 parent 965c782 commit 045eafa
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions oscarapi/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@

class OscarAPIConfig(AppConfig):
name = "oscarapi"
default_auto_field = "django.db.models.AutoField"

0 comments on commit 045eafa

Please sign in to comment.