I have these kinds of models
class PriceHistory(models.Model):
id_ml = models.ForeignKey(Property, on_delete=models.CASCADE)
price = models.BigIntegerField(null=True)
created = models.DateTimeField(auto_now_add=True)
class Property(SoftDeletionModel)
id_ml= models.CharField(max_length=200, primary_key=True)
city= models.CharField(max_length=200, null=True)
state= models.CharField(max_length=200, null=True)
country= models.CharField(max_length=200, null=True)
I am using this query
results = PriceHistory.objects.filter( id_ml__id_ml = self.id_ml).select_related('id_ml').exclude(price=self.price).order_by('-created').distinct()
I am having a hard time finding a way to filter by class Property where country, state and city are equal to "Argentina" "Buenos Aires" "La Plata" in the previous query
How could I make results print this?
you can do it with
I recommend you to put more descriptive names to the variables, so that you can understand them better. For example I would put