title: Django - how to save my hashed password
body: <p>I'm trying to save my hashed password in my database, but It keeps saving my plaintext password</p>
  
  <p><strong>Models:</strong></p>
  
  <pre><code>class StudentRegistration(models.Model):
      email = models.EmailField(max_length=50)
      first_name = models.CharField(max_length=20)
      last_name = models.CharField(max_length=20)
      password = models.CharField(max_length=100, default="", null=False)
      prom_code = models.CharField(max_length=8, default="", null=False)
      gender = (
      ("M","Male"),
      ("F","Female"),
      )
      gender = models.CharField(max_length=1, choices=gender, default="M",    null=False)
      prom_name = models.CharField(max_length=20, default="N/A")
      prom_year = models.IntegerField(max_length=4, default=1900)
      school = models.CharField(max_length=50, default="N/A")
  
  
  
      def save(self):
           try:
              Myobj = Space.objects.get(prom_code = self.prom_code)
              self.prom_name = Myobj.prom_name
              self.prom_year = Myobj.prom_year
              self.school = Myobj.school_name
  
              super(StudentRegistration, self).save()
  
          except Space.DoesNotExist:
              print("Error")
  </code></pre>
  
  <p><strong>Views:</strong></p>
  
  <pre><code>def register_user(request):
      args = {}
      if request.method == 'POST':
          form = MyRegistrationForm(request.POST)     # create form object
          if form.is_valid():
              clearPassNoHash = form.cleaned_data['password']
              form.password = make_password(clearPassNoHash, None, 'md5')
              form.save()
              form = MyRegistrationForm()
              print ('se salvo')
          else:
              print ('Error en el form')
      else:
          form = MyRegistrationForm()
  
  
      args['form'] = form #MyRegistrationForm()
  
      return render(request, 'register/register.html', args)
  </code></pre>
  
  <p>I've printed the hashed result so I know it is hashing but not saving that. </p>
  
  <p>Am I using the make_password wrong? or is there any better way to protect my passwords?</p>
  
  <p>--------------------------<strong>UPDATE:(The Solution)</strong>----------------------------</p>
  
  <p>Remember In settings.py:</p>
  
  <pre><code>#The Hasher you are using
  PASSWORD_HASHERS = (
      'django.contrib.auth.hashers.MD5PasswordHasher',
  )
  </code></pre>
  
  <p>Models.py:</p>
  
  <pre><code>#Import and add the AbstractBaseUser in your model
  
  class StudentRegistration(AbstractBaseUser, models.Model):
  </code></pre>
  
  <p>Views.py: </p>
  
  <pre><code>if form.is_valid():
      user = form.save(commit=False)
      clearPassNoHash = form.cleaned_data['password']
      varhash = make_password(clearPassNoHash, None, 'md5')
      user.set_password(varhash)
      user.save()
  </code></pre>