import jingrow


@jingrow.whitelist()
def get_print_settings_to_show(pagetype, pagename):
	pg = jingrow.get_pg(pagetype, pagename)
	print_settings = jingrow.get_single("Print Settings")

	if hasattr(pg, "get_print_settings"):
		fields = pg.get_print_settings() or []
	else:
		return []

	print_settings_fields = []
	for fieldname in fields:
		df = print_settings.meta.get_field(fieldname)
		if not df:
			continue
		df.default = print_settings.get(fieldname)
		print_settings_fields.append(df)

	return print_settings_fields
