Appreciate some help trying to build a queryset. Im hoping I can make
this in django, without having to crack open raw sql... Here is my
setup:
class Container(models.Model):
permissions = generic.GenericRelation(Permission)
class Item(models.Model):
container = models.ForeignKey(Container)
extraSetting = models.ForeignKey(ExtraSetting)
class Permission(models.Model):
content_type = models.ForeignKey(ContentType)
content_object = generic.GenericForeignKey()
extraSetting = models.ForeignKey(ExtraSetting)
class ExtraSetting(models.Model):
....
Convoluted made up example, but hopefully you can see what the data
might be.
So the problem im trying to solve. I need to get a list of items and
their permissions, but restrict the permission set so that I only get
permissions where extraSetting is the same on the Item and on the
permission.
So I want to run something like
Item.objects.filter(container__permissions__extraSetting=Item.extraSetting)
Hope this makes some form of sense...
thanks
guardbadger
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
No comments:
Post a Comment