title: Django Form Doesn't Save to Table
body: <p>Here is the issue - when the user presses the 'Save' button, the settings they entered SHOULD be saved to the table. However, this doesn't happen. After you are redirected, you can check the 'Settings' page again or the admin site and the changes will not appear. I even put in several print statements which ALL run, but I can't figure out why this is happening. Here is the code (I only included what is necessary)</p>
  
  <p><strong>views.py</strong></p>
  
  <pre><code>class SettingsView(LoginRequiredMixin, FormView):
  template_name = 'example/settings.html'
  form_class = ExampleSettingsForm
  success_url = reverse_lazy('example:index')
  
  def get_context_data(self, **kwargs):
      context = super(SettingsView, self).get_context_data(**kwargs)
      context['page'] = 'settings'
      return context
  
  def get_initial(self):
      initial = super(SettingsView, self).get_initial()
  
      initial['example1'] = self.request.user.example.example1
      initial['example2'] = self.request.user.example.example2
      initial['example3'] = self.request.user.example.example3
      initial['example4'] = self.request.user.example.example4
      initial['example5'] = self.request.user.example.example5
      initial['example6'] = self.request.user.example.example6
      initial['example7'] = self.request.user.example.example7
  
      return initial
  
  def form_valid(self, form):
      form.save_to_example(self.request.user)
      print("Form valid.")
      return super(SettingsView, self).form_valid(form)
  
  @method_decorator(shelter_login_required)
  def dispatch(self, *args, **kwargs):
      return super(SettingsView, self).dispatch(*args, **kwargs)
  </code></pre>
  
  <p><strong>forms.py</strong></p>
  
  <pre><code>class ExampleSettingsForm(forms.Form):
  example1 = forms.CharField()
  
  example2 = forms.TimeField()
  example3 = forms.TimeField()
  
  example4 = AddressField()
  
  example5 = forms.IntegerField()
  
  example6 = forms.RegexField(regex=r'^\+?1?\d{9,15}$')
  
  example7 = forms.BooleanField()
  
  def save_to_example(self, user):
      user.example.example1 = self.cleaned_data['example1']
      user.example.example2 = self.cleaned_data['example2']
      user.example.example3 = self.cleaned_data['example3']
      user.example.example4 = self.cleaned_data['example4']
      user.example.example5 = self.cleaned_data['example5']
      user.example.example6 = self.cleaned_data['example6']
      user.example.example7 = self.cleaned_data['example7']
      user.save()
      print(user.example.example1)
  </code></pre>
  
  <p><strong>models.py</strong></p>
  
  <pre><code>class Example(models.Model):
      example1 = models.CharField(max_length=200)
  
      example2 = models.TimeField(null=True)
      example3 = models.TimeField(null=True)
  
      example_male = models.IntegerField(default=0)
      example_female = models.IntegerField(default=0)
  
      example6 = models.IntegerField(default=10)
  
      example5 = AddressField(null=True, on_delete=models.CASCADE)
  
      user = models.OneToOneField(User, on_delete=models.CASCADE)
  
      example7 = models.BooleanField(default=False)
  
      example_regex = RegexValidator(regex=r'^\+?1?\d{9,15}$', message="Phone number must be entered in the format: '+999999999'. Up to 15 digits allowed.")
      example_number = models.CharField(validators=[phone_regex], max_length=17, blank=True)
  
  @receiver(post_save, sender=User)
  def create_user_example(sender, instance, created, **kwarg):
      if created:
          Example.objects.create(user=instance)
  
  @receiver(post_save, sender=User)
  def save_user_example(sender, instance, **kwargs):
      if not instance.is_superuser:
          instance.example.save()
  </code></pre>
  
  <p><strong>Note -</strong> I know the indentation isn't correct. I had trouble copy/pasting into Stack Overflow.</p>