These are chat archives for django/django

Apr 2017
Apr 19 2017 18:55 UTC
I'm trying to remove some duplicate data on my db
def duplicates():
    for rebalance in plans_rebalances:
        repeated = PlanRebalance.objects.filter(rebalance_date="2016-04-29", real=False, plan=rebalance.plan).annotate(
        while repeated.plan__count > 1:
            first, rest = repeated[0], repeated[1:]
but I get this error
'QuerySet' object has no attribute 'plan__count'
Cristian Samaniego
Apr 19 2017 19:00 UTC
i think it is because repeated has the entire queryset
maybe you should do a loop for that like for plan_rebalance in repeated:
Steven Liao
Apr 19 2017 19:02 UTC
Apr 19 2017 19:08 UTC
i'll test it
Cristian Samaniego
Apr 19 2017 19:19 UTC i think this will also help you with performance
Apr 19 2017 19:24 UTC
hello is here someone ?
Philip Eckert
Apr 19 2017 20:10 UTC
Okay so when I try to run python -Wall test to see what warnings I need to deal with to upgrade, I get thousands of ImportWarnings and can't read anything else. Is there a way to log everything or filter out those specific warnings?
Apr 19 2017 23:15 UTC
Using a package as a library vs using it as an app -- what's the difference? Django-organizations says it can be used as a library -- I think this means that I need to manually bring in its various base and abstract base classes into my own project's models. Am I understanding that right?