Example:
class Route(models.Model):
last_waypoint_visited = models.ForeignKey('WayPoint')
class WayPoint(models.Model):
route = models.ForeignKey(Route)
Since WayPoint already has a reference to Route through the route field, I don't really need the field last_waypoint_visited to generate a back reference to Route.
Is it possible do just disable the back reference creation for the "last_waypoint_visited" field?
是的,禁用向后关系是一个记录在案的功能:
last_waypoint_visited = models.ForeignKey('WayPoint', related_name='+')
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.