Closed Bastilla123 closed 4 years ago
Encrypted fields generally don't support lookup within querysets since the data in the actual table cannot be compared to what it is required to match. The only way to do what you are trying to do would be to query for all of the Adressen
objects and iterate over them until you find the one whose attributes match.
I have following model:
class Adressen(models.Model): geburtsdatum = encrypt(models.DateField(default=None,blank=True,null=True))
views: start = date.today() end = start + timedelta(days=14) Geburtstage = Adressen.objects.filter( Q(geburtsdatummonth=start.month) & Q(geburtsdatumdaygte=start.day) | Q(geburtsdatummonth=end.month) & Q(geburtsdatumdaylte=end.day) ).order_by('geburtsdatum')
Exception:
django.core.exceptions.FieldError: Unsupported lookup 'month' for EncryptedDateField or join on the field not permitted, perhaps you meant month?