I have an class that I created which takes a queryset, and a field on
the model that the queryset represents. Like this:

mc = MyClass(queryset=MyModel.objects.all(), lat_lng_field='lat_lng')

The class basically filters the queryset based on some geographical
values, but in order to do that, it needs to know which field the
coordinates are stored in.

Right now I have no choice but require you to pass in a string
representing the field name. But I think a better way would be to do
it kind of like this:

class MyModel(models.Model):
    lat_lng = PointField()
    name = CharFIeld(max_length=20)

    class Meta:
        verbose_name_plural = 'My Models'
        lat_lng_field = 'lat_lng'

Then just modify MyClass to get the field name from the Model's Meta
class. Is this possible somehow? If not, whats the best way to go
about this without having to pass in the field name directly?

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.


Reply via email to