Iām trying to implement a geoprocessing for a truck fleet. I need to associate a border list with a vehicle. In addition, one of the requirements is everything, even when it is removed for audit purposes. Therefore, we must implement soft removal in everything. This is where the problem lies. My many field does not correspond to the soft deletion manager, it includes both active and inactive entries in the search dataset.
class Vehicle(SoftDeleteModel): routes = models.ManyToManyField('RouteBoundary', through='VehicleBoundaryMap', verbose_name=_('routes'), limit_choices_to={'active': True}) class VehicleBoundaryMap(SoftDeleteModel): vehicle = models.ForeignKey(Vehicle, verbose_name="vehicle") route_boundary = models.ForeignKey(RouteBoundary, verbose_name="route boundary")
As you see above, I tried to make sure that the default manager is the soft deletion manager (i.e. the filter is only for active records), and also try to use limit limit_choices_to, but this goes beyond the foreign model, the model I wanted . If you have any suggestions or recommendations that I would like to hear from you.
Thanks!
Du D. source share