Skip to content
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

Hide inactive users from the blog post author dropdown #546

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

VirginiaDooley
Copy link
Contributor

@VirginiaDooley VirginiaDooley commented Jun 28, 2022

Closes #535

With this work, blog posts can only be assigned to active authors.
Screen Shot 2022-07-04 at 11 51 02 AM
Screen Shot 2022-07-04 at 11 51 25 AM
Screen Shot 2022-07-04 at 11 51 35 AM

@codecov
Copy link

codecov bot commented Jun 28, 2022

Codecov Report

Merging #546 (24d6fc9) into master (303a31b) will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##           master     #546   +/-   ##
=======================================
  Coverage   70.01%   70.01%           
=======================================
  Files          41       41           
  Lines         637      637           
=======================================
  Hits          446      446           
  Misses        191      191           
Impacted Files Coverage Δ
democracy_club/apps/hermes/models.py 94.21% <ø> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 303a31b...24d6fc9. Read the comment docs.

@VirginiaDooley VirginiaDooley changed the title WIP; Hide inactive users from the blog post author dropdown Hide inactive users from the blog post author dropdown Jul 4, 2022
@VirginiaDooley VirginiaDooley self-assigned this Jul 4, 2022
@VirginiaDooley
Copy link
Contributor Author

Restore old blog authors

@symroe
Copy link
Member

symroe commented Jul 4, 2022

TIL limit_choices_to! Nice!

Can you check one thing though: If we edit an old blog post with an inactive user, what happens?

So the steps would be:

  1. Create a user, publish a blog post by them
  2. Mark that user as inactive
  3. As a different user, edit the post and save
  4. Does the initial user get saved, or removed from the post?

@VirginiaDooley
Copy link
Contributor Author

VirginiaDooley commented Jul 4, 2022

TIL limit_choices_to! Nice!

Can you check one thing though: If we edit an old blog post with an inactive user, what happens?

So the steps would be:

  1. Create a user, publish a blog post by them
  2. Mark that user as inactive
  3. As a different user, edit the post and save

Since the original author has been marked inactive, I am prompted to choose an active author from the list to save the edited post.

  1. Does the initial user get saved, or removed from the post?

Yes, removed.

@symroe
Copy link
Member

symroe commented Jul 4, 2022

Hmm, in that case, I think we might need another approach here, as we want to keep old authors if we edit their posts (for whatever reason).

Can you take a look at the ModelAdmin form in admin.py and see if we can only limit the options for new posts rather than existing ones? That was the approach I was thinking of before I knew about limit_choices_to

@symroe symroe marked this pull request as draft July 8, 2022 08:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Hide inactive users from the blog post author dropdown
2 participants