hi
How can pass country data as a selection list in the web template and controller?
Field nationality_id : many2one('res.country ')
class ApplicantController(http.Controller):
@http.route(['/create/applicant'], type='http', auth="public", website=True, csrf=True)
def applicant_form(self, **kwargs):
if kwargs:
# Create a new applicant record using the form data
applicant_data = {
'company_id' : request.env.company.id, # Set to the current company
'registeration_type' : kwargs.get('registeration_type'),
'applicant_type' : kwargs.get('applicant_type'),
'applicant_first_name' : kwargs.get('applicant_first_name'),
'applicant_second_name' : kwargs.get('applicant_second_name'),
'applicant_third_name' : kwargs.get('applicant_third_name'),
'applicant_fourth_name' : kwargs.get('applicant_fourth_name'),
'nationality_id' : kwargs.get('nationality_id'),
'religion_id' : kwargs.get('religion_id'),
'country_id' : kwargs.get('country_id'),
'state_id' : kwargs.get('state_id'),
'area_id' : kwargs.get('area_id'),
}
request.env['applicant'].sudo().create(applicant_data)
#return request.render('applicantion.applicant_success_template')
return request.render('applicantion.applicant_success_template') # You can redirect to a thank you page
return request.render('applicantion.applicant_form_template')
thanks