Problem example
Let's say you have a model Publication, Photo, Eventand Person; they can relate to each other in different ways. In particular, publications may have 1) some illustrations (related photographs) and 2) some of the persons mentioned. Events may have some 3) photos and 4) also related to people. In addition, 5) events may be mentioned in publications.
No additional data should be associated with relations, except for illustrations: they need a position field for sorting. So, in this case (# 1), it’s normal to go with an intermediate model, for example Illustration, referring to a photo and publication and specifying a position field.
But with cases 2 or 4, this is complicated.
It makes sense to specify, say, ReferencedPersonthat can point to an object of any type (via a common foreign key), so it can be used for both publications and events. On the other hand, you can indicate ReferencedEventwhich can be used in cases 5 and 3, but also in case 4, because you cannot say that this is an event that refers to a person, on the contrary.
So, at some point it becomes insufficient to start thinking about a simple definition of a model ReferencedObjectwith two universal foreign keys. And this is uncool, what tags are for, and if tags can represent other instances of the model, that would be great.
Idea
- , / . namespace:tag=value ( ).
, . Flickr, , , upcoming:event=81334, "".
machinetags django-tagging. , . , , , "" , , .
( .) , ? , Django? ? ?