Implement the tag inheritance thing
This commit is contained in:
parent
267740f2ad
commit
5efac79a63
@ -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']
|
||||
|
@ -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
|
||||
|
@ -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>
|
||||
|
Loading…
x
Reference in New Issue
Block a user