Hello,

I just solved it, and went with a @property. On Build I have:

@property
def values(self):
    return Value.objects.filter(grouping__build=self)

and on the Value I have:

@property
def build(self):
    return self.grouping.build

This way I stay backwards compatible and didn’t even have to change my
templates and such. Thanks for the tips, though!

Best,
Gergely

2015-10-14 15:09 GMT+02:00 Carsten Fuchs <[email protected]>:

> Am 14.10.2015 um 11:11 schrieb Gergely Polonkai:
>
>> This setup, though, doesn’t feel right, as it contains redundancy. Is
>> there a way to
>> access the list of Values directly from Build without having this
>> redundancy?
>>
>
> Well, you can filter your Value queryset by Build, see
>
> https://docs.djangoproject.com/en/1.8/topics/db/queries/#lookups-that-span-relationships
>
> Or, starting with a Build instance, you can work towards the Value
> instances, see
> https://docs.djangoproject.com/en/1.8/topics/db/queries/#related-objects
>
> Best regards,
> Carsten
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/561E540F.6030202%40cafu.de.
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACczBU%2BogVBRKWPoMU_N_g8sXb4prmb-iMKD26pJAkOgzgePBA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to