          Return all the fields that should be serialized for the model.
          """
  
          cls = self.opts.model
          opts = get_concrete_model(cls)._meta
          pk_field = opts.pk
          # while pk_field.rel:
          #     pk_field = pk_field.rel.to._meta.pk
          fields = [pk_field]
          fields += [field for field in opts.fields if field.serialize]
 
</s>
        if cls is None:
            raise AttributeError("Serializer class is missing 'model' Meta option")
          Return all the fields that should be serialized for the model.
          """
  
          cls = self.opts.model
        if cls is None:
            raise AttributeError("Serializer class is missing 'model' Meta option")
          opts = get_concrete_model(cls)._meta
          pk_field = opts.pk
          # while pk_field.rel:
          #     pk_field = pk_field.rel.to._meta.pk
          fields = [pk_field]
          fields += [field for field in opts.fields if field.serialize]
keep keep keep add keep keep keep keep keep keep
 Improved exception message for missing serializer model meta option
rest_framework/serializers.py