Minor presentation improvements in the admin UI
This commit is contained in:
parent
93918cf6c2
commit
274bda8170
@ -11,11 +11,15 @@ class OdyseeChannelAdmin(admin.ModelAdmin):
|
||||
|
||||
@admin.register(OdyseeRelease)
|
||||
class OdyseeReleaseAdmin(admin.ModelAdmin):
|
||||
list_display = ['name', 'channel', 'released', 'filehash', 'id']
|
||||
list_display = ['name', 'channel', 'released', 'get_tags', 'filehash', 'id']
|
||||
search_fields = ['name', 'url', 'filehash']
|
||||
ordering = ['channel', 'name', 'released']
|
||||
list_filter = ['channel', 'tags', 'released']
|
||||
|
||||
def get_tags(self, obj):
|
||||
return ", ".join([str(tag) for tag in obj.tags.all()])
|
||||
get_tags.short_description = "Tags"
|
||||
|
||||
@admin.register(Tag)
|
||||
class TagAdmin(admin.ModelAdmin):
|
||||
list_display = ['name', 'description', 'id']
|
||||
|
@ -0,0 +1,95 @@
|
||||
# Generated by Django 5.1.5 on 2025-01-24 20:24
|
||||
|
||||
import django.db.models.deletion
|
||||
import uuid
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('odyseescraper', '0007_odyseerelease_filehash'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='odyseechannel',
|
||||
name='description',
|
||||
field=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.'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='odyseechannel',
|
||||
name='handle',
|
||||
field=models.CharField(help_text='The @tag of the user. May be a short tag (@someuser) or qualified with claimid (@someuser:4ab8)', max_length=1024),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='odyseechannel',
|
||||
name='id',
|
||||
field=models.UUIDField(db_index=True, default=uuid.uuid4, editable=False, help_text='A unique identifier for this channel', primary_key=True, serialize=False),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='odyseechannel',
|
||||
name='name',
|
||||
field=models.CharField(help_text="The human-readable name of the channel. Does not, and often will not, necessarily correlate with the channel's handle", max_length=1024),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='odyseerelease',
|
||||
name='channel',
|
||||
field=models.ForeignKey(help_text='The channel that this release came from', on_delete=django.db.models.deletion.CASCADE, to='odyseescraper.odyseechannel'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='odyseerelease',
|
||||
name='description',
|
||||
field=models.TextField(help_text='A user-facing description of this release. This should mirror the official post from Odysee, if available'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='odyseerelease',
|
||||
name='filehash',
|
||||
field=models.CharField(help_text='The hash of the file of the claim', max_length=512),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='odyseerelease',
|
||||
name='id',
|
||||
field=models.CharField(db_index=True, default=uuid.uuid4, editable=False, help_text='A unique identifier for this release. Usually the LBRY claim ID, if available', max_length=512, primary_key=True, serialize=False),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='odyseerelease',
|
||||
name='name',
|
||||
field=models.CharField(help_text='The human-readable name of this release', max_length=1024),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='odyseerelease',
|
||||
name='released',
|
||||
field=models.DateField(help_text='The date that this release was posted in UTC'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='odyseerelease',
|
||||
name='tags',
|
||||
field=models.ManyToManyField(help_text="A list of tags associated with this release. This should NOT contain extraneous tags from Odysee -- it's a data structure specific to this site.", to='odyseescraper.tag'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='odyseerelease',
|
||||
name='thumbnail',
|
||||
field=models.URLField(help_text='The URL to the Odysee-hosted thumbnail of the release', max_length=512),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='odyseerelease',
|
||||
name='url',
|
||||
field=models.URLField(help_text='The URL to the Odysee page where the release can be downloaded. It is NOT a direct download link', max_length=512),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='tag',
|
||||
name='description',
|
||||
field=models.TextField(help_text='A user-facing description of the tag'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='tag',
|
||||
name='id',
|
||||
field=models.CharField(db_index=True, default=uuid.uuid4, editable=False, help_text='A unique identifier for this tag', max_length=512, primary_key=True, serialize=False),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='tag',
|
||||
name='name',
|
||||
field=models.CharField(help_text='The name for this tag as it should be displayed across UIs', max_length=256),
|
||||
),
|
||||
]
|
@ -3,34 +3,34 @@ from django.db import models
|
||||
from . import odysee
|
||||
|
||||
class Tag(models.Model):
|
||||
id = models.CharField(primary_key=True, max_length=512, default=uuid.uuid4, editable=False, db_index=True)
|
||||
name = models.CharField(max_length=256)
|
||||
description = models.TextField()
|
||||
id = models.CharField(primary_key=True, max_length=512, default=uuid.uuid4, editable=False, db_index=True, help_text="A unique identifier for this tag")
|
||||
name = models.CharField(max_length=256, help_text="The name for this tag as it should be displayed across UIs")
|
||||
description = models.TextField(help_text="A user-facing description of the tag")
|
||||
|
||||
def __str__(self):
|
||||
return self.name
|
||||
|
||||
class OdyseeChannel(models.Model):
|
||||
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False, db_index=True)
|
||||
name = models.CharField(max_length=1024)
|
||||
description = models.TextField()
|
||||
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)
|
||||
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)")
|
||||
|
||||
def __str__(self):
|
||||
return self.name
|
||||
|
||||
class OdyseeRelease(models.Model):
|
||||
id = models.CharField(primary_key=True, max_length=512, default=uuid.uuid4, editable=False, db_index=True)
|
||||
channel = models.ForeignKey(OdyseeChannel, on_delete=models.CASCADE, db_index=True)
|
||||
name = models.CharField(max_length=1024)
|
||||
description = models.TextField()
|
||||
released = models.DateField()
|
||||
url = models.URLField(max_length=512)
|
||||
thumbnail = models.URLField(max_length=512)
|
||||
filehash = models.CharField(max_length=512)
|
||||
id = models.CharField(primary_key=True, max_length=512, default=uuid.uuid4, editable=False, db_index=True, help_text="A unique identifier for this release. Usually the LBRY claim ID, if available")
|
||||
channel = models.ForeignKey(OdyseeChannel, on_delete=models.CASCADE, db_index=True, help_text="The channel that this release came from")
|
||||
name = models.CharField(max_length=1024, help_text="The human-readable name of this release")
|
||||
description = models.TextField(help_text="A user-facing description of this release. This should mirror the official post from Odysee, if available")
|
||||
released = models.DateField(help_text="The date that this release was posted in UTC")
|
||||
url = models.URLField(max_length=512, help_text="The URL to the Odysee page where the release can be downloaded. It is NOT a direct download link")
|
||||
thumbnail = models.URLField(max_length=512, help_text="The URL to the Odysee-hosted thumbnail of the release")
|
||||
filehash = models.CharField(max_length=512, help_text="The hash of the file of the claim")
|
||||
|
||||
tags = models.ManyToManyField(Tag)
|
||||
tags = models.ManyToManyField(Tag, help_text="A list of tags associated with this release. This should NOT contain extraneous tags from Odysee -- it's a data structure specific to this site.")
|
||||
|
||||
def __str__(self):
|
||||
return self.name
|
||||
|
Loading…
x
Reference in New Issue
Block a user