ERPNext Foundation ERPNext Cloud Chat Blog Discuss Frappé* Donate

Frappe. Stuck with WebsiteGenerator


#1

Hi, I am trying to follow this tutorial https://frappe.io/docs/user/en/guides/portal-development/generators
This is not very informative.

What I am trying to achieve:

  • I want to change Web View of DocType using Website Generator.

What I am doing:

  • I created doctype named Item.

  • I created class that inherits from WebsiteGenerator

    class Item(website_generator.WebsiteGenerator):
      website = frappe._dict(
          template = "templates/item.html",
      	condition_field = "publish",
      )
    
      def get_context(self, context):
      	context.some_context = 'some_context'
    
  • Added my DocType into list website_generators in hooks.py

  • Created html-file ‘item.html’ in templates
    Screenshot%20from%202018-12-28%2015-01-01

What i am getting:

  • Nothing. Web View of this doctype does not change.
  • I accidentally found out how to change web view of DocTypes list, this is very good.

Do i need to specify value for a field “route” for a doctype?


#2

Hi welcome to ERPNext,

Have you checked the video and posts like these for clues Route always showing me http://localhost:8000/undefined

Yes this product and docs are a work in progress, together this community and forum can help improve that.

A code search like this may help you with clues

frappe@ubuntu:~/frappe-bench$ find . -name '*.py' | xargs grep WebsiteGenerator