Closed
Description
Describe the bug
- Setting
user_related_name="mymodels"
doesn't changerelated_name="+"
torelated_name="mymodels"
since v2.6.0. - Setting
user_related_name="mymodels"
shouldn't alter other values in migrations
To Reproduce
- Install v2.5.1
- Add a history to a model, e.g. with
register
:
register(
EmailAddress,
app=__package__,
excluded_fields=('primary',),
user_related_name='historicalemailaddresses',
)
- Run
makemigrations
- Install v2.6.0
- Run
makemigrations
- Remove
user_related_name
- Run
makemigrations
Expected behavior
- No. 5 shouldn't create another migration with
related_name="+"
- No. 7 should change
related_name="+"
only (but it doesn't because it has this value in the previous migration already). But the change looks like this on my system:
After applying No. 5:
migrations.AlterField(
model_name="historicalemailaddress",
name="user",
field=models.ForeignKey(
blank=True,
db_constraint=False,
null=True,
on_delete=django.db.models.deletion.DO_NOTHING,
related_name="+",
to=settings.AUTH_USER_MODEL,
verbose_name="user",
),
)
Why were blank
, db_constraint
and verbose_name
(and other values like help_text
in other cases) added here?
After applying No. 7:
migrations.AlterField(
model_name="historicalemailaddress",
name="history_user",
field=models.ForeignKey(
null=True,
on_delete=django.db.models.deletion.SET_NULL,
related_name="+",
to=settings.AUTH_USER_MODEL,
),
)
The migration in < v2.6.0 looked like (I comment strange changes):
migrations.AlterField(
model_name="historicalemailaddress",
name="history_user", # Why this changed to "user"?
field=models.ForeignKey(
null=True,
on_delete=django.db.models.deletion.SET_NULL, # Why this changed to "DO_NOTHING"?
related_name="historicalemailaddresses",
to=settings.AUTH_USER_MODEL,
),
)
Environment:
- OS: macOS 10.13.6
- Django Simple History Version: 2.6.0, 2.7.0
- Django Version: 2.0.10
- Database Version: PostgreSQL 9.6
I also want to say "thank you" for all the improvements and fixes you implemented in the last months for simple history and for keeping this package alive!
Metadata
Metadata
Assignees
Labels
No labels