After Enable Web View - object has no attribute 'get_page_info'

I enabled Web View for Doctype Airplane Flight, added Is Published and Router field but below error is showing after clicking on any Airplane Flight from list.

Traceback (most recent call last):
  File "apps/frappe/frappe/website/serve.py", line 20, in get_response
    response = renderer_instance.render()
  File "apps/frappe/frappe/website/page_renderers/document_page.py", line 41, in render
    html = self.get_html()
  File "apps/frappe/frappe/website/utils.py", line 523, in cache_html_decorator
    html = func(*args, **kwargs)
  File "apps/frappe/frappe/website/page_renderers/document_page.py", line 50, in get_html
    self.update_context()
  File "apps/frappe/frappe/website/page_renderers/document_page.py", line 57, in update_context
    self.context.update(self.context.doc.get_page_info())
AttributeError: 'AirplaneFlight' object has no attribute 'get_page_info'

Suggestions and any hint is highly appreciated.

Hi,

The famous Hussain courses :wink:

From what class herit your Airplane Flight class ? Document I guess ?
May be you should check in ERPNext or Frappe core code some website page to find existing example.

My hint, the solution is to change class heritage of your Airplane Flight Doctype

1 Like

Yes. Its #bwh course example.
I will check for existing pages example.

Hi @umarless , did you find a solution to this? I have the exact issue

Hi,

Make a global search in Frappe framework to find

def get_page_info

You’ll find a class where this method is implemented.

You just have to make the import statement and put it as constructor heritage on your class AirplaneFlight

That’s the method I used to solved this riddle when I made this training.
My guess is, Hussain let this undocumented to let trainers prove or improve their skills in digging into Frappe Framework mechanics

Really really nice training by the way, I’ve spent a real good time by implementing this app. It demonstrate how power full (battery included, as it was said) Frappe framework is.

2 Likes

Change the class Document to WebsiteGenerator

doctype_name.py file Before enable Web View

from frappe.model.document import Document

class DoctypeName(Document):
	pass

doctype_name.py file After enable Web View

from frappe.website.website_generator import WebsiteGenerator

class DoctypeName(WebsiteGenerator):
	pass