File tree Expand file tree Collapse file tree 2 files changed +5
-4
lines changed Expand file tree Collapse file tree 2 files changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -92,10 +92,6 @@ def form_class(self):
92
92
class MACAddressField (models .Field ):
93
93
description = "PostgreSQL MACADDR field"
94
94
95
- def __init__ (self , * args , ** kwargs ):
96
- kwargs ['max_length' ] = 17
97
- super (MACAddressField , self ).__init__ (* args , ** kwargs )
98
-
99
95
def db_type (self , connection ):
100
96
return 'macaddr'
101
97
Original file line number Diff line number Diff line change @@ -84,3 +84,8 @@ def to_python(self, value):
84
84
return EUI (value , dialect = mac_unix_common )
85
85
except (AddrFormatError , TypeError ):
86
86
raise ValidationError (self .error_messages ['invalid' ])
87
+
88
+ def widget_attrs (self , widget ):
89
+ attrs = super (MACAddressFormField , self ).widget_attrs (widget )
90
+ attrs .update ({'maxlength' : '17' })
91
+ return attrs
You can’t perform that action at this time.
0 commit comments