I am building an extension where I want to update the account label inside of account_list. The update works inside of the route I perform the update in, however once I change routes the data is gone. I thought that the next step would be to make an update directly to the database, but I cannot find in the documentation where this exact issue is addressed.
Below is an example of the code I am using to update the account label. This is just the relevant pieces of the route, not the full code.
new_account_label = self.form_fields['new_account_label']
account_number = int(self.form_fields['account_id'])
count = 0
for item in self.account_list:
if item.host_acct_id == account_number:
item.acct_label = new_account_label
accounts_to_refresh.append(item.acct_number_internal)
break
count += 1
template = self.get_template('nameChange.html.jinja2', {
'new_account_label': self.account_list.accounts[count].acct_label,
'account_number': account_number
}
)
In the code, I used 'new_account_label': self.account_list.accounts[count].acct_label instead of 'new_account_label': new_account_label to make sure that the account label was updated, and it was but only in the route this code exists in. In all other routes the change does not apply.
Where can I find information on this particular issue in the database or what is the right way to approach this problem? Thank you.