0

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.*

  • Does this answer your question? [What does 'super' do in Python? - difference between super().\_\_init\_\_() and explicit superclass \_\_init\_\_()](https://stackoverflow.com/questions/222877/what-does-super-do-in-python-difference-between-super-init-and-expl) – Sumithran Dec 08 '21 at 16:59

0 Answers0