How i can update model when Key exist else create a new one??
 

My code is-
 
**Form.py**

class UserSettingForm(forms.ModelForm):
     class Meta:
           model = StUserSetting
           fields = ( 'default_language', 'prim_currency', 'number_format', 
'decimal_format',
            'date_format', 'time_format', 'currency_format', 
'currency_position', 'financial_year_start', 
             'week_start', 'estimate_default_tab', 'invoice_default_tab',)

**View.py**


class CreateUpadateUserSetting(LoginRequiredMixin, FormView):
     template_name = 'settings/user_settings.html'
     form_class = UserSettingForm
     success_url = '/user/setting/preference/'


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/177de87e-ec35-4cb2-a99d-16688dcdda7d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to