Thanks :-) Should have guessed it was that easy!
On Wed, Dec 23, 2015 at 12:44 PM, Vijay Khemlani wrote:
> You should be able to query it as a ForeignKey
>
> Jobs.objects.filter(names__is_a_problem=True).distinct()
>
> (distinct to prevent repeated jobs with more than one worker problem)
>
>
> O
You should be able to query it as a ForeignKey
Jobs.objects.filter(names__is_a_problem=True).distinct()
(distinct to prevent repeated jobs with more than one worker problem)
On Wed, Dec 23, 2015 at 9:31 AM, Jonty Needham
wrote:
> I have a model of the form:
>
> class Jobs(models.Model):
>
I have a model of the form:
class Jobs(models.Model):
names = models.ManyToManyField(Workers)
class Workers(modesl.Model):
is_a_problem = True
And I want the set of jobs that are done by workers who are a problem.
Something like
Jobs.objects.filter(names__is_contained_in=Workers
3 matches
Mail list logo