I tried to create a model "Tag Container" that stores tags. Then i tried to connect such a container with OneToOneFields to the model where i need it:
from tagging.fields import TagFields
class TagContainer(models.Model):
tags=TagFields
class UserProfile(models.Model):
cont1=models.OneToOneField(TagContainer,related_name="cont1",null=True,blank=True)
cont2=models.OneToOneField(TagContainer,related_name="cont2",null=True,blank=True)
After doing so i had some of the behaviour i wanted: When assigning a TagContainer to a models cont1 and trying to assign the same container to another models cont1 that didn't work. But when i try to assign the same TagContainer to cont1 and cont2 of the same model, that works. That same behaviour is occuring when i try to use ForeignKeys with unique=True.
I am not able to ensure that the fields in an instance of UserProfile point to two different instances of TagContainer. Is that possible?
edit:
Just found out that i can assign each TagContainer one time to cont1 and one time to cont2. It doesn't matter if it is of the same UserProfile.