I was wondering if there a way I can pass two or more variables in a custom manager...there are five variables that come from different views but in the model, I've declared a manager to handle filtering based on one of these variables...I want to have all the variables being considered in the filter query. Is there a way to do this?
class VehicleQuerySet(QuerySet):
def vehicle_query(self, year):
return self.filter(common_vehicle__year__year__exact=year).exclude(status__status='Incoming')
class VehicleManager(models.Manager):
def get_query_set(self):
return VehicleQuerySet(self.model)
def vehicle_query(self, year):
return self.get_query_set().vehicle_query(year)
Then in the view:
vehicle_query = Vehicle.smart_objects.vehicle_query(year)