35π
If all you want to do is create a tag cloud, than that data model should be sufficient. I would make one modification:
tags = models.ManyToManyField(Tag,related_name='photos')
That will make reverse lookups in you photo views cleaner to read and easier to remember.
However, I would consider other use cases for your tags. Is a tag cloud the only thing you want to use the tagging for? Is there any meta data that the relationship should contain?
If youβre planning on having millions of rows, then caching is going to be as important as the data model.
Also, to avoid reinventing the wheel, see if anyone else has built a library that serves your purposes: http://www.djangopackages.com/grids/g/tagging/
3π
Handling tags youself could be a hard job.
You can easily use django library. Install it with pip
pip install django-taggit
- [Django]-Is there a way to filter a queryset in the django admin?
- [Django]-Implementing multiple user types with Django 1.5
- [Django]-Override a form in Django admin