[Django]-Django. Remove object from queryset

32👍

‘QuerySet’ object has no attribute ‘pop’

You can see the details about Queryset

You can try:

Yourmodel.objects.exclude(lugar="Quito")

to filter the queryset, more details here Retrieving objects¶

13👍

How about queryset.exclude(lugar="Quito")?

0👍

popping from set() or list() worked out for me:

quito_set = set(quito)
quito_item = None
while quito_set:
    quito_item = quito_set.pop()
    if quito_item is OK:
        break
👤Denis

Leave a comment