Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backwards compatible way of importing reverse #35

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion publisher/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@
from django.contrib import messages
from django.conf.urls import url
from django.core.exceptions import PermissionDenied
from django.core.urlresolvers import reverse
try:
from django.urls import reverse
except ImportError:
# django < 1.10
from django.core.urlresolvers import reverse
from django.http import Http404, HttpResponseRedirect, HttpResponse
from django.utils.encoding import force_text
from django.utils.html import escape
Expand Down
6 changes: 3 additions & 3 deletions publisher/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def is_dirty(self):
return False

@assert_draft
def publish(self):
def publish(self, **kwargs):
if not self.is_draft:
return

Expand Down Expand Up @@ -116,7 +116,7 @@ def publish(self):

# Link the published obj to the draft version
# publish_obj.publisher_linked = draft_obj
publish_obj.save()
publish_obj.save(**kwargs)

# Check for translations, if so duplicate the object
self.clone_translations(draft_obj, publish_obj)
Expand All @@ -132,7 +132,7 @@ def publish(self):

publisher_publish_pre_save_draft.send(sender=draft_obj.__class__, instance=draft_obj)

draft_obj.save(suppress_modified=True)
draft_obj.save(suppress_modified=True, **kwargs)

publisher_post_publish.send(sender=draft_obj.__class__, instance=draft_obj)

Expand Down