Recently, I tried to add multiple decorators to FormPreview http://docs.djangoproject.com/en/dev/ref/contrib/formtools/form-preview/
The only documented examples of how to accomplish this I could find were here... http://scompt.com/archives/2007/11/07/using-djangos-formpreview-with-login_required The 3rd example is the cleanest and would be ideal. However, using trunk at rev 9550, I presumed that something had changed in the year since the post because this no longer worked. The FormPreview source warns about overriding its methods, but in my case I had to do so. In doing that, I was able to use this approach to accomplish what I needed to get done. So I submit this example in both the hope that someone else finds it useful, and also so if someone else has a cleaner example of how to accomplish the same task I can benefit from it. class OrgEmailM2FormPreview(FormPreview): form_template = 'groups/email_group.html' preview_template = 'groups/email_group_preview.html' temp_data = {} def parse_params(self, *args, **kwargs): ... ... def preview_get(self, request): # this is a hack to get a permissions check inside this class @login_required @has_org_permission({'manage_member_write':True,}) @session_org_selected def perm_check_here(request): pass response = perm_check_here(request) if response != None: return response return render_to_response(self.form_template, ############# in my case, i have some custom permission checking done with a decorator that bounces you to another location in the event you fail the check. i realized right away that using a lambda could reduce this code a bit. the verbosity of the rest of it is primarily for readability. anyway, hope someone finds it useful. since i could not find much in the way of examples on the topic out there, it seemed like i should do my part and make a post. thanks.. and I love Django! --~--~---------~--~----~------------~-------~--~----~ 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?hl=en -~----------~----~----~----~------~----~------~--~---