How to make a page for online testing system

Hello Everyone.
As a new frappe developer I am struggling since last month but unluckily could not found any useful resource that could solve my problem. Although ERPNext is feature rich and very useful ERP system but there is a lot more to do in it’s documentation and tutorials because it is very hard for a python developer to learn and develop an app in frappe due to lack of help and support available on internet.
I am trying to develop an online testing system for which I have to fully customize the website or web portal but could not found any help to achieve my task.
A simple scenario is if I have a paper which contain number of questions and I want to display the data from paper and questions that are included in it on a page for example in doctype/paper/templates/paper.html file using jinga template but I could access the question doctype data in paper template file further more I want to submit my own form from any of website page how could I receive and manipulate that data in server side. Before switching to any other ERP I would request if anyone could help me.

Thanks

1 Like

Hi, in order to show data of any DocType in a web page you should create a .py file with the same name of .html file under the /templates/pages/ folder.

For example:
paper.html
paper.py

In paper.py you can put all the logic needed to display the info in the page, for example:

def get_context(context):
    context.no_cache = 1
    context.show_sidebar = True
    permission = False

    context.papers = frappe.get_all('Paper', fields=['*'])

In your template now you have the papers variable.

Also you can check erpnext/erpnext/templates/pages at develop · frappe/erpnext · GitHub

Regards

1 Like

@federico_calvo thank you so much :slightly_smiling_face:

Dear @federico_calvo I am very thankful to you once again, but their is one more issue I have created the files as you said in templates/pages/paper.html and templates/pages/paper.py but I could not browse paper.html from browser when I type http://myserver_address:8000/paper
I shall be very thankful if you could elaborate with example that how could we access the files under templates/pages/ folder OR how these files are linked with other doctypes

I think it’s supposed to be in the www/ folder of your app - that’s where those files need to be placed.

Ref: https://frappe.io/docs/user/en/guides/portal-development/adding-pages