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
Merge data from "created_by" to "authors" field #3259
Conversation
684fe19
to
1dbe286
Compare
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## master #3259 +/- ##
==========================================
- Coverage 88.33% 88.32% -0.01%
==========================================
Files 660 661 +1
Lines 20857 20868 +11
==========================================
+ Hits 18423 18431 +8
- Misses 2434 2437 +3
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report in Codecov by Sentry. |
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.
Nice 👌
Fix up the comments (and preferably also change the commit message to something that makes more sense) and we're good to go 💯
1dbe286
to
67aa136
Compare
def merge_authors(apps, schema_editor): | ||
Article = apps.get_model("articles", "Article") | ||
for e in Article.objects.all(): | ||
if e.created_by != None and e.authors == None: |
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.
Should't this be e.authors != None
, or can you do .add()
anyways?
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.
It seemed to run fine for me. From testing in shell, the field is None if there's no entries and adding still works.
Migrate data from the old created_by field to the new authors field holding multiple authors instead of one.