madisona/django-google-maps

DjangoREST

Closed this issue · 2 comments

Does it support Django REST?
I don't see anything on this

@elcolie The project itself is simply a couple model fields and widgets to help work with Google Maps. The model fields themselves could be used in a project that used Django REST if you'd like, just like any other model field.

Yes. I understand I can use it like other model field. But I found it is not implement anything else. It just a plain CharField.

class SampleModelSerializer(serializers.ModelSerializer):
    class Meta:
        model = SampleModel
        fields = [
            'address',
            'geolocation',
        ]

I expect dedicated field with validator built-in not CharField without anything else

In [1]: from sample.api.serializers import *
In [2]: SampleModelSerializer()
Out[2]:
SampleModelSerializer():
    address = CharField(max_length=100)
    geolocation = CharField(allow_blank=True, max_length=100, required=False)

But I don't know how to make a GeolocationSerializer class. Therefore I make the PR to you since you know how to make a package.