My solution was

urlpatterns += patterns('',
    url(r'^my_wizard/$', login_required(MyWizard().__call__),
name='my_wizard'),
)

On 2 окт, 18:11, JimR <[email protected]> wrote:
> After much searching, I found the answer that I was looking for -
> using the login_required decorator directly in the URLconf, then
> adding a subclass of __name__ to the FormWizard class.
>
>  (r'^contact/$', login_required(ContactFormWizard([ContactFormPartOne,
> ContactFormPartTwo])))
>
> but since it complains it can't find the __name__ attribute since it's
> a class, add the following method to the FormWizard subclass:
>
> def __name__(self):
>       """When using decorators, Django tries to get the name of the
> function and since we're a class, we'll fail. So add this method to
> compensate."""
>      return 'OrderFormWizard'
>
> On Sep 30, 8:04 am, JimR <[email protected]> wrote:
>
>
>
> > OK, so I've searched the group and the Internet looking for the answer
> > to this questions, and the common answer seems to be "wrap theformwizardin 
> > a view."  But I don't see any examples of how to do
> > this.  I currently have theformwizardembedded in the URLconf, and my
> > attempt at "wrapping theformwizardin a view" still enables a user to
> > directly access that URL without first logging in.  Can someone post
> > an example of "wrapping aformwizardin a view" that would require a
> > user to login before getting to those forms?
>
> > Another question - Is there a way to add a "login required" setting to
> > a URL pattern
>
> > Here's what I've done:
>
> > URLconf:
> > ...
> > (r'^(?P<org_id>\d+)/register_player/$',RegistrationWizard
> > ([PlayerInfoForm, SportForm, UniformForm, AddressForm, VolunteerForm,
> > InsuranceForm, PaymentTypeForm])),
>
> > (r'^(?P<org_id>\d+)/signup/$', 'wagdogs.registration.views.signup'),
> > ...
>
> > View:
> > @login_required()
> > def signup(request, org_id):
> >         return HttpResponseRedirect('/registration/%s/register_player/' %
> > org_id)
>
> > Thanks,
> > Jim
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to