Merge "Make plugin version orderly in version list"
This commit is contained in:
commit
fa5a784852
|
@ -11,6 +11,7 @@
|
|||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
from collections import OrderedDict
|
||||
import json
|
||||
|
||||
from django.core.urlresolvers import reverse_lazy
|
||||
|
@ -37,8 +38,8 @@ def update_context_with_plugin_tags(request, context):
|
|||
|
||||
plugins_object = dict()
|
||||
for plugin in plugins:
|
||||
plugins_object[plugin.name] = dict()
|
||||
for version in plugin.versions:
|
||||
plugins_object[plugin.name] = OrderedDict()
|
||||
for version in sorted(plugin.versions, reverse=True):
|
||||
try:
|
||||
details = saharaclient. \
|
||||
plugin_get_version_details(request,
|
||||
|
|
|
@ -60,10 +60,12 @@ class ChoosePluginForm(forms.SelfHandlingForm):
|
|||
|
||||
for plugin in plugins:
|
||||
field_name = plugin.name + "_version"
|
||||
version_choices = (sorted([(version, version)
|
||||
for version in plugin.versions], reverse=True))
|
||||
choice_field = forms.ChoiceField(
|
||||
label=_("Version"),
|
||||
required=False,
|
||||
choices=[(version, version) for version in plugin.versions],
|
||||
choices=version_choices,
|
||||
widget=forms.Select(
|
||||
attrs={"class": "switched",
|
||||
"data-switch-on": "plugin",
|
||||
|
|
|
@ -261,11 +261,13 @@ class PluginAndVersionMixin(object):
|
|||
'data-slug': 'pluginname'}))
|
||||
|
||||
for plugin in plugins:
|
||||
version_choices = (sorted(
|
||||
[(version, version)
|
||||
for version in get_enabled_versions(plugin)], reverse=True))
|
||||
field_name = plugin.name + "_version"
|
||||
choice_field = forms.ChoiceField(
|
||||
label=_("Version"),
|
||||
choices=[(version, version)
|
||||
for version in get_enabled_versions(plugin)],
|
||||
choices=version_choices,
|
||||
widget=forms.Select(
|
||||
attrs={"class": "plugin_version_choice switched "
|
||||
+ field_name + "_choice",
|
||||
|
|
Loading…
Reference in New Issue