[Django]-ImportError : no module named 'models'

9👍

✅

you need to add dot

from .models import CustomUser
#   ^^^

o best way use app_name

from custom_user.models import CustomUser

and for your second error, you can simple add empty exclude to the Meta:

class CustomUserChangeForm(UserChangeForm):

def __init__(self, *args, **kargs):
    super(CustomUserChangeForm, self).__init__(*args, **kargs)
    del self.fields['username']

 class Meta:
    model = CustomUser
    exclude = () # THIS ROW

Leave a comment