-
Notifications
You must be signed in to change notification settings - Fork 38
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
Getting "Entry object has no attribute get_ancestors" if Entry is empty #59
Comments
Oh yes, that's very annoying. The right thing to do would be add a subclass of If it weren't for backwards compatibility that should be the default though, and the |
I also managed to pinpoint what exactly causes the problem. I realized that I get the error only if any of the Entry regions has
In that case, either of the regions will raise an error as soon as you try to render it. Of course, you can create 'template guards' like this:
But there's not much point in that, you can simply omit 'inherited' from By the way, what is the supposed behavior for Entries with |
I never thought about entries inheriting content from pages or anything similar – we only ever used inheriting regions with page trees. It never occurred to me that inheritance might also be used in the context of blog entries, but why not? |
For me the solution was quite simple (for custom Entry models - extensions to the ElephantBlog models): from feincms.models import Base
from feincms.module.mixins import ContentModelMixin
from feincms.module.page.models import Page
class EventEntry(Base, ContentModelMixin):
# ... other things
def get_ancestors(self, *args, **kwargs):
return Page.objects.none() |
I found quite a silly bug related to interopability of feincms and elephantblog.
If you create an empty elephantblog entry (by "empty" I mean with no content types added to it), then the following error will appear:
'Entry' object has no attribute 'get_ancestors'
(Line in question)
Although it's not something critical, since website administrators are unlikely to create a post with no content blocks, still, if somebody does that by accident, it's a little annoying.
I wonder how to fix this issue? Wrap
get_ancestors
in try/except, and catch the potential error? Or do something on elephant_blog side?The text was updated successfully, but these errors were encountered: