Django Class-based Forms

Diving into Django’s class-based forms and ran into a common problem with reverse(). As documented here the form takes three parameters – template name, form_class and success_url.

My first instinct was to do the following:

This blows up rather nicely. The solution is rather simple – reverse_lazy():

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s