Make flag appear by default

This commit is contained in:
zandercymatics 2024-12-06 11:27:54 -07:00
parent 33e0c769ab
commit 87a3dee4ed
No known key found for this signature in database
GPG key ID: FF4636ABEC9682B7
2 changed files with 8 additions and 8 deletions

View file

@ -3579,6 +3579,14 @@ class WaffleFlagAdmin(FlagAdmin):
model = models.WaffleFlag model = models.WaffleFlag
fields = "__all__" fields = "__all__"
# Hack to get the dns_prototype_flag to auto populate when you navigate to
# the waffle flag page.
def changelist_view(self, request, extra_context=None):
if extra_context is None:
extra_context = {}
extra_context["dns_prototype_flag"] = flag_is_active_for_user(request.user, "dns_prototype_flag")
return super().changelist_view(request, extra_context=extra_context)
class DomainGroupAdmin(ListHeaderAdmin, ImportExportModelAdmin): class DomainGroupAdmin(ListHeaderAdmin, ImportExportModelAdmin):
list_display = ["name", "portfolio"] list_display = ["name", "portfolio"]

View file

@ -459,15 +459,7 @@ class DomainDNSView(DomainBaseView):
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
"""Adds custom context.""" """Adds custom context."""
context = super().get_context_data(**kwargs) context = super().get_context_data(**kwargs)
object = self.get_object()
context["dns_prototype_flag"] = flag_is_active_for_user(self.request.user, "dns_prototype_flag") context["dns_prototype_flag"] = flag_is_active_for_user(self.request.user, "dns_prototype_flag")
context["is_valid_domain_for_prototype"] = True
x = object.name == "igorville.gov"
print(f"what is the object? {object.name} and equal? {x}")
if settings.IS_PRODUCTION:
context["is_valid_domain_for_prototype"] = object.name == "igorville.gov"
return context return context