[Answered ]-Django ORM for custom python function

1👍

I think what you are looking for is a django model manager here

for example:

class PackageManager(models.Manager)
    def get_package_price(self, package_instance):
        # Get your price

class Package(models.Model):
    objects = PackageManager()
    # Rest of your model

and then you can call it by: Package.objects.get_package_price(package_instance)

👤liam

Leave a comment