From 30e495504911d0720558a6b307c9cd05a7dbfffb Mon Sep 17 00:00:00 2001 From: Manuel Kaufmann Date: Thu, 5 Sep 2019 16:35:30 +0200 Subject: [PATCH 1/2] Allow to extend DomainCreate view --- readthedocs/projects/views/private.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/readthedocs/projects/views/private.py b/readthedocs/projects/views/private.py index c20d3a088c8..f3471ec24d8 100644 --- a/readthedocs/projects/views/private.py +++ b/readthedocs/projects/views/private.py @@ -30,6 +30,7 @@ from readthedocs.builds.models import Version from readthedocs.core.mixins import ListViewWithForm, LoginRequiredMixin from readthedocs.core.utils import broadcast, trigger_build +from readthedocs.core.utils.extend import SettingsOverrideObject from readthedocs.integrations.models import HttpExchange, Integration from readthedocs.oauth.services import registry from readthedocs.oauth.tasks import attach_webhook @@ -726,10 +727,14 @@ def get_context_data(self, **kwargs): return ctx -class DomainCreate(DomainMixin, CreateView): +class DomainCreateBase(DomainMixin, CreateView): pass +class DomainCreate(SettingsOverrideObject): + _default_class = DomainCreateBase + + class DomainUpdate(DomainMixin, UpdateView): pass From 500f4a2d48b308a752177a57af0d34f35b07b1f9 Mon Sep 17 00:00:00 2001 From: Anthony Johnson Date: Wed, 18 Sep 2019 19:39:25 -0600 Subject: [PATCH 2/2] Also extend view for domain update view We need to inject a number of context data pieces for the template, it's easiest to extend this class. --- readthedocs/projects/views/private.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/readthedocs/projects/views/private.py b/readthedocs/projects/views/private.py index f3471ec24d8..5920fe03c93 100644 --- a/readthedocs/projects/views/private.py +++ b/readthedocs/projects/views/private.py @@ -735,10 +735,14 @@ class DomainCreate(SettingsOverrideObject): _default_class = DomainCreateBase -class DomainUpdate(DomainMixin, UpdateView): +class DomainUpdateBase(DomainMixin, UpdateView): pass +class DomainUpdate(SettingsOverrideObject): + _default_class = DomainUpdateBase + + class DomainDelete(DomainMixin, DeleteView): pass