Skip to content

Commit

Permalink
[#664] Fix Group selector in dataset forms
Browse files Browse the repository at this point in the history
  • Loading branch information
tobes committed Mar 20, 2013
1 parent a2108e0 commit 7503325
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion ckan/logic/validators.py
Expand Up @@ -18,7 +18,7 @@ def owner_org_validator(key, data, errors, context):

value = data.get(key)

if value is missing or value is None:
if value is missing or not value:
if not ckan.new_authz.check_config_permission('create_unowned_dataset'):
raise Invalid(_('A organization must be supplied'))
data.pop(key, None)
Expand Down
4 changes: 2 additions & 2 deletions ckan/templates/package/snippets/package_basic_fields.html
Expand Up @@ -46,10 +46,10 @@
<label for="field-organizations" class="control-label">{{ _('Organization') }}</label>
<div class="controls">
<select id="field-organizations" name="owner_org" data-module="autocomplete">
<option value="">{{ _('Select an organization...') }}</option>
<option value="" {% if not selected_org and data.id %} selected="selected" {% endif %}>{{ _('Select an organization...') }}</option>
{% for organization in organizations_available %}
{# get out first org from users list only if there is not an existing org #}
{% set selected_org = (existing_org and existing_org == organization.id) or (not existing_org and organization.id == organizations_available[0].id) %}
{% set selected_org = (existing_org and existing_org == organization.id) or (not existing_org and not data.id and organization.id == organizations_available[0].id) %}
<option value="{{ organization.id }}" {% if selected_org %} selected="selected" {% endif %}>{{ organization.name }}</option>
{% endfor %}
</select>
Expand Down

0 comments on commit 7503325

Please sign in to comment.