Django by default not have any percentage field but you can archive those things like this
models.py
from django.db import models
class ProductModel(models.Model):
name= models.CharField(max_length=100)
og_price = models.IntegerField(null=True, blank=True)
sell_price = models.IntegerField(null=True, blank=True)
discount = models.IntegerField(blank=True, default=0)
discounted_price = models.IntegerField(blank=True, default=0)
@property
def discount_in_percentage(self):
return f"{self.discount} %"
@property
def discounted_price(self):
return ((self.og_price*self.discount)/100)
@property
def sell_price(self):
return ((self.og_price - self.discounted_price))
admin.py
@admin.register(ProductModel)
class ProductModelAdmin(admin.ModelAdmin):
list_display = ("discounted_price", "discount_in_percentage", "sell_price", "og_price", "name")[::-1]
in the admin panel Add the Product form

in the admin panel table display
