get_absolute_url() necessary with ModelForm ?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

get_absolute_url() necessary with ModelForm ?

Axel Rau
I’m using a model in 2 apps with different urls.
Subclasing it and overwriting get_absolute_url() did not work,
because it mangled dbtable.
UpdateView does not work with ModelForm w/o get_absolute_url().

Does there any workaround exist?

Thanks, Axel
---
PGP-Key: CDE74120  ☀  computing @ chaos claudius

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/4D941923-AFBE-465D-9A7E-6C07AED208BE%40Chaos1.DE.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: get_absolute_url() necessary with ModelForm ?

Daniel Roseman-2
On Thursday, 4 July 2019 18:45:47 UTC+1, [hidden email] wrote:
I’m using a model in 2 apps with different urls.
Subclasing it and overwriting get_absolute_url() did not work,
because it mangled dbtable.
UpdateView does not work with ModelForm w/o get_absolute_url().

Does there any workaround exist?

Thanks, Axel


UpdateView works perfectly fine without `get_absolute_url()`. It does however need a `success_url` attribute, or a `get_success_url()` method, defined on the view itself.
--
DR.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/af72433f-58c4-4d62-a940-5bc88a5fd391%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: get_absolute_url() necessary with ModelForm ?

Axel Rau

Am 06.07.2019 um 18:28 schrieb Daniel Roseman <[hidden email]>:

On Thursday, 4 July 2019 18:45:47 UTC+1, [hidden email] wrote:
I’m using a model in 2 apps with different urls.
Subclasing it and overwriting get_absolute_url() did not work,
because it mangled dbtable.
UpdateView does not work with ModelForm w/o get_absolute_url().

Does there any workaround exist?

Thanks, Axel


UpdateView works perfectly fine without `get_absolute_url()`. It does however need a `success_url` attribute, or a `get_success_url()` method, defined on the view itself.
--
DR.

This worked perfectly!

Thanks, Axel

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/3B77821C-FC9B-4295-965E-090D4A0EE839%40Chaos1.DE.
For more options, visit https://groups.google.com/d/optout.