Implement the tag inheritance thing

This commit is contained in:
Salt 2025-01-24 15:11:46 -06:00
parent 267740f2ad
commit 5efac79a63
3 changed files with 8 additions and 2 deletions

View File

@ -5,7 +5,7 @@ from .models import OdyseeChannel, OdyseeRelease, Tag
# Register your models here.
@admin.register(OdyseeChannel)
class OdyseeChannelAdmin(admin.ModelAdmin):
list_display = ['name', 'handle', 'description', 'get_tags', 'id']
list_display = ['name', 'handle', 'get_tags', 'description', 'id']
search_fields = ['name', 'description', 'handle']
ordering = ['name']
list_filter = ['tags']

View File

@ -35,3 +35,9 @@ class OdyseeRelease(models.Model):
def __str__(self):
return self.name
@property
def all_tags(self):
self_tags = self.tags.all()
channel_tags = self.channel.tags.all()
return self_tags | channel_tags

View File

@ -11,7 +11,7 @@
<p class="handle">{{ release.channel.handle }}</p>
<p class="description">{{ release.description }}</p>
<div class="tagcontainer">
{% for tag in release.tags.all %}
{% for tag in release.all_tags.all %}
<a class="tag">{{ tag.name }}</a>
{% endfor %}
</div>