Workin on adding tags and templates, promote odyseescraper app to index
This commit is contained in:
parent
2e520560ff
commit
287a9329f5
@ -19,6 +19,6 @@ from django.urls import include, path
|
||||
from odyseescraper.views import OdyseeReleaseListView
|
||||
|
||||
urlpatterns = [
|
||||
path('odysee/', include("odyseescraper.urls")),
|
||||
path('', include("odyseescraper.urls")),
|
||||
path('admin/', admin.site.urls),
|
||||
]
|
||||
|
@ -1,8 +1,8 @@
|
||||
from django.contrib import admin
|
||||
|
||||
from .models import OdyseeChannel, OdyseeRelease
|
||||
|
||||
admin.site.register(OdyseeChannel)
|
||||
admin.site.register(OdyseeRelease)
|
||||
from .models import OdyseeChannel, OdyseeRelease, Tag
|
||||
|
||||
# Register your models here.
|
||||
admin.site.register(OdyseeChannel)
|
||||
admin.site.register(OdyseeRelease)
|
||||
admin.site.register(Tag)
|
||||
|
@ -0,0 +1,37 @@
|
||||
# Generated by Django 5.1.5 on 2025-01-24 02:02
|
||||
|
||||
import uuid
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('odyseescraper', '0003_odyseerelease_thumbnail'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='Tag',
|
||||
fields=[
|
||||
('id', models.CharField(db_index=True, default=uuid.uuid4, editable=False, max_length=512, primary_key=True, serialize=False)),
|
||||
('name', models.CharField(max_length=256)),
|
||||
('description', models.TextField()),
|
||||
],
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='odyseechannel',
|
||||
name='id',
|
||||
field=models.UUIDField(db_index=True, default=uuid.uuid4, editable=False, primary_key=True, serialize=False),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='odyseerelease',
|
||||
name='id',
|
||||
field=models.CharField(db_index=True, default=uuid.uuid4, editable=False, max_length=512, primary_key=True, serialize=False),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='odyseerelease',
|
||||
name='tags',
|
||||
field=models.ManyToManyField(to='odyseescraper.tag'),
|
||||
),
|
||||
]
|
@ -2,8 +2,13 @@ import uuid
|
||||
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()
|
||||
|
||||
class OdyseeChannel(models.Model):
|
||||
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
|
||||
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False, db_index=True)
|
||||
name = models.CharField(max_length=1024)
|
||||
handle = models.CharField(max_length=1024)
|
||||
|
||||
@ -28,9 +33,11 @@ class OdyseeChannel(models.Model):
|
||||
return
|
||||
|
||||
class OdyseeRelease(models.Model):
|
||||
id = models.CharField(primary_key=True, max_length=512, default=uuid.uuid4, editable=False)
|
||||
channel = models.ForeignKey(OdyseeChannel, on_delete=models.CASCADE)
|
||||
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()
|
||||
url = models.URLField(max_length=512)
|
||||
thumbnail = models.URLField(max_length=512)
|
||||
|
||||
tags = models.ManyToManyField(Tag)
|
||||
|
15
odyseescraper/templates/channel_list.html
Normal file
15
odyseescraper/templates/channel_list.html
Normal file
@ -0,0 +1,15 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block content %}
|
||||
<h1>Channels</h1>
|
||||
<p>If you'd like to browse all releases, click <a href="{% url "allreleases" %}">here</a>.</p>
|
||||
<div class="cardcontainer widecardcontainer">
|
||||
{% for channel in object_list %}
|
||||
<div class="card">
|
||||
<img src="{{ channel.thumbnail }}" class="cardthumbnail" />
|
||||
<a href="https://odysee.com/{{ channel.handle }}"><h2>{{ channel.name }}</h2></a>
|
||||
<p class="description">{{ channel.handle }}</p>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endblock content %}
|
@ -4,5 +4,6 @@ from django.urls import path
|
||||
from . import views
|
||||
|
||||
urlpatterns = [
|
||||
path("", views.OdyseeReleaseListView.as_view(), name="index"),
|
||||
path("", views.OdyseeChannelListView.as_view(), name="channels"),
|
||||
path("allreleases", views.OdyseeReleaseListView.as_view(), name="allreleases"),
|
||||
]
|
||||
|
@ -6,3 +6,7 @@ from odyseescraper.models import OdyseeChannel, OdyseeRelease
|
||||
class OdyseeReleaseListView(ListView):
|
||||
model = OdyseeRelease
|
||||
template_name = 'release_list.html'
|
||||
|
||||
class OdyseeChannelListView(ListView):
|
||||
model = OdyseeChannel
|
||||
template_name = 'channel_list.html'
|
||||
|
@ -60,6 +60,9 @@ div.cardcontainer {
|
||||
grid-gap: 1em;
|
||||
grid-template-columns: 1fr 1fr 1fr;
|
||||
}
|
||||
div.widecardcontainer {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
div.cardcontainer div.card {
|
||||
background: var(--background-bright);
|
||||
border-radius: 8px;
|
||||
|
Loading…
x
Reference in New Issue
Block a user