I'm having two model classes Product and Category, on the one hand the Product class has a ManyToMany field ( product_categories ) which lists all the categories, a product instance may belong to, on the other hand the Category class has the category_slug field. The question is - is there any way to get to the Category.category_slug field from the Product.product_categories field in the following method
@models.permalink
def get_absolute_url(self):
return ('catalog_product', (), {'category_slug' : self.product_categories.category_slug, 'product_slug': self.product_slug}) ( this way of getting to it gives the: AttributeError at /catalog/smartphony/ 'ManyRelatedManager' object has no attribute 'category_slug' )