How can I upload defaults record in some DocType?

Hi there!

I’m still make my own DocTypes in Frappe Framework, but I have one table (city) which contains arround 6000 record… and I also have the default SQL here, How can I import them into new Frappe DocType model?

Another Question: I have a Mark field, How can I set the default value for them?

Thanks

Hi,

You can set default values using the DocField’s “Default” field. What do you mean by “Mark” field?

Default records can be uploaded during app installation using “fixtures” system.

You have to specify a value in hooks.py as fixtures = ["Some DocType"]

https://github.com/frappe/erpnext_org/blob/master/erpnext_org/hooks.py

Then running: frappe sitename --export_fixtures will export all records of that doctype in app_name/fixtures folder

https://github.com/frappe/erpnext_org/tree/master/erpnext_org/fixtures

Then, when installing an app, these fixtures get imported automatically in the database.

Thanks,
Anand.

So, I try to make a checkbox field, in Frappe named as Check.

I put in option field:

default=1
default=True
default=true

None works… what’s I`m doing wrong?

Sorry, my bad! I found the Default field!! :grin: