Mercurial > kallithea
changeset 3862:2b2f5e6c45b0
fix required repo_type param on repo edit form
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Fri, 17 May 2013 20:58:31 +0200 |
parents | d11ecf2f6327 |
children | 51596d9ef2f8 |
files | rhodecode/controllers/admin/repos.py rhodecode/model/forms.py |
diffstat | 2 files changed, 9 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/rhodecode/controllers/admin/repos.py Sun May 12 23:41:40 2013 +0200 +++ b/rhodecode/controllers/admin/repos.py Fri May 17 20:58:31 2013 +0200 @@ -254,11 +254,15 @@ choices, c.landing_revs = ScmModel().get_repo_landing_revs(repo_name) c.landing_revs_choices = choices repo = Repository.get_by_repo_name(repo_name) - _form = RepoForm(edit=True, old_data={'repo_name': repo_name, - 'repo_group': repo.group.get_dict() \ - if repo.group else {}}, + old_data = { + 'repo_name': repo_name, + 'repo_group': repo.group.get_dict() if repo.group else {}, + 'repo_type': repo.repo_type, + } + _form = RepoForm(edit=True, old_data=old_data, repo_groups=c.repo_groups_choices, landing_revs=c.landing_revs_choices)() + try: form_result = _form.to_python(dict(request.POST)) repo = repo_model.update(repo_name, **form_result)
--- a/rhodecode/model/forms.py Sun May 12 23:41:40 2013 +0200 +++ b/rhodecode/model/forms.py Fri May 17 20:58:31 2013 +0200 @@ -184,7 +184,8 @@ v.SlugifyName()) repo_group = All(v.CanWriteGroup(old_data), v.OneOf(repo_groups, hideList=True)) - repo_type = v.OneOf(supported_backends) + repo_type = v.OneOf(supported_backends, required=False, + if_missing=old_data.get('repo_type')) repo_description = v.UnicodeString(strip=True, min=1, not_empty=False) repo_private = v.StringBoolean(if_missing=False) repo_landing_rev = v.OneOf(landing_revs, hideList=True)