freddydrew / fredducation

Where My Language Learning Blog Lives
https://www.fredducation.co/
0 stars 0 forks source link

deal with artifacts of old code #107

Closed freddydrew closed 8 months ago

freddydrew commented 8 months ago

Remove Q lookups as part of pre-PostgreSQL search:

`# Define Custom QuerySet behavior class articleQuerySet(models.QuerySet): def search(self, query=None): if query is None or query == "" or query.strip() == '': return self.none() # Empty query list

Q lookups

    lookups = Q(title__icontains=query) | Q(
        content__icontains=query) | Q(
        city__icontains=query) | Q(
        country__icontains=query) | Q(
        alpha3__icontains=query) | Q(
        slug__icontains=query) | Q(
        postType__icontains=query)
    return self.filter(lookups)

`