title: Django UpdatingProfile form
body: <p>I am building an application that allows users to view and edit their own personal profile. Users are able to view their profile and the profile is editable from the admin side. However when a user tries to edit their own info, they are getting a <code>NameError</code> telling them that <code>args</code> is not defined. Below is how I have tried to implement the editing functionality: </p>
  
  <p><strong>forms</strong></p>
  
  <pre><code>class UpdateProfile(forms.ModelForm):
      username = forms.CharField(required=False)
      email = forms.EmailField(required=False)
      first_name = forms.CharField(required=False)
      last_name = forms.CharField(required=False)
      age = forms.IntegerField(required=False)
      height = forms.IntegerField(required=False)
      weight = forms.IntegerField(required=False)
  
      class Meta:
          model = User
  #These are the fields that i want to be made editable. 
          fields = ('username', 'email', 'first_name', 'last_name', 'age', 'height', 'weight')
  
  
      def clean_email(self):
          username = self.cleaned_data.get('username')
          email = self.cleaned_data.get('email')
  
          if email and User.objects.filter(email=email).exclude(username=username).count():
              raise forms.ValidationError('This email address is already in use. Please supply a different email address.')
          return email
  
      def save(self, commit=True):
          super(UpdateProfile, self).__init__(*args, **kwargs)
  
  #Here i am trying to add the new data to the users profile
          if commit:
              user_profile.user.save()
  
          return user_profile
  </code></pre>
  
  <p><strong>Views</strong></p>
  
  <pre><code>def update_profile(request):
      args = {}
  
      if request.method == 'POST':
          form = UpdateProfile(request.POST, instance=request.user)
          if form.is_valid():
              form.save()
              return HttpResponseRedirect(reverse('account/profile.html'))
  
      else:
          form = UpdateProfile()
          args['form'] = form
          return render(request, 'account/edit_profile.html', args)
  </code></pre>