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.
|
# Register your models here.
|
||||||
@admin.register(OdyseeChannel)
|
@admin.register(OdyseeChannel)
|
||||||
class OdyseeChannelAdmin(admin.ModelAdmin):
|
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']
|
search_fields = ['name', 'description', 'handle']
|
||||||
ordering = ['name']
|
ordering = ['name']
|
||||||
list_filter = ['tags']
|
list_filter = ['tags']
|
||||||
|
@ -35,3 +35,9 @@ class OdyseeRelease(models.Model):
|
|||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return self.name
|
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="handle">{{ release.channel.handle }}</p>
|
||||||
<p class="description">{{ release.description }}</p>
|
<p class="description">{{ release.description }}</p>
|
||||||
<div class="tagcontainer">
|
<div class="tagcontainer">
|
||||||
{% for tag in release.tags.all %}
|
{% for tag in release.all_tags.all %}
|
||||||
<a class="tag">{{ tag.name }}</a>
|
<a class="tag">{{ tag.name }}</a>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user