We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 10e97f1 commit 4d3fb52Copy full SHA for 4d3fb52
mirrors/fields.py
@@ -3,7 +3,12 @@
3
from django.core.exceptions import ValidationError
4
from django.db import models
5
6
-from ipaddress import ip_address as IP
+from ipaddress import ip_address, ip_interface
7
+
8
+def IP(address):
9
+ if '/' not in address:
10
+ return ip_address(address)
11
+ return ip_interface(address)
12
13
class IPNetworkFormField(forms.Field):
14
def to_python(self, value):
0 commit comments