title: Detecting parent and child page types with Python using Wagtail CMS
body: <p>I am setting up a Wagtail website.</p>
  
  <p>There will be an Event Index page with Events as child pages.</p>
  
  <p>Each event page could also have child pages, if it is part of a event series.</p>
  
  <p>The main event will show the child events as a series of links on the page. The child events also need to display the parent event and also its own siblings.</p>
  
  <p>In models.py I have an Event class. So far I am detecting children, siblings, parents like this:</p>
  
  <pre><code>@property
  def childpages(self):
      event_children = Event.objects.live().descendant_of(self)
      return event_children
  
  @property
  def parentpage(self):
      event_parent = self.get_parent()
      return event_parent
  
  @property
  def siblingpages(self):
      event_siblings = Event.objects.live().sibling_of(self, inclusive=False)
      return event_siblings
  </code></pre>
  
  <p>Is there a way of finding out what the parent page type is? If it is the event index I wouldn't want to display it on the event page. I also wouldn't want the main event pages to show siblings.</p>
  
  <p>I've tried various things with not_child_of(somepage) but not quite sure how to use this. What does 'somepage' reference? A class, a variable? I'm used to Javascript and pretty new to Python.</p>