Skip to content

Commit

Permalink
Feat: add descriptions to chain features
Browse files Browse the repository at this point in the history
  • Loading branch information
katspaugh committed Nov 21, 2024
1 parent a2e22f0 commit becf74d
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/chains/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,4 @@ class WalletAdmin(admin.ModelAdmin[Wallet]):

@admin.register(Feature)
class FeatureAdmin(admin.ModelAdmin[Feature]):
list_display = ("key",)
list_display = ("key", "description")
20 changes: 20 additions & 0 deletions src/chains/migrations/0045_populate_feature_description.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Generated by Django 5.0.8 on 2024-11-21 12:22

from django.db import migrations

def populate_description(apps, schema_editor):
Feature = apps.get_model('chains', 'Feature')
Feature.objects.filter(description__isnull=True).update(description='')

def reverse_populate_description(apps, schema_editor):
pass

class Migration(migrations.Migration):

dependencies = [
('chains', '0044_chain_beacon_chain_explorer_uri_public_key_template'),
]

operations = [
migrations.RunPython(populate_description, reverse_populate_description),
]
2 changes: 2 additions & 0 deletions src/chains/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,8 @@ class Feature(models.Model):
max_length=255,
help_text="The unique name/key that identifies this feature",
)
description = models.CharField(max_length=255, default="")


def __str__(self) -> str:
return f"Chain Feature: {self.key}"

0 comments on commit becf74d

Please sign in to comment.