Re: Advice on disabling validators for Nested serializers

2018-08-18 Thread Xavier Ordoquy
Hi, I wrote about this a while ago. Everything should be explained here: https://medium.com/django-rest-framework/dealing-with-unique-constraints-in-nested-serializers-dade33b831d9 Regards, Xavier O. Linovia. > Le 17 août 2018 à 23:41, Arjun Nambiar a écrit : > > Hi Ryan, > > It is basically

Re: Advice on disabling validators for Nested serializers

2018-08-17 Thread Ryan Kilby
Gotcha, I was assuming that the code was failing at the get_or_create statement, not during validation. Taking a step back, what are you trying to accomplish? Are you trying to create both the IP groups and IP/CIDR instances at the same time, or are you just trying to link/relate the instances

Re: Advice on disabling validators for Nested serializers

2018-08-17 Thread Arjun Nambiar
Hi Ryan, It is basically a serializer validation error stating that "IP already exists" so there is no stack trace. I need to somehow disable unique key validation check for IPs when being used as a nested serializer in IPGroups. On Friday, 17 August 2018 11:31:26 UTC-7, Ryan Kilby wrote: > > H

Re: Advice on disabling validators for Nested serializers

2018-08-17 Thread Arjun Nambiar
Hi Ryan, It is actually just a validation error so there is no stack trace. It says that the "name already exists". I basically just need to disable unique key validation check for IPs when being used as a nested Model serializer. Regards, Arjun On Thursday, 16 August 2018 12:02:02 UTC-7, Arju

Re: Advice on disabling validators for Nested serializers

2018-08-17 Thread Ryan Kilby
Hi Arjun, It would be helpful to see the actual stack trace associated with the error. On Thursday, August 16, 2018 at 12:02:02 PM UTC-7, Arjun Nambiar wrote: > > My models.py > > from django.db import models > from netfields import InetAddressField, CidrAddressField, NetManager > > class IP(mo

Advice on disabling validators for Nested serializers

2018-08-16 Thread Arjun Nambiar
My models.py from django.db import models from netfields import InetAddressField, CidrAddressField, NetManager class IP(models.Model): """ Stores IP Objects """ # name is the reverse lookup of an IP if it exists else it is IP_ name = models.CharField(max_length=50, unique=