Skip to content

Instantly share code, notes, and snippets.

@LucasMagnum
Created August 2, 2017 14:44
Show Gist options
  • Save LucasMagnum/6877f8fbde11b8f8a8bcddc22e968685 to your computer and use it in GitHub Desktop.
Save LucasMagnum/6877f8fbde11b8f8a8bcddc22e968685 to your computer and use it in GitHub Desktop.
#DjangoTip - Playing with querysets - Model
class Product(models.Model):
title = models.CharField(max_length=120)
is_adult = models.BooleanField(default=False)
is_active = models.Bool eanField(default=True)
adult_products = Product.objects.filter(is_adult=True)
active_products = Product.objects.filter(is_active=True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment