Add tags to authors
This commit is contained in:
parent
4af9b96bb7
commit
267740f2ad
@ -5,9 +5,14 @@ from .models import OdyseeChannel, OdyseeRelease, Tag
|
||||
# Register your models here.
|
||||
@admin.register(OdyseeChannel)
|
||||
class OdyseeChannelAdmin(admin.ModelAdmin):
|
||||
list_display = ['name', 'handle', 'description', 'id']
|
||||
list_display = ['name', 'handle', 'description', 'get_tags', 'id']
|
||||
search_fields = ['name', 'description', 'handle']
|
||||
ordering = ['name']
|
||||
list_filter = ['tags']
|
||||
|
||||
def get_tags(self, obj):
|
||||
return ", ".join([str(tag) for tag in obj.tags.all()])
|
||||
get_tags.short_description = "Tags"
|
||||
|
||||
@admin.register(OdyseeRelease)
|
||||
class OdyseeReleaseAdmin(admin.ModelAdmin):
|
||||
|
18
odyseescraper/migrations/0010_odyseechannel_tags.py
Normal file
18
odyseescraper/migrations/0010_odyseechannel_tags.py
Normal file
@ -0,0 +1,18 @@
|
||||
# Generated by Django 5.1.5 on 2025-01-24 21:07
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('odyseescraper', '0009_alter_odyseerelease_tags'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='odyseechannel',
|
||||
name='tags',
|
||||
field=models.ManyToManyField(help_text='A list of tags associated with this channel. When queried, any release from this channel will inherit its tags.', related_name='channels', to='odyseescraper.tag'),
|
||||
),
|
||||
]
|
@ -14,9 +14,10 @@ class OdyseeChannel(models.Model):
|
||||
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False, db_index=True, help_text="A unique identifier for this channel")
|
||||
name = models.CharField(max_length=1024, help_text="The human-readable name of the channel. Does not, and often will not, necessarily correlate with the channel's handle")
|
||||
description = models.TextField(help_text="A user-facing description of the channel, its owners, and its content. May also contain links to related resources and websites.")
|
||||
|
||||
handle = models.CharField(max_length=1024, help_text="The @tag of the user. May be a short tag (@someuser) or qualified with claimid (@someuser:4ab8)")
|
||||
|
||||
tags = models.ManyToManyField(Tag, related_name="channels", help_text="A list of tags associated with this channel. When queried, any release from this channel will inherit its tags.")
|
||||
|
||||
def __str__(self):
|
||||
return self.name
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user