Hi Malcolm, I figured it out. This article is what pointed me in the right direction:
http://www.b-list.org/weblog/2008/nov/09/dynamic-forms/ While you are right that there are a lot of examples in the code of something similar, and that, in theory, I should be able to find the answer to any question by perusing the source code, it doesn't necessarily work for beginners - especially beginners who don't have a strong python background. I am guessing django wants to attract all kinds of developers, even those who are just starting to learn python, am I right? Or maybe not. I'd just like to make one observation. On every page of the django introductory tutorial there is the following at the bottom: Questions/Feedback Having trouble? We'd like to help! * Try the FAQ — it's got answers to many common questions. * Search for information in the archives of the django-users mailing list, or post a question. * Ask a question in the #django IRC channel, or search the IRC logs to see if its been asked before. It sounds so welcoming, but the reality for us beginners is not so rosy. I went in this exact order. Searched the documentation. Couldn't figure it out. Posted a question in the user group - first one wasn't answered. Then tried the IRC chatroom - boy that was a mistake! The general reception I have received is that if you don't know how to do this you have no business being here. RTFM. Now, I'm not talking about you personally because you have been very civil to me and I appreciate that. But I do think this is a general problem in the developer community. I'm a beginner to django/python, but not a beginner to programming, even object-oriented programming. I've learned a few languages and frameworks over the years and my experience has been similar with all of them. I hit some rather, in retrospect, trivial roadblocks in the beginning but once I get over a few humps my understanding accelerates exponentially. But user groups and chat rooms have been, overall, the least helpful - or even demoralizing - tools for me. I really don't think I'm alone, either. Let me just say that I don't jump to these types of resources quickly by any means - its always a last resort. And each time I am hoping there is someone out there who is kind enough to show me a little guidance. But it seems like there is a pretty high threshold for being welcomed into these communities which is certainly not indicated in the very welcoming statement: "Having trouble? We'd like to help." In fact I would say the reception for most beginners is pure hostility. What usually happens for me is by the time I reach the "threshold" of knowledge acceptable for user groups or chat rooms, I tend to not want to go back based on my early experiences. Perhaps it would be helpful to provide some alternative user groups or chat rooms for true beginners? Just an idea. I hope my comments are somewhat constructive, because that is my only intention. Aaron On Jan 29, 12:40 am, Malcolm Tredinnick <malc...@pointy-stick.com> wrote: > On Wed, 2009-01-28 at 05:53 -0800, ajlozier wrote: > > Thank you for responding. > > > Yeah I was starting to figure out just what you're saying, that I > > can't access the functions of a class within the class definition > > itself. This is also true in PHP. In this case, if I were writing in > > PHP I would do something like this: > > > function __construct(){ > > parent::__construct(); //because this is a subclass > > $this->classification = $this->getClassificationTree(); > > } > > > I figured I should probably do a similar thing here using the __init__ > > function, but I have run into numerous problems. It seems I am having > > trouble matching up the exact parameters of the class this one is > > inheriting from. > > I don't understand what this means. Can you be a bit more specific? > > There are examples all over the Django code (including > ModelFormBase.__init__) or __init__ methods calling their parent class's > __init__ method. Search for calls to "super()", which is the standard > way to call the next method in the name resolution order. > > > Believe it or not I can't even seem to find an API > > page explaining all of the parameters, methods and properties of > > ModelForm. > > I have gone back to the source but so far it hasn't helped > > me. > > Then "API documentation" wouldn't really add much value; it would simply > repeat the code, in effect (rewriting everything in English again). We > have documentation describing standard ModelForm usage and we prefer > holistic descriptions to API dumps. The source isn't particularly > complicated: everything inherits from BaseModelForm and the __init__ > method's parameters are named for their purpose and they have the same > names as the parameters in BaseForm. > > Hopefully (and necessarily, really) before diving into creating > derivatives of ModelForm, one has a good general understanding of how > Django Form subclasses work -- that is what parameters like "data" and > "initial" and "error_class" are for. Again, if you have specific > questions, ask. But the ideal way to learn this is to create forms for a > bunch of different cases and then slowly extend and enhance. > > > And I also can't find an example of someone extending ModelForm > > and doing something this complicated - even though its really not that > > complicated. > > Debating whether something's complicated or not is not particularly > productive, so I don't really want to have an opinion here. Once you've > worked it out, it will probably seem straightforward. Based on the > questions you're asking (such as how to call instance methods), though, > it seems like you're still wrestling with learning the language, which > makes this a kind of odd first project to take on. That shouldn't be a > discouragement to continue persisting -- having a non-trivial project as > the driving goal is a good idea -- but it also shouldn't be too > surprising if it does take a fair bit of time. > > Regards, > Malcolm --~--~---------~--~----~------------~-------~--~----~ 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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---