[Fixed]-Exclude field from values() or values_list()

38👍

You must use defer This will not add defined fields to your select query.

Videos.objects.filter(...).defer('duration')
👤Mp0int

20👍

You can get all fields first, then pop out the fields you do not want:

fields = Video._meta.get_all_field_names()
fields.remove('id')
Video.object.filter(...).values(*fields)
👤iMom0

Leave a comment