Thanks for sharing this, I will do the same first.

On Thursday, June 21, 2018 at 5:55:42 PM UTC+5:30, Melvyn Sopacua wrote:
>
> On donderdag 21 juni 2018 11:31:26 CEST prateek gupta wrote:
>
>  
>
> > Thanks for reviewing the code.
>
> > 
>
> > I am new to Django and just tried to put logic from googling to achieve 
> my
>
> > goal.
>
> > That's why I don't understand my code completely.
>
>  
>
> Try to understand it before applying. The main issue you're facing is the 
> difference between class attributes and model fields.
>
>  
>
> A model field is a special class attribute that Django stores in the 
> database. You have to declare them using one of the field types 
> <https://docs.djangoproject.com/en/2.0/ref/models/fields/> that Django 
> supports.
>
> Everything else is not saved in the database.
>
>  
>
> You're using a custom model field 
> <https://docs.djangoproject.com/en/2.0/howto/custom-model-fields/> for 
> the location in your model. Part of that field is that it stores in the 
> lon/lat information for you, so that you don't have to worry about it. What 
> it doesn't provide is a solid way for you to get the location data from the 
> field. As you've figured out, it is stored as a string, which makes it 
> difficult to make queries on lon/lat coordinates.
>
>  
>
> So it's probably not the right tool for the job. But before you go looking 
> for a different package, you should really learn more about Django, for 
> example complete the tutorial and in your case it'll be helpful to go 
> through the GIS tutorial 
> <https://docs.djangoproject.com/en/2.0/ref/contrib/gis/tutorial/> as 
> well. Cause then you'd discover that other then support for Mapbox and 
> Google maps, Django already has built in most of what the DJango Location 
> Field package is offering you.
>
>  
>
> -- 
>
> Melvyn Sopacua
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/dc6fb244-13b7-446c-8a9a-7e4a7c09b122%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to