-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Created All preferences Page #2739
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
base: develop
Are you sure you want to change the base?
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,6 @@ | ||
| from decimal import Decimal | ||
|
|
||
| from django import forms | ||
| from django.core.validators import EmailValidator, MinValueValidator, validate_slug | ||
| from django.forms import SelectMultiple | ||
| from django.utils.translation import gettext_lazy as _ | ||
|
|
@@ -17,6 +18,25 @@ | |
| from .types import MultiValueChoicePreference | ||
| from .utils import validate_metric_duplicates | ||
|
|
||
|
|
||
| # ============================================================================== | ||
| all_sections = Section('all_sections', verbose_name=_("All Preferances")) | ||
| # ============================================================================== | ||
|
|
||
|
|
||
| @tournament_preferences_registry.register | ||
| class DummyAllSectionsPreference(StringPreference): | ||
| section = all_sections | ||
| name = 'dummy_all_sections' | ||
| default = '' | ||
| verbose_name = 'All Sections Placeholder' | ||
|
|
||
| def get_field_kwargs(self): | ||
| kwargs = super().get_field_kwargs() | ||
| kwargs['widget'] = forms.HiddenInput | ||
| return kwargs | ||
|
Comment on lines
+27
to
+37
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why do we need a dummy preference?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Its been a while since I did it sorry, but Its because of how the preferences are handled and how they have been put into sections. The default when there is no argument passed doesn't work with this set up, So we needed a new section to pass, that could then have the other sections added to, however it needs an initial preference to be returned or it throws an error |
||
|
|
||
|
|
||
| # ============================================================================== | ||
| scoring = Section('scoring', verbose_name=_("Score Rules")) | ||
| # ============================================================================== | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.