-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Deprecate RootObject name #630
Conversation
4ea6fab
to
ae131ae
Compare
Something I thought of earlier: I'm not 100% sure my simplifiation of the |
56596f6
to
78f4d09
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you combine some of the commits? I don't see a reason why a migration should be in a separate commit than the code change itself.
Can you add a scope to the commit messages? (The thing in between the ()
after the type - releaseplease uses this in the release notes)
The commit message: fix: Property save method - Fix comparisons, comparison order, simplify.
does not tell me which problem it tries to solve, especially regarding the PR at hand. Same with refactor: Property help_text options
- is it a refactoring of code? And: is the changing of a help_text
really that important that we have to run migrations for that? (Maybe it is, the commit message should explain the reasoning)
I think the commit refactor: RootObject field options
should be part of the commit that renames the name
field to deprecated_name
.
Can reply in more detail later, just quickly for now:
This refactor took lots of changing around of things and reverting migrations and/or changes in several apps, and I find that keeping everything separate/committing changes incrementally, makes rebasing (shifting around, swapping out things) much, much easier/faster. (... Including while changes are still under review, because it'll help save time in case they need further updating. A lot less relevant after.) |
Which app should I best reference when a commit changes several? Always the "originating" one? Or is the "main" one fine as well in cases where a commit is particularly heavy on one app? E.g. for the breaking changes in the first commit, |
I don't have a definite answer, but in this case I'd opt for |
Hmm, maybe it would make sense to go by the migrations. (Posted at the same time as the above comment.) |
78f4d09
to
3f8d95e
Compare
Updated the PR as follows:
I can leave the last commit re: |
7885312
to
f2fec38
Compare
Refactored to integrate overlapping migrations + updated commit messages as discussed elsewhere. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is still a reference to .name
File apis_core/apis_relations/models.py", line 272, in get_web_object
"prop": self.prop.name,
^^^^^^^^^^^^^
AttributeError: 'Property' object has no attribute 'name'
Ideally, this would have been split up into multiple PRs - the change in |
When looking at things retroactively, maybe. This came up while I was working on this PR. I cannot forsee an "ideal" order of things when those things crop up later.
Or a later PR. Either way, it would have meant creating a separate PR that is inextricably linked to this PR (in whichever direction). Which I don't think is ideal in any case, but in my mind will delay things more than having one larger PR. ... See other issues I have worked on or meant to work on, which now linger.
Same as above, this PR reflects the chronology of the work that was done. I could mash everything together to get rid of that if it makes reviewing easier, but would then have to hand everything over for corrections because I couldn't justify the extra time I'd have to spend on trying to orient myself in the code. |
If things are inextricably linked, they belong in one commit. I still don't see how the move from
Well, as I've mentioned multiple times before, one large PR is much harder to review than individual smaller ones. I'll can't guarantee I'll have time next week to work on this again, but I'll try my best |
I can split it into two PRs, but likely also won't do this anymore this week. |
f2fec38
to
085f3ff
Compare
It looks like there were two more instances just above that line, When I changed them, the errors disappeared, but I'm still confused about this. My IDE didn't and doesn't seem to recognise the actual field names, but was happy with the (error-throwing) |
- rename RootObject field - allow field to be empty - adapt field verbose_name - add system check message - update __str__ methods, rewrite tests - update field references in: .. apis_relations models, forms, table, managment command (Property class) .. apis_entites .. utils BREAKING CHANGE: The renaming of RootObject's "name" field to "deprecated_name" affects all inheriting model classes as well as class Property. You will need to create new fields in your model classes to replace it/to preserve its contents before it gets dropped. You may also want to create custom __str__ methods for your classes for nicer, more human-friendly display names. Do NOT use "deprecated_name" to interact with Property going forward; "name_forward" is used exclusively in place of the old "name" field now. Change existing references to it to "name_forward" to prevent data corruption. Closes #299
- Set missing "name_reverse" field before running Unicode checks - Normalize both name fields (instead of checking + normalizing only one)
085f3ff
to
1cd79af
Compare
Obsolete due to #707 -> closing. |
This PR renames
RootObject
'sname
field todeprecated_name
, sets it to accept empty string values, and updates references to it throughout the codebase.Additionally, it swaps
Property
's duplicated main name fields around:name_forward
does not accept empty strings going forward and is what__str__()
gets based on; it's also used to setdeprecated_name
(instead of the other way around).Property
'ssave()
function can now also handleupdate_fields
, specifically updates to any of the 3 name fields.deprecated_name
has a system check message attached to it to make users aware their models need updating. It uses the built-insystem_check_deprecated_details
attribute, which can/should later get updated tosystem_check_removed_details
(see docs).PS: The changes resulting in migrations were split out on purpose because Django isn't great at handling field renames and field option changes simultaneously.