'Django Update Management Command
I am trying to give the command such a way when blacklist is TRUE and active will FALSE,
But I am getting all the Blacklist TRUE and Active is FALSE.
from django.core.management import BaseCommand
from wm_data_collection.models import roses
class Command(BaseCommand):
help = "Blacklist_TRUE then Active_FALSE."
def handle(self, *args, **options):
roses.objects.filter(active=False).update(blacklist=True)
Solution 1:[1]
I think you have incorrect fields in filter and update methods Shouldn't it be:
roses.objects.filter(blacklist=True).update(active=False)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | TrueGopnik |
