Reputation: 2064
I have a simple question. Suppose products with associtaed recommandations. I'd like to get a product recommandation then it's a simple model method (i.e: get_product_recommandation()) but I do not know to put it. In my recommandations models.py or in models.py in the product folder ?
Upvotes: 0
Views: 28
Reputation: 3156
you can make custom querysets or manger to put database query realted function. put model update function in model file.
Upvotes: 0
Reputation: 1902
I'd put it in your models.py in the product app like:
Class Product(models.Model):
...
def get_product_recommandation(self):
return self.recommendation_set.all() # or whatever
Upvotes: 2