Django filtering with ipaddress lib

For example, I got a table with address field which can store both ip and subnet addresses. Called IPTable. And a got entire ip address like '127.0.0.1'

How can i write a query to get data that into subnet?

IPTable.objects.create(address='127.0.0.0/32') IPtable.objects.filter('127.0.0.1' in '127.0.0.0/32')??

Tried to use ipaddress lib to get all ips from this subnet

Back to Top