On Feb 18, 2009, at 11:33 AM, Thomas Hill wrote:
> Ah, yes, indeed. Will definately do that, thanks. Regarding the > formset classes and form classes with their try/except lines, > however, does that look "right"? Ah ok. I must have completely overlooked that. You seem to be solving things in the wrong way. You check for existence in kwargs in ResourceRoleForm.__init__. However, a better way to approach this is to use the optional argument to pop which handles the "default" case (or when the key does not exist). Then when the values are needed test there for the correct value. So as a quick example: self.resource = kwargs.pop("resource", None) This enables you to remove the if in kwargs checks and the AttributeError catching. Also in ResourceRoleForm.__init__ you no longer have to check for existence similar to ResourceRoleForm.__init__ after this slight modification. Then you can simply check for None and deal with the fields attributes that way. Brian Rosner http://oebfare.com --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---