I'm working on tracking changes and am running into trouble with the
many-to-many fields. I can straightforwardly track and edit one-to-one
fields, and many-to-one, and they behave straightforwardly. However, when I
try to do a many-to-many field, the present issue I'm running into is that I
save an Entity instance in the EditTrail, and when I read it, it is a Tag,
and I'm really not sure how my code could be reassigning it to an unrelated
class. I'm wondering if I've misunderstood the semantics for generic foreign
keys and am trying to push two widgets into a one widget slot.

The model is:

class EditTrail(models.Model):
    change_set = models.IntegerField()
    change_type = models.CharField(max_length = 1, choices = EDIT_CHOICES)
    content_object = generic.GenericForeignKey(u'content_type',
u'object_id')
    content_type = models.ForeignKey(ContentType)
    field_name = models.TextField(null = True, blank = True)
    foreign_key_added = generic.GenericForeignKey()
    foreign_key_deleted = generic.GenericForeignKey()
    in_effect = models.BooleanField()
    instance = generic.GenericForeignKey()
    object_id = models.PositiveIntegerField()
    session = models.TextField(null = True, blank = True)
    text_after = models.TextField(null = True, blank = True)
    text_before = models.TextField(null = True, blank = True)
    timestamp = models.DateTimeField(default = datetime.datetime.now, blank
=   True)
    username = models.TextField(null = True, blank = True)
    def format_timestamp(self):
        return directory.functions.format_timestamp(self.timestamp)


Any comments on how either I am misunderstanding how to use
GenericForeignKeys, or how I might otherwise be clobbering one model type
with another?

-- 
[image: Christos Jonathan Hayward] <http://jonathanscorner.com/>
Christos Jonathan Hayward, an Orthodox Christian author.

Author Bio <http://jonathanscorner.com/author/> • Books<http://cjshayward.com/>
 • *Email <christos.jonathan.hayw...@gmail.com>* •
Facebook<http://www.facebook.com/christos.jonathan.hayward>
 • LinkedIn <http://www.linkedin.com/in/jonathanhayward> •
Twitter<http://twitter.com/JonathansCorner>
 • *Web <http://jonathanscorner.com/>* • What's
New?<http://jonathanscorner.com/>
I invite you to visit my "theology, literature, and other creative works"
site.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to