I have the following model, Which is new:
from django.db import models
class Point(models.Model):
latitude = models.FloatField(verbose_name="Latitude",
blank=False)
longitude = models.FloatField(verbose_name="Longitude",
blank=False)
elevation = models.FloatField(verbose_name="Location's Elevation",
blank=True)
class Location(Point):
created_by = models.ForeignKey(User, on_delete=models.DO_NOTHING, blank=True, null=True, related_name='create')
location_name = models.TextField(verbose_name="Location Name",
blank=False,
unique=True,)
location_info = models.ForeignKey(Point,
related_query_name='new_location',
on_delete=models.CASCADE,
blank=False,
)
I ran makemigrations and migrate and didn't ran into any errors. when running the server I got the following error:
ProgrammingError at /points/
column NewLocationModel_location.point_ptr_id does not exist
LINE 1: ...location" INNER JOIN "NewLocationModel_point" ON ("NewLocati...
The error message indicates the column does not exist.
column NewLocationModel_location.point_ptr_id does not exist
Make sure you are using the correct database...
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.