Skip to content
Snippets Groups Projects
Verified Commit 6c102a9f authored by Jonathan Weth's avatar Jonathan Weth :keyboard:
Browse files

Merge branch 'master' into 366-customise-django-colorfield-for-use-with-materialize

parents 9307cad1 99aedb0b
No related branches found
No related tags found
1 merge request!473Resolve "Customise django-colorfield for use with Materialize"
...@@ -5,6 +5,7 @@ from typing import Any, Callable, List, Optional, Tuple, Union ...@@ -5,6 +5,7 @@ from typing import Any, Callable, List, Optional, Tuple, Union
from django.conf import settings from django.conf import settings
from django.contrib import messages from django.contrib import messages
from django.contrib.auth.views import LoginView, SuccessURLAllowedHostsMixin
from django.contrib.contenttypes.models import ContentType from django.contrib.contenttypes.models import ContentType
from django.contrib.sites.managers import CurrentSiteManager from django.contrib.sites.managers import CurrentSiteManager
from django.contrib.sites.models import Site from django.contrib.sites.models import Site
...@@ -415,6 +416,13 @@ class SuccessMessageMixin(ModelFormMixin): ...@@ -415,6 +416,13 @@ class SuccessMessageMixin(ModelFormMixin):
return super().form_valid(form) return super().form_valid(form)
class SuccessNextMixin(SuccessURLAllowedHostsMixin):
redirect_field_name = "next"
def get_success_url(self) -> str:
return LoginView.get_redirect_url(self) or super().get_success_url()
class AdvancedCreateView(SuccessMessageMixin, CreateView): class AdvancedCreateView(SuccessMessageMixin, CreateView):
pass pass
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment