Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Django. Remove object from queryset

I need to do something like this:

quito = queryset.get(lugar="Quito")
queryset.pop(quito)

But I get the error:

'QuerySet' object has no attribute 'pop'

How can I solve this?

like image 846
Alejandro Veintimilla Avatar asked Sep 07 '16 00:09

Alejandro Veintimilla


2 Answers

'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¶

like image 173
Windsooon Avatar answered Nov 08 '22 21:11

Windsooon


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

like image 13
Alex Riina Avatar answered Nov 08 '22 20:11

Alex Riina