Wednesday, June 3, 2020

Re: Model Arithmetic Operation

Inbox me with your objective on what you want to accomplish and give me the the piece of code trying to emulate your two models and then I will look into your code and give the Solution if I can. 

Sincerely D.C

On Wed, Jun 3, 2020 at 5:12 AM Hella Nick <personhela@gmail.com> wrote:
  • Niggers are clearly not suited for the job.


Ifeanyi Chielo <ifeanyi.chielo@unn.edu.ng> 于2020年6月3日周三 上午7:43写道:
Dear all,

Hello, please can someone help me with the code to subtract  'b' from 'a' as shown below


a = Soapprod.objects.aggregate(Sum('Serial_White_Guava'))

 

b = Soapsales.objects.aggregate(Sum('Serial_White_Guava'))

 

class Soapprod (models.Model):

    id = models.AutoField(primary_key=True)

    Serial_White_Guava                  = models.PositiveIntegerField()

    Serial_White_Premium                = models.PositiveIntegerField()

    Soft_Flower_Body_Wash               = models.PositiveIntegerField()

    Soft_Flower_Fresh                   = models.PositiveIntegerField()

    Soft_Flower_Orange_Lightening       = models.PositiveIntegerField()

    Soft_Flower_Carot_Lightening        = models.PositiveIntegerField()

    Soft_Flower_Papaya_Extract          = models.PositiveIntegerField()

    Soft_Flower_Extra_Lightening        = models.PositiveIntegerField()

    Serial_White_Papaya_4in1            = models.PositiveIntegerField()

    date                                = models.DateField(default = date.today)

   

    def __str__(self):

        return self.serial_white_guava

 

class Soapsales (Soapprod):

    SOAP_MARKETER_STATUS = (

        ('M''Marketers'),

        ('D''Distributor'),

        ('A''Distributor_B'),

        ('B''Distributor_C'),

    )    

    soap_marketer_status = models.CharField(max_length=1choices=SOAP_MARKETER_STATUS)

 

 

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/1c978c25-cbb4-41bd-ab01-b49aa6365826%40googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAHfGPEfi9UkV0dd89KVnNRoNMJMJMNGhd63JWMQAVaDjYURw3g%40mail.gmail.com.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAMLk3fzVHR03oALzAkoVhwLYqWTRWR-TUxD4NqVHVUv99ttg2Q%40mail.gmail.com.

No comments:

Post a Comment