djangocms-blog icon indicating copy to clipboard operation
djangocms-blog copied to clipboard

'Post' object has no attribute 'get_draft_url'

Open Tritikale opened this issue 2 years ago • 4 comments

Description

When I try to see published blog article I'm getting AttributeError "'Post' object has no attribute 'get_draft_url'".

With edit page everything is fine.

The problem is in cms toolbar live.html href="{% firstof cms_toolbar.get_object_draft_url cms_toolbar.request_path %}?{{ cms_toolbar.edit_mode_url_on }}"> which calls get_object_draft_url:

    def get_object_draft_url(self):
        if self.obj:
            with force_language(self.request_language):
                try:
                    return self.obj.get_draft_url()
                except NoReverseMatch:
                    try:
                        return self.obj.get_absolute_url()
                    except NoReverseMatch:
                        pass
        return ''

And obj (Post) has no get_draft_url

Versions

python 3.8.10 django-cms 3.10.0 djangocms-blog 1.2.3

Expected behaviour

Opening blog published article normally)))

Actual behaviour

AttributeError 'Post' object has no attribute 'get_draft_url'

Tritikale avatar Apr 11 '22 09:04 Tritikale

@Tritikale This actually is a bug in django-cms 3.10.0. I'd suggest to downgrade to 3.9 or install 3.10.1 once it is released.

fsbraun avatar Apr 11 '22 19:04 fsbraun

Hello, @fsbraun could you put the link to the issue on the django-cms github ? Thanks

palmitoto avatar Apr 26 '22 15:04 palmitoto

It's this issue with django-cms: https://github.com/django-cms/django-cms/issues/7288

fsbraun avatar Apr 26 '22 15:04 fsbraun

This bug is fixed in django-cms==3.10.1rc1: https://pypi.org/project/django-cms/3.10.1rc1/

fsbraun avatar Jun 02 '22 11:06 fsbraun

Closing this, as it is fixed.

protoroto avatar Aug 31 '23 13:08 protoroto