I want to get the string equivalent of the field named frontal in the database and see it. frontal a manytomanyfield.
I can access the foreground in my model with "Advertising.frontal.get". But how can I see this in restapi.
The value of the frontal area in restapi appears numerical. Because of the way I describe this area. This is normal. But I know the method I should use when viewing (this method: Advertise.frontal.get). How do I view it in restapi with this method.
## Serializer.py ##
class AdvertiseMainSerializer(ModelSerializer):
class Meta:
model = Advertise
fields = '__all__'
## views.py##
class advertise(ListAPIView):
serializer_class = AdvertiseMainSerializer
queryset = Advertise.objects.all()
## model.py##
class Advertise(models.Model):
owner = models.ForeignKey(to="user.User", on_delete=models.CASCADE, null=True)
title = models.CharField(max_length=100, verbose_name="ilan başlığı")
frontal = models.ManyToManyField(to="advertise.Frontal")