Re: circular import in two models.py

2010-03-10 Thread rebus_
On 10 March 2010 11:31, Viktor  wrote:
> Hi,
>
> I have two django applications, an issue tracker where an Issue is
> related to a Partner
> and a Partner model where partners can be grouped, etc
> I would like to add an issue to every group to provide an easy
> messaging for groups, so I don't have to write the message sending
> logic again
>
> could someone give me some ideas how can I cross-connect the two apps,
> but save them as seemingly separate?
> by seemingly separate I mean that I can change the Partner models by
> simply writing
>
>    from app.models import Partner1 as Parner
>
> instead of
>
>    from app.models import Partner2 as Parner
>
> in the messaging app
>
> thanks,
> Viktor
>
> --
> 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.
>
>

Instead of giving a class try giving a string in format 'myapp.MyModelName'.

class Foo(models.Model):
  bar = models.ForeignKey('myapp.MyModelName')

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



circular import in two models.py

2010-03-10 Thread Viktor
Hi,

I have two django applications, an issue tracker where an Issue is
related to a Partner
and a Partner model where partners can be grouped, etc
I would like to add an issue to every group to provide an easy
messaging for groups, so I don't have to write the message sending
logic again

could someone give me some ideas how can I cross-connect the two apps,
but save them as seemingly separate?
by seemingly separate I mean that I can change the Partner models by
simply writing

from app.models import Partner1 as Parner

instead of

from app.models import Partner2 as Parner

in the messaging app

thanks,
Viktor

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