title: Django serialization: AttributeError when attempting to get a value for field on serializer
body: <p>I am getting the following error, </p>
  
  <blockquote>
    <p>AttributeError: Got AttributeError when attempting to get a value for field <code>devicedetails</code> on serializer <code>DISerializer</code>.
    The serializer field might be named incorrectly and not match any attribute or key on the <code>Device</code> instance.
    Original exception text was: 'Device' object has no attribute 'devicedetails'.</p>
  </blockquote>
  
  <p>My models.py :-</p>
  
  <pre><code>class DeviceInfo(models.Model):
      vendor = models.CharField(max_length=250)
      device_type = models.CharField(max_length=250)
      modelname = models.CharField(max_length=100)
  
  class Device(models.Model):
      name = models.CharField(max_length=100, primary_key=True)
      username = models.TextField()
      password = EncryptedTextField()
      deviceinfo = models.ForeignKey(DeviceInfo, null=True)
  
  class DeviceDetails(models.Model):
      device = models.ForeignKey(Device)
      serial_number = models.CharField(max_length=100)
      version = models.CharField(max_length=100)
  </code></pre>
  
  <p>serializer.py :-</p>
  
  <pre><code>class DeviceInfoSerializer(serializers.ModelSerializer):
      class Meta:
          model = DeviceInfo
          fields = ("id", "vendor", "device_type", "modelname")
  
  class DeviceSerializer(serializers.ModelSerializer):
      class Meta:
          model = Device
          fields = ("name","username", "password", "deviceinfo")
  
  class DeviceDetailsSerializer(serializers.ModelSerializer):
      class Meta:
           model = DevieceDetails
           fields = ("device", "serial_number", "version")
  
  class DISerializer(serializers.ModelSerializer):
      deviceinfo = DeviceInfoSerializer(read_only=True)
      devicedetails = DeviceDetailsSerializer(many=True)
  
      class Meta:
          model = Device
          fields = ("name", "username", "password", "deviceinfo", "devicedetails")
  </code></pre>
  
  <p>views.py :-</p>
  
  <pre><code>def list(self, request):
      list = Device.objects.all()
      serializer = DISerializer(list, many=True)
  </code></pre>