I’ve read the docs and many posts about this, with no luck.
artwork_list = Artwork.objects.only('title','image_name').filter(groups__icontains=group)
This produces the “Unsupported lookup ‘icontains’ for ForeignKey or join on the field not permitted” error.
Models (just the relevant parts:
class Group(models.Model):
name = models.CharField(max_length=200, null=True, blank=False)
class Artwork(models.Model):
groups = models.ManyToManyField(Group)
View (ditto):
def group_page(request, site_id, group_id ):
group = get_object_or_404(Group, pk=group_id)
artwork_list = Artwork.objects.only('title','image_name', "groups").filter(groups__icontains=group)
Is this not the correct syntax?