Hi,

I have a pair of models A and B, where B has a foreign key pointing to
A. I want to ensure that instances of A have at least one (B)
referrer. The obvious way (to me, still learning python and Django)
was to override A's 'save' method, checking for the existence of  at
least one referring B (using B's related_name on the FK field).

However this causes a problem with the Admin app. I'm editing B inline
on the A edit page, and it appears to me that Admin saves the related
object (here, A) before the relating object. So checking for the
existence of B  in A's 'save' doesn't work.

I could just remove B's 'edit_inline' on its FK field, and ensure
manually that at least one B is created for every A. But there must be
a smarter way, Any thoughts?

Cheers,

CB.

--~--~---------~--~----~------------~-------~--~----~
 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?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to