MCPcopy
hub / github.com/django/django / get_success_url

Method get_success_url

django/views/generic/edit.py:117–129  ·  view source on GitHub ↗

Return the URL to redirect to after processing a valid form.

(self)

Source from the content-addressed store, hash-verified

115 return kwargs
116
117 def get_success_url(self):
118 """Return the URL to redirect to after processing a valid form."""
119 if self.success_url:
120 url = self.success_url.format(**self.object.__dict__)
121 else:
122 try:
123 url = self.object.get_absolute_url()
124 except AttributeError:
125 raise ImproperlyConfigured(
126 "No URL to redirect to. Either provide a url or define"
127 " a get_absolute_url method on the Model."
128 )
129 return url
130
131 def form_valid(self, form):
132 """If the form is valid, save the associated model."""

Callers

nothing calls this directly

Calls 3

formatMethod · 0.45
get_absolute_urlMethod · 0.45

Tested by

no test coverage detected