File tree 1 file changed +3
-2
lines changed
1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change 2
2
3
3
class DNSValidator (CustomValidator ):
4
4
def validate (self , instance ):
5
- print (instance )
6
5
from netbox_dns .models import Record , RecordTypeChoices
6
+ from django .contrib import messages
7
+ messages .info (self .request , instance )
7
8
if instance .type == RecordTypeChoices .AAAA :
8
9
records = Record .objects .filter (name = instance .name , zone = instance .zone , type = RecordTypeChoices .A )
9
10
if records .exists () and records [0 ].ipam_ip_address .assigned_object_id != instance .ipam_ip_address .assigned_object_id :
@@ -23,7 +24,7 @@ def validate(self, instance):
23
24
if records .exists ():
24
25
self .fail ("Record for this name in this zone already exists!" , field = 'name' )
25
26
records = Record .objects .filter (name = instance .name , zone = instance .zone , type = instance .type )
26
- print ( records )
27
+ messages . info ( self . request , records )
27
28
if records .exists ():
28
29
self .fail ("Record of given type for this name in this zone already exists!" , field = 'name' )
29
30
You can’t perform that action at this time.
0 commit comments