Hi,

I have the following 3 models with one model having a foreign key
reference to another model.

class DeliveryBatch(models.Model):
    delivered_to = models.ForeignKey(Centre)
    ...

class Centre(models.Model):
    is_deleted  = models.BooleanField(default=false)
    ...

class CentreLog(models.Model):
   """contains all attributes of Centre together with
last_modified_time, user and corresponding action."""
    ...

The problem is, a Centre referred to by a DeliveryBatch may get deleted
in the future. Then the foreign key reference of the DeliveryBatch gets
invalid. Django even goes a step further and deletes the corresponding
DeliveryBatch. But this is undesirable.

Our current quick fix is to have a is_deleted flag in the Centre and
overide it's delete() to  set the is_deleted to true. But is there any
way to make the delivered_to point to the corresponding entry in the
CentreLog, which contains all changes to the Centre. We came across
Generic Foreign Keys.. but could n't understand it enough to implement
it. Is it a proper solution for this problem? Or is there any other
method.. (preferably using only the admin interface). Can you please
give some examples?

Thanks
-
Mohan


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---

Reply via email to