Hello,
my first post here.
I've been poking at this duplicate result thing
and it's come down to maybe a fundamental what-does-django-do question:
class Medium(models.Model):
artifact = models.ForeignKey('Artifact', on_delete=models.PROTECT)
class Artifact(models.Model):
def get_medium(self,idx):
try:
media = self.medium_set.all()
for m in media: # <-- THIS
pass # <-- THIS
return media[idx]
except:
return False
Why would iterating over media give me correct results,
get_medium(0), get_medium(1) == 9, 13
but if I don't, I get a duplicate row?
get_medium(0), get_medium(1) == 9, 9
-Michael
--
Michael Ross <
g...@ross.cx>