Skip to content

Commit

Permalink
[#2651] Fix for delete resource on draft dataset should redirect to n…
Browse files Browse the repository at this point in the history
…ew_resource page
  • Loading branch information
Artem Bazykin committed Feb 21, 2017
1 parent e0cf535 commit 1c2a057
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion ckan/controllers/package.py
Expand Up @@ -1041,7 +1041,12 @@ def resource_delete(self, id, resource_id):
if request.method == 'POST':
get_action('resource_delete')(context, {'id': resource_id})
h.flash_notice(_('Resource has been deleted.'))
h.redirect_to(controller='package', action='read', id=id)
pkg_dict = get_action('package_show')(context, {'id': id})
if pkg_dict['state'].startswith('draft'):
h.redirect_to(controller='package', action='new_resource',
id=id)
else:
h.redirect_to(controller='package', action='read', id=id)
c.resource_dict = get_action('resource_show')(
context, {'id': resource_id})
c.pkg_id = id
Expand Down

0 comments on commit 1c2a057

Please sign in to comment.