longclaw
longclaw copied to clipboard
Product Reviews
Product review model & API.
Something along the lines of:
class ProductReview(models.Model):
product = models.ForeignKey('longclawproducts.Product')
rating = models.IntegerField(max=5)
comments = models.CharField(max_length=128)
Couple of question to answer:
- Should it be related to the
Product
model orProductVariant
model? - Should it be created as a separate app (not within longclaw?). Off the top of my head, pros of separate app are; it is in keeping with django philosophy, it keeps longclaw simple. Cons are; it is only usable if longclaw is installed anyway (cause of the foreign key) & a separate app may make setup of the whole longclaw system a bit more confusing to users?
The model of comments is better implemented with the link to the product. Here it is better to use Many-to-one relationships.
Creating a model of comments as a separate application does not make sense. Since comments are required only for one type of interaction with the product.
Do not forget to make the possibility of rating the product. Since not everyone wants to write.