I would simply like to transform a prefetch_related query into a Panda dataframe with all the information from the two models below. This should be very simple but somehow nothing works. I get a 'Capture_set is not defined' with the code below. Any idea ?
class Capture(models.Model):
species_name = models.CharField(max_length=50)
total_capture = models.IntegerField()
class Species(models.Model):
species_name = models.ForeignKey(Capture, on_delete=models.DO_NOTHING)
length = models.IntegerField()
weight = models.IntegerField()
data = pd.DataFrame(list(Species.objects.all().prefetch_related(Capture_set)))