Wednesday, April 16, 2014

Re: Circular import problem

You can use from foo import bar inside your method/class definitions or
you can use import foo.bar.

bg,
Johannes

On 16.04.2014 11:37, Daniel Oźminkowski wrote:
> Hello,
>
> I recently cut my models.py into separate files and now I try to fix all
> the problems with imports that showed up. I hit the wall on this one though.
>
> Purpose of the application is to process a text file with instructions
> and fit them into hierarchical structure like this:
>
> Program <- Node <- Commands
>
> Program has many Nodes, Nodes has many commands.
>
> One of the possible Commands is jumping into subprogram. I want to get
> url of that subprogram, so I can show it in a template.
>
> During analysis Program calls Node to create nodes. Node then calls
> Command to create Commands.
>
> Then later Command takes the id of the subprogram and call
> Program.objects.get().get_absolute_url()
>
> How can I break this import chain?
>
> Best regards,
> Daniel
>
>
> --
> You received this message because you are subscribed to the Google
> Groups "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to django-users+unsubscribe@googlegroups.com
> <mailto:django-users+unsubscribe@googlegroups.com>.
> To post to this group, send email to django-users@googlegroups.com
> <mailto:django-users@googlegroups.com>.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAEW8F8Kv2GJ_f3mvP0mXhhDYj536%2BWwg6YMESd44efBec90Y3w%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAEW8F8Kv2GJ_f3mvP0mXhhDYj536%2BWwg6YMESd44efBec90Y3w%40mail.gmail.com?utm_medium=email&utm_source=footer>.
> For more options, visit https://groups.google.com/d/optout.


--
Johannes Schneider
Webentwicklung
johannes.schneider@galileo-press.de
Tel.: +49.228.42150.xxx

Galileo Press GmbH
Rheinwerkallee 4 - 53227 Bonn - Germany
Tel.: +49.228.42.150.0 (Zentrale) .77 (Fax)
http://www.galileo-press.de/

Geschäftsführer: Tomas Wehren, Ralf Kaulisch, Rainer Kaltenecker
HRB 8363 Amtsgericht Bonn

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/534E5E10.30103%40galileo-press.de.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment