On 2/18/06, Rock <[EMAIL PROTECTED]> wrote:

    def _pre_delete( self ):
        articles = articles.get_list(reporter_id__exact=self.id)
        for article in articles:
            article.delete()

The problem is that this won't compile since articles is undefined.
What is the preferred way to deal with this type of forward reference
where the functions in a given class need to call functions defined for
a class that is itself defined later on in the same file?

Postition in a file is irrevalant, your just have to make sure that Article class has been defined before your _pre_delete is called at runtime. In this case it will be, just import articles, and you should be fine.


--
Amit Upadhyay
Blog: http://www.rootshell.be/~upadhyay
+91-9867-359-701
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to