Django: Select Non-Empty Fields


/ Published in: Python
Save to your folder(s)

I always forget you need to use exclude()


Copy this code and paste it in your HTML
  1. Profile.objects.filter(user__groups__isnull=True, on_homepage=False).exclude(about__exact='').order_by('?')[:settings.PROFILES_ON_HOMEPAGE]

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.