How can I keep a user's form selection always submitted?

Hi, I’m having trouble working out how to keep a selected currency by a user permanently submitted unless the user changes it themselves. I have read about using django sessions or adding the option tag in the html but struggling to find how to achieve this.

E.g. When the user logs in for the first time and they submit currency GBP, that selection will stay submitted unless they decide to submit another currency.

FYI - the user’s selection is not being stored in a model


class MyDashboardView(TemplateView):
    template_name = 'coinprices/my-dashboard.html'

    def get(self, request, **kwargs):

        form_c = CurrencyForm(prefix='form_c')
        return render(request, self.template_name, {
            'form_c': form_c,

    def post(self, request):

        currency = None

        form_c = CurrencyForm(request.POST, prefix='form_c')

        if request.method == 'POST':
            if form_c.is_valid():
                currency = form_c.cleaned_data['currency']
            form_c = CurrencyForm()        

        rates = {'USD': 1.0, 'AUD': 1.321, 'GBP': 0.764, 'CAD': 1.249}

        deposit = 10000 / rates[currency]

        context = {
            'deposit': deposit,
            'form_c': form_c,

        return render(request, 'coinprices/my-dashboard.html', context)


class CurrencyForm(forms.Form):
    currency = forms.ChoiceField(initial=('USD', 'USD'), choices=['USD', 'AUD', 'GBP' 'CAD'], label='Choose Currency:')


        <form method="post">
            {% csrf_token %}
            {{ form_c.as_p }}
            <button class="btn btn-outline-success btn-sm">Submit</button>


urlpatterns = [
    path('my-dashboard/', MyDashboardView.as_view(template_name='coinprices/my-dashboard.html'), name='dashboard'),

Store the user’s selection in a model. You can create a “profile” model to store user’s preferences like this.
See the docs at Customizing authentication in Django | Django documentation | Django

Would you elaborating on how: storing the user’s selection in a model would be used to keep the CurrencyForm submitted?

How do you store data entered in any form in any model? This is no different.

Currently I have only had experience with displaying submitted data from a model. I have not been able to retain a user’s selection in a form.

For my page to start working the user must submit once but on refresh/new page the selection has not been retained. So from my experience, I could display a user’s selection but do not know how to keep the form submitted. Any further guidance will be appreciated.

I would suggest then at this point that you work your way through either the Official Django Tutorial or the Django Girls Tutorial. Either of them are going to give you experience with working with forms and models.