Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Crew(models.Model):
- crew_id = models.AutoField(primary_key=True)
- crew_code = models.CharField(max_length=200, null=False, unique=True)
- crew_name = models.CharField(max_length=200, null=False)
- crew_password = models.CharField(max_length=200, null=False)
- from django.contrib.auth.hashers import make_password
- crew_password = 'take the input if you are using form'
- form = FormName(commit=False)
- form.crew_password=make_password(crew_password)
- form.save()
- from django.forms import ModelForm, PasswordInput
- class CrewForm(ModelForm):
- class Meta:
- model = Crew
- fields = '__all__'
- widgets = {
- 'crew_password': PasswordInput(),
- }
- form.crew_password=make_password(crew_password)
- form.save()
- def save(self, *args, **kwargs):
- self.crew_password = make_password(self.crew_password)
- super(Crew, self).save(*args, **kwargs)
- password = forms.CharField(
- widget=forms.PasswordInput
- )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement