-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Dropdown to select Advanced Settings #4710
Merged
Merged
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
074b2b2
added auto suggest in version
aasis21 950441d
auto fill for branches
aasis21 e39a444
changes in syntax
aasis21 c1dad80
switched to choicefield and multiple files in option
aasis21 eef7312
futher syntax changes
aasis21 9113e37
Updates based on feedback
aasis21 397f618
Put back removed code
stsewd 410c571
Merge branch 'master' into dropdown-menu
stsewd 6f0ba44
Simplified logic
stsewd 1ec4785
Linter :+1:
stsewd eea6a62
Validate revert case
stsewd ae539f5
Tests for AdvancedForm
stsewd 03d0193
Filter by privacy level
stsewd 6f251cd
Remove privacy checks
stsewd 96a2110
Tests for VersionForm
stsewd a0b3501
Rename variables
stsewd 7228ebd
Fix translation
stsewd b8b1a29
Merge branch 'master' into dropdown-menu
stsewd cd58846
Fix format
stsewd File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
from __future__ import division, print_function, unicode_literals | ||
|
||
from django.test import TestCase | ||
from django_dynamic_fixture import get | ||
|
||
from readthedocs.builds.forms import VersionForm | ||
from readthedocs.builds.models import Version | ||
from readthedocs.projects.constants import PRIVATE | ||
from readthedocs.projects.models import Project | ||
|
||
|
||
class TestVersionForm(TestCase): | ||
|
||
def setUp(self): | ||
self.project = get(Project) | ||
|
||
def test_default_version_is_active(self): | ||
version = get( | ||
Version, | ||
project=self.project, | ||
active=False, | ||
) | ||
self.project.default_version = version.slug | ||
self.project.save() | ||
|
||
form = VersionForm( | ||
{ | ||
'active': True, | ||
'privacy_level': PRIVATE, | ||
}, | ||
instance=version | ||
) | ||
self.assertTrue(form.is_valid()) | ||
|
||
def test_default_version_is_inactive(self): | ||
version = get( | ||
Version, | ||
project=self.project, | ||
active=True, | ||
) | ||
self.project.default_version = version.slug | ||
self.project.save() | ||
|
||
form = VersionForm( | ||
{ | ||
'active': False, | ||
'privacy_level': PRIVATE, | ||
}, | ||
instance=version | ||
) | ||
self.assertFalse(form.is_valid()) | ||
self.assertIn('active', form.errors) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I Pythonic way to do this would be to use something like
empty_value
: https://docs.djangoproject.com/en/2.1/ref/forms/fields/#django.forms.TypedChoiceField.empty_valueI'm not 100% sure that this is possible here, but I think it should be.
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.
We are just replacing the widget (
Select
), so it's not possible https://docs.djangoproject.com/en/2.1/ref/forms/widgets/#django.forms.Select