from django.db import models

class Price(models.Model):
    price = models.PositiveIntegerField()
    datetime = models.DateTimeField()

from django.db import models

class Price(models.Model):
    price = models.PositiveIntegerField()
    datetime = models.DateTimeField()

    @property
    def price_float(self):
        return self.price / 1000.0

    @price_float.setter
    def price_float(self, price):
        self.price = round(price * 1000)

Add property for converting price float to integer
Add property for converting price float to integer

  from django.db import models
  
  class Price(models.Model):
      price = models.PositiveIntegerField()
      datetime = models.DateTimeField()
  
+     @property
+     def price_float(self):
+         return self.price / 1000.0
+ 
+     @price_float.setter
+     def price_float(self, price):
+         self.price = round(price * 1000)
+ 
Add property for converting price float to integer
## Code Before:
from django.db import models

class Price(models.Model):
    price = models.PositiveIntegerField()
    datetime = models.DateTimeField()

## Instruction:
Add property for converting price float to integer
## Code After:
from django.db import models

class Price(models.Model):
    price = models.PositiveIntegerField()
    datetime = models.DateTimeField()

    @property
    def price_float(self):
        return self.price / 1000.0

    @price_float.setter
    def price_float(self, price):
        self.price = round(price * 1000)
