[Python] django.db.utils.DataError: division by zero

Discussão em 'Python' iniciado por Stack, Fevereiro 19, 2025.

  1. Stack

    Stack Membro Participativo

    I am getting a error in the following line of code:

    context['stock_margin'] = context['top_stock'].annotate(
    Avg_purchase = ExpressionWrapper(F('total_puchase') / F('quantity_purchase'), output_field=FloatField()),
    Avg_sales = ExpressionWrapper(F('total') / F('quantity'), output_field=FloatField()))


    I am new to django and cant able to figure out why this is happening..

    Any idea anyone how to solve this error?

    Continue reading...

Compartilhe esta Página