Skip to content

Commit

Permalink
Merge branch '664-group-form-issues'
Browse files Browse the repository at this point in the history
  • Loading branch information
amercader committed Mar 26, 2013
2 parents 8c8680d + 7503325 commit 1461292
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 1461292

Please sign in to comment.