I am new in Python coding and now trying to learn Django. Right now i am using django 1.11.3 version. So i have learned the basic thing in Django and created an app.
In my app, i have created a student model which include an password field. What i have noticed is, in Admin module password field is stored in simple text. So i need help to hash the password field in admin module. I need md5 hashing.
So can u guys help me. Is there any method to solve this?
This is what i have tried.
My Model
class student(models.Model):
name = models.CharField(max_length=100)
age = models.CharField(max_length=2)
dob = models.DateField()
father_name = models.CharField(max_length=100)
username = models.CharField(max_length=25,null=True)
password = models.CharField(max_length=100,null=True)
def __unicode__(self):
return self.name
My Admin
from django.contrib import admin
from django import forms
from .models import student
admin.site.register(student)
class studentAdmin(admin.ModelAdmin):
formfield_overrides = {
student.password: {'widget': forms.PasswordInput},
}