Skip to content

Fix poll preview and localize options#666

Merged
frcroth merged 8 commits intomainfrom
improve-polls
Oct 2, 2025
Merged

Fix poll preview and localize options#666
frcroth merged 8 commits intomainfrom
improve-polls

Conversation

@frcroth
Copy link
Copy Markdown
Contributor

@frcroth frcroth commented Jul 23, 2025

This PR:

  • fixes poll previews
  • Allows localization of options
    • These are now actually shown
  • Changes poll behavior so that all poll localizations use a canonical poll in the default locale for can_vote and cast_vote
  • Preview should see options and not be able to vote.
  • Poll properties are kept in sync

For testing:
Create a poll before applying migrations to test the migration.

Fixes #542
Fixes #527

@frcroth frcroth changed the title Fix exceptions in poll preview Fix poll preview and add translations Jul 23, 2025
@coveralls
Copy link
Copy Markdown

coveralls commented Jul 23, 2025

Pull Request Test Coverage Report for Build 18062140806

Details

  • 180 of 202 (89.11%) changed or added relevant lines in 8 files are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage increased (+1.2%) to 74.547%

Changes Missing Coverage Covered Lines Changed/Added Lines %
myhpi/polls/templatetags/polls.py 17 21 80.95%
myhpi/polls/migrations/0013_assign_translation_keys.py 12 18 66.67%
myhpi/polls/models.py 46 58 79.31%
Files with Coverage Reduction New Missed Lines %
myhpi/polls/models.py 1 87.83%
Totals Coverage Status
Change from base Build 16481471613: 1.2%
Covered Lines: 1728
Relevant Lines: 2318

💛 - Coveralls

@frcroth frcroth changed the title Fix poll preview and add translations Fix poll preview and localize options Aug 10, 2025
@frcroth frcroth requested a review from lukasrad02 August 10, 2025 19:37
@frcroth frcroth marked this pull request as ready for review August 10, 2025 19:37
@frcroth
Copy link
Copy Markdown
Contributor Author

frcroth commented Sep 27, 2025

Oh, I just noticed a regression in your PR: Ordering choices/options does not on both poll types work after applying your migrations.

I suspect this is related to clearing the model options in migration 0012, at least the docs specify that these options are used for ordering (among others) and migration 0011 sets "ordering": ["sort_order"]

Good catch!
If I understand it correctly, the Meta class of the model was now taken from TranslatableMixin and no longer from Orderable. So I added it explicitly with the two Metas merged.

@frcroth
Copy link
Copy Markdown
Contributor Author

frcroth commented Oct 2, 2025

Lgtm, thank you for addressing all the poll issues!

Awesome, thank you for your thorough testing and feedback!

@frcroth frcroth merged commit b9446da into main Oct 2, 2025
5 checks passed
@frcroth frcroth deleted the improve-polls branch October 2, 2025 14:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants