[Solved]-AttributeError : 'NoneType' object has no attribute '_meta'


When you have a custom Django User model make sure you are importing it correctly in files that initiate User (From the Django Docs). So, add the following to the top of your serializers.py file. This fixed the same error for me.

from django.contrib.auth import get_user_model

User = get_user_model()


Not Indented Properly

class CreateCarrierSerializer(serializers.ModelSerializer):
     class Meta:
        model = User
        fields = ('email','domainID','roleID','user_name','phone')


You will also have to update imports so that they point to your new custom User model.

Leave a comment