On Tue, Aug 18, 2009 at 11:04 PM, ringemup <ringe...@gmail.com> wrote:
>
> Well, I'm trying to implement parent / child aliases, but I'm running
> into problems with class declaration order because I need to reference
> the Alias class from within the Account class as well as referencing
> Account from Alias for validation purposes -- and not just in
> ForeignKey declarations and such.
>
> Since one will always have to be declared before the other, is there
> any way to do this?


What I would recommend is to drop the ForeignKey in the Account table. You
can always retrieve the set of Aliases for an Account based on the
ForeignKey from Alias to Account. I believe that you will even be able to
access Account.alias_set in your code, though if not you can always get
Alias.objects.filter(Account_id=xx) and for the primary you will be able to
say either Account.alias_set.filter(parent__isnull=True)or
Alias.objects.filter(Account_id=xx).filter(parent__isnull=True)

--~--~---------~--~----~------------~-------~--~----~
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 
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