Reputation: 1332
I want to use GeoDjango to get retrieve from the user location point information like city, country, etc.
In order to use GeoDjango I have to install PostGIS
which adds geographic object support to PostgreSQL.
Questions:
PostGIS
on the default database or is a best practice to store location data in different database?django.db.models
and django.contrib.gis.db.models
to make clear difference between GeoDjango fields and the default ones?Example:
from django.db import models
from django.contrib.gis.db import models as geo_models
class Profile(models.Model):
"""
This model extends the `User` model as an One-To-One link.
"""
user = models.OneToOneField(settings.AUTH_USER_MODEL, on_delete=models.CASCADE)
birth_date = models.DateField(null=True, blank=True)
company_name = models.CharField(max_length=100, blank=True)
location = geo_models.PointField()
Upvotes: 0
Views: 616
Reputation: 169032
And I know you didn't ask this, but if possible, it'll simplify things to use a custom user model instead of an one-to-one extension model like you've illustrated.
Upvotes: 3