[Answer]-Django object has no attribute 'all'

1👍

You should use a different approach for your relationships. The way I see your code you should have a ManytoMany relationship since one product may belongs to N categories and one category may have N products attached to it.

Check this ManyToManyField

Anyway try to change this in your Product model:

categories = models.ManyToManyField(Category, null=True)

Leave a comment