Well this is more of a python question I guess, but here goes.
Let's say that I am using the example model from
<a
href="http://www.djangoproject.com/documentation/models/many_to_one/";>this
page in the documentation</a>.

I decide to add a _pre_delete function to class Reporter that will
delete any articles for that Reporter before the Reporter is deleted.
Something like this...

    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?


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