"""Disable iprestriction completely."""

from iprestrict.models import IPGroup, IPRange, Rule


def load_data(**kwargs):
    allow_all()


def allow_all():
    all_group = get_or_create_all_group()

    Rule.objects.all().delete()
    Rule.objects.create(
        ip_group=all_group,
        action='A',
        url_pattern='ALL',
        rank=65536)


def get_or_create_all_group():
    all_group, created = IPGroup.objects.get_or_create(name='ALL', description='Matches ALL IP Addresses')
    if created:
        IPRange.objects.create(
            ip_group=all_group,
            first_ip='0.0.0.0',
            last_ip='255.255.255.255')
        IPRange.objects.create(
            ip_group=all_group,
            first_ip='0:0:0:0:0:0:0:0',
            last_ip='ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff')
    return all_group

@@ -64,16 +64,26 @@
  import 
+RangeBased
 IPGroup,
@@ -412,16 +412,26 @@
 eated = 
+RangeBased
 IPGroup.

Update iprestrict models in initial data