Re: UniqueTogetherValidator model serializer or model viewset logic for custom "lat-long" django model field with pre-save method

2017-03-23 Thread Mark Mikofski
Got it. That makes sense. Thanks! here's the traceback for the case where the field is excluded, so the validator is empty and so the integrity error exception never gets handled and the response is 500. http://pastebin.com/UgvJBug2 DRF is v3.3.3, django is v1.8.5 On Thursday, March 23, 2017

Re: UniqueTogetherValidator model serializer or model viewset logic for custom "lat-long" django model field with pre-save method

2017-03-23 Thread Xavier Ordoquy
> Le 24 mars 2017 à 02:00, Mark Mikofski a écrit : > > Hi Xavier, > > Thanks for your quick reply. I had to rush off and I didn't get to finish the > post. Sorry! > > Yes, I can make model objects and save them to the database using w = > Weather(latitude=x, longitude=y, header="blah", datat

Re: UniqueTogetherValidator model serializer or model viewset logic for custom "lat-long" django model field with pre-save method

2017-03-23 Thread Mark Mikofski
Hi Xavier, Thanks for your quick reply. I had to rush off and I didn't get to finish the post. Sorry! Yes, I can make model objects and save them to the database using w = Weather(latitude=x, longitude=y, header="blah", datatype=3) and w.save(). The issue only occurs when I test the unique tog

Re: UniqueTogetherValidator model serializer or model viewset logic for custom "lat-long" django model field with pre-save method

2017-03-23 Thread Xavier Ordoquy
Hi, I’m definitively not sure about that too. Could you try to create a Weather instance as Weather.objects.create(latitude=xx, longitude=xx) and see if it works and set correctly automatically the latlong value, then it’s likely a DRF issue. Otherwise, you may want to discuss that on the django

UniqueTogetherValidator model serializer or model viewset logic for custom "lat-long" django model field with pre-save method

2017-03-23 Thread Mark Mikofski
Hi, I have a Django (1.8.5) model with a custom field that calls pre-save() to evaluate the field from other model fields: class LatLongField(models.CharField): """ Custom field class based on :class:`~django.db.models.CharField` that creates a string field from the site coordinates.