Here is my error, and I really can't find anything similar to my problem:
from django.db.models import Q
_entry = Entry.objects.get(Q(slug=slug, author=self.author) & ~Q(id=self.id))
TypeError: bad operand type for unary ~: 'Q'
An alternative to what you are trying to do with Q
s, would be to use filter()
+exclude()
+get()
:
_entry = Entry.objects.filter(slug=slug, author=self.author).exclude(id=self.id).get()