nephila / djangocms-blog

django CMS blog application - Support for multilingual posts, placeholders, social network meta tags and configurable apphooks
https://djangocms-blog.readthedocs.io
BSD 3-Clause "New" or "Revised" License
403 stars 190 forks source link

'Post' object has no attribute 'get_draft_url' #702

Closed Tritikale closed 1 year ago

Tritikale commented 2 years ago

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'

fsbraun commented 2 years ago

@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.

palmitoto commented 2 years ago

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

fsbraun commented 2 years ago

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

fsbraun commented 2 years ago

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

protoroto commented 1 year ago

Closing this, as it is fixed.