Skip to content

Commit

Permalink
Add edit content link to article change form
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanw committed Apr 25, 2024
1 parent 50cbf37 commit de9034d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
3 changes: 2 additions & 1 deletion fragdenstaat_de/fds_blog/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

from cms.models.fields import PlaceholderRelationField
from cms.models.pluginmodel import CMSPlugin
from cms.toolbar.utils import get_object_edit_url
from cms.utils.placeholder import get_placeholder_from_slot
from cms.utils.plugins import get_plugins
from filer.fields.image import FilerImageField
Expand Down Expand Up @@ -414,7 +415,7 @@ def get_absolute_url(self, language=None, nopage=False):
return url

def get_absolute_edit_url(self):
return self.get_absolute_url(nopage=True)
return get_object_edit_url(self)

def get_full_url(self):
return "%s%s" % (settings.SITE_URL, self.get_absolute_url())
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
{% extends "admin/change_form.html" %}
{% load static %}
{% load i18n %}
{% block object-tools-items %}
{% if original.pk %}
<li>
<a href="{{ original.get_absolute_edit_url }}">{% trans "Edit Content" %}</a>
</li>
{% endif %}
{{ block.super }}
{% endblock %}
{% block after_field_sets %}
{{ block.super }}
{{ adminform.model_admin.charcount_fields|json_script:"charcount-fields" }}
Expand Down

0 comments on commit de9034d

Please sign in to comment.