Skip to content

Commit

Permalink
friendlier FeatureFlag admin list
Browse files Browse the repository at this point in the history
  • Loading branch information
aaxelb committed Oct 12, 2023
1 parent fd3969d commit 5a15ece
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions share/admin/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,7 @@ def reset_to_initial(self, request, queryset):
class FeatureFlagAdmin(admin.ModelAdmin):
readonly_fields = ('name',)
search_fields = ('name',)
list_display = ('name', 'is_up', 'is_defined')


admin_site.register(AccessToken, AccessTokenAdmin)
Expand Down
6 changes: 5 additions & 1 deletion share/models/feature_flag.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def _flag_cache_key(self, flag_name) -> str:


class FeatureFlag(models.Model):
# flag name constants:
# flag name constants
ELASTIC_EIGHT_DEFAULT = 'elastic_eight_default'
IGNORE_SHAREV2_INGEST = 'ignore_sharev2_ingest'
SUGGEST_CREATOR_FACET = 'suggest_creator_facet'
Expand All @@ -41,3 +41,7 @@ def __repr__(self):
return f'{self.__class__.__name__}(name="{self.name}", is_up={self.is_up})'

__str__ = __repr__

@property
def is_defined(self):
return self.name.lower() == getattr(FeatureFlag, self.name.upper(), None)

0 comments on commit 5a15ece

Please sign in to comment.