Wednesday, April 16, 2014

Circular import problem

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.
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/CAEW8F8Kv2GJ_f3mvP0mXhhDYj536%2BWwg6YMESd44efBec90Y3w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment