I couldn't find out this script at all in django-form

would you please explain this scripts?

why we used **def init(self, *args, kwargs): AND **super(ProfileForm, self).init(*args, kwargs) ?

*from django import forms

from django.forms import fields

from .models import User

class ProfileForm(forms.ModelForm):

  def __init__(self, *args, **kwargs):
   
        super(ProfileForm, self).__init__(*args, **kwargs)
   
        self.fields['username'].help_text = None
    
        self.fields['username'].disabled = True
   
        self.fields['email'].disabled = True
  
        self.fields['special_user'].disabled = True
   
        self.fields['is_author'].disabled = True

  class Meta:
 
         model = User
   
         fields = [   'username', 'email', 'first_name', 'last_name', 'special_user',
                'is_author'
                ]

thanks.*

Back to Top