add 'url' to tracked content

This commit is contained in:
Corban-Lee Jones 2024-06-11 20:59:41 +01:00
parent 043e27d247
commit 2b2cd26bb2
24 changed files with 82 additions and 519 deletions

View File

@ -1,4 +1,4 @@
# Generated by Django 5.0.1 on 2024-04-24 11:03
# Generated by Django 5.0.4 on 2024-06-11 13:58
import django.db.models.deletion
import django.utils.timezone
@ -15,6 +15,49 @@ class Migration(migrations.Migration):
]
operations = [
migrations.CreateModel(
name='Filter',
fields=[
('id', models.AutoField(primary_key=True, serialize=False)),
('name', models.CharField(max_length=32)),
('keywords', models.CharField(blank=True, max_length=128, null=True)),
('regex', models.CharField(blank=True, max_length=128, null=True)),
('guild_id', models.CharField(max_length=128)),
],
options={
'verbose_name': 'filter',
'verbose_name_plural': 'filters',
'get_latest_by': 'id',
},
),
migrations.CreateModel(
name='SavedGuilds',
fields=[
('id', models.AutoField(primary_key=True, serialize=False)),
('guild_id', models.CharField(help_text='Discord snowflake ID for the represented guild.', max_length=128, verbose_name='guild id')),
('name', models.CharField(help_text='Name of the represented guild.', max_length=128)),
('icon', models.CharField(help_text="Hash for the represented guild's icon.", max_length=128)),
('permissions', models.CharField(help_text='Guild permissions for the user who added this instance.', max_length=64)),
('owner', models.BooleanField(default=False, help_text="Does the 'added by' user own this guild?")),
],
options={
'verbose_name': 'saved guild',
'verbose_name_plural': 'saved guilds',
'get_latest_by': '-creation_datetime',
},
),
migrations.CreateModel(
name='SubChannel',
fields=[
('id', models.AutoField(primary_key=True, serialize=False)),
('channel_id', models.CharField(help_text='Discord snowflake ID for the represented Channel.', max_length=128, verbose_name='channel id')),
],
options={
'verbose_name': 'SubChannel',
'verbose_name_plural': 'SubChannels',
'get_latest_by': 'id',
},
),
migrations.CreateModel(
name='Subscription',
fields=[
@ -33,19 +76,48 @@ class Migration(migrations.Migration):
},
),
migrations.CreateModel(
name='SavedGuilds',
name='TrackedContent',
fields=[
('id', models.AutoField(primary_key=True, serialize=False)),
('guild_id', models.CharField(max_length=128)),
('name', models.CharField(max_length=128)),
('icon', models.CharField(max_length=128)),
('permissions', models.CharField(max_length=64)),
('owner', models.BooleanField(default=False)),
('added_by', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
('guid', models.CharField(max_length=128, primary_key=True, serialize=False)),
('title', models.CharField(max_length=128)),
('url', models.URLField()),
('creation_datetime', models.DateTimeField(default=django.utils.timezone.now, editable=False)),
],
),
migrations.AddConstraint(
model_name='filter',
constraint=models.UniqueConstraint(fields=('name', 'guild_id'), name='unique name & guild id pair'),
),
migrations.AddField(
model_name='savedguilds',
name='added_by',
field=models.ForeignKey(help_text='The user who added created this instance.', on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='added by'),
),
migrations.AddField(
model_name='subscription',
name='filters',
field=models.ManyToManyField(blank=True, to='home.filter'),
),
migrations.AddField(
model_name='subchannel',
name='subscription',
field=models.ForeignKey(help_text='The linked Subscription, must be unique.', on_delete=django.db.models.deletion.CASCADE, to='home.subscription'),
),
migrations.AddField(
model_name='trackedcontent',
name='subscription',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='home.subscription'),
),
migrations.AddConstraint(
model_name='savedguilds',
constraint=models.UniqueConstraint(fields=('added_by', 'guild_id'), name='unique added_by & guild_id pair'),
),
migrations.AddConstraint(
model_name='subscription',
constraint=models.UniqueConstraint(fields=('name', 'guild_id'), name='unique name & server pair'),
),
migrations.AddConstraint(
model_name='subchannel',
constraint=models.UniqueConstraint(fields=('channel_id', 'subscription'), name='unique channel id and subscription pair'),
),
]

View File

@ -1,23 +0,0 @@
# Generated by Django 5.0.1 on 2024-04-25 16:46
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('home', '0001_initial'),
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.AlterModelOptions(
name='savedguilds',
options={'get_latest_by': '-creation_datetime', 'verbose_name': 'saved guild', 'verbose_name_plural': 'saved guilds'},
),
migrations.AddConstraint(
model_name='savedguilds',
constraint=models.UniqueConstraint(fields=('name', 'guild_id'), name='unique name & guild_id pair'),
),
]

View File

@ -1,54 +0,0 @@
# Generated by Django 5.0.1 on 2024-04-28 13:37
import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('home', '0002_alter_savedguilds_options_and_more'),
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.AlterField(
model_name='savedguilds',
name='added_by',
field=models.ForeignKey(help_text='The user who added created this instance.', on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='added by'),
),
migrations.AlterField(
model_name='savedguilds',
name='guild_id',
field=models.CharField(help_text='Discord snowflake ID for the represented guild.', max_length=128, verbose_name='guild id'),
),
migrations.AlterField(
model_name='savedguilds',
name='icon',
field=models.CharField(help_text="Hash for the represented guild's icon.", max_length=128),
),
migrations.AlterField(
model_name='savedguilds',
name='name',
field=models.CharField(help_text='Name of the represented guild.', max_length=128),
),
migrations.AlterField(
model_name='savedguilds',
name='owner',
field=models.BooleanField(default=False, help_text="Does the 'added by' user own this guild?"),
),
migrations.AlterField(
model_name='savedguilds',
name='permissions',
field=models.CharField(help_text='Guild permissions for the user who added this instance.', max_length=64),
),
migrations.CreateModel(
name='SubChannel',
fields=[
('id', models.AutoField(primary_key=True, serialize=False)),
('channel_id', models.CharField(help_text='Discord snowflake ID for the represented Channel.', max_length=128, verbose_name='channel id')),
('subscription_id', models.ForeignKey(help_text='The ID of the linked Subscription, must be unique.', on_delete=django.db.models.deletion.CASCADE, to='home.subscription', unique=True, verbose_name='subscription id')),
],
),
]

View File

@ -1,24 +0,0 @@
# Generated by Django 5.0.1 on 2024-04-28 13:46
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('home', '0003_alter_savedguilds_added_by_and_more'),
]
operations = [
migrations.RemoveField(
model_name='subchannel',
name='subscription_id',
),
migrations.AddField(
model_name='subchannel',
name='subscription',
field=models.ForeignKey(default='1', help_text='The linked Subscription, must be unique.', on_delete=django.db.models.deletion.CASCADE, to='home.subscription', unique=True),
preserve_default=False,
),
]

View File

@ -1,27 +0,0 @@
# Generated by Django 5.0.1 on 2024-04-28 14:50
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('home', '0004_remove_subchannel_subscription_id_and_more'),
]
operations = [
migrations.AlterModelOptions(
name='subchannel',
options={'get_latest_by': 'id', 'verbose_name': 'SubChannel', 'verbose_name_plural': 'SubChannels'},
),
migrations.AlterField(
model_name='subchannel',
name='subscription',
field=models.ForeignKey(help_text='The linked Subscription, must be unique.', on_delete=django.db.models.deletion.CASCADE, to='home.subscription'),
),
migrations.AddConstraint(
model_name='subchannel',
constraint=models.UniqueConstraint(fields=('channel_id', 'subscription'), name='unique channel id and subscription pair'),
),
]

View File

@ -1,36 +0,0 @@
# Generated by Django 5.0.1 on 2024-04-30 08:24
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('home', '0005_alter_subchannel_options_and_more'),
]
operations = [
migrations.CreateModel(
name='Filter',
fields=[
('id', models.AutoField(primary_key=True, serialize=False)),
('name', models.CharField(max_length=32)),
('keywords', models.CharField(blank=True, max_length=128, null=True)),
('regex', models.CharField(blank=True, max_length=128, null=True)),
('guild_id', models.CharField(max_length=128)),
],
options={
'verbose_name': 'filter',
'verbose_name_plural': 'filters',
'get_latest_by': 'id',
},
),
migrations.AddConstraint(
model_name='filter',
constraint=models.CheckConstraint(check=models.Q(models.Q(('keywords__isnull', False), ('regex__isnull', True)), models.Q(('keywords__isnull', True), ('regex__isnull', False)), _connector='OR'), name='either keywords or regex null, other not null'),
),
migrations.AddConstraint(
model_name='filter',
constraint=models.UniqueConstraint(fields=('name', 'guild_id'), name='unique name & guild id pair'),
),
]

View File

@ -1,21 +0,0 @@
# Generated by Django 5.0.1 on 2024-04-30 08:42
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('home', '0006_filter_and_more'),
]
operations = [
migrations.RemoveConstraint(
model_name='filter',
name='either keywords or regex null, other not null',
),
migrations.AddConstraint(
model_name='filter',
constraint=models.CheckConstraint(check=models.Q(models.Q(('keywords__isnull', False), ('regex__isnull', False), _connector='OR'), models.Q(('keywords__isnull', True), ('regex__isnull', True), _connector='OR')), name='either keywords or regex null, other not null'),
),
]

View File

@ -1,25 +0,0 @@
# Generated by Django 5.0.1 on 2024-04-30 08:54
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('home', '0007_remove_filter_either_keywords_or_regex_null_other_not_null_and_more'),
]
operations = [
migrations.RemoveConstraint(
model_name='filter',
name='either keywords or regex null, other not null',
),
migrations.AddConstraint(
model_name='filter',
constraint=models.CheckConstraint(check=models.Q(('keywords__isnull', False), ('regex__isnull', False), _connector='OR'), name='keywords not null or regex not null'),
),
migrations.AddConstraint(
model_name='filter',
constraint=models.CheckConstraint(check=models.Q(('keywords__isnull', True), ('regex__isnull', True), _connector='OR'), name='keywords null or regex null'),
),
]

View File

@ -1,21 +0,0 @@
# Generated by Django 5.0.1 on 2024-04-30 08:56
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('home', '0008_remove_filter_either_keywords_or_regex_null_other_not_null_and_more'),
]
operations = [
migrations.RemoveConstraint(
model_name='filter',
name='keywords not null or regex not null',
),
migrations.AddConstraint(
model_name='filter',
constraint=models.CheckConstraint(check=models.Q(models.Q(('keywords__isnull', False), _negated=True), models.Q(('regex__isnull', False), _negated=True), _connector='OR'), name='keywords not null or regex not null'),
),
]

View File

@ -1,17 +0,0 @@
# Generated by Django 5.0.1 on 2024-04-30 08:57
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('home', '0009_remove_filter_keywords_not_null_or_regex_not_null_and_more'),
]
operations = [
migrations.RemoveConstraint(
model_name='filter',
name='keywords not null or regex not null',
),
]

View File

@ -1,21 +0,0 @@
# Generated by Django 5.0.1 on 2024-04-30 09:09
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('home', '0010_remove_filter_keywords_not_null_or_regex_not_null'),
]
operations = [
migrations.RemoveConstraint(
model_name='filter',
name='keywords null or regex null',
),
migrations.AddConstraint(
model_name='filter',
constraint=models.CheckConstraint(check=models.Q(('keywords__isnull', True), ('regex__isnull', True), _connector='OR', _negated=True), name='keywords null or regex null'),
),
]

View File

@ -1,21 +0,0 @@
# Generated by Django 5.0.1 on 2024-04-30 09:10
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('home', '0011_remove_filter_keywords_null_or_regex_null_and_more'),
]
operations = [
migrations.RemoveConstraint(
model_name='filter',
name='keywords null or regex null',
),
migrations.AddConstraint(
model_name='filter',
constraint=models.CheckConstraint(check=models.Q(('keywords__isnull', False), ('regex__isnull', False), _connector='OR', _negated=True), name='keywords null or regex null'),
),
]

View File

@ -1,21 +0,0 @@
# Generated by Django 5.0.1 on 2024-04-30 09:21
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('home', '0012_remove_filter_keywords_null_or_regex_null_and_more'),
]
operations = [
migrations.RemoveConstraint(
model_name='filter',
name='keywords null or regex null',
),
migrations.AddConstraint(
model_name='filter',
constraint=models.CheckConstraint(check=models.Q(('keywords__isnull', True), ('regex__isnull', True), _negated=True), name='keywords null or regex null'),
),
]

View File

@ -1,21 +0,0 @@
# Generated by Django 5.0.1 on 2024-04-30 09:24
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('home', '0013_remove_filter_keywords_null_or_regex_null_and_more'),
]
operations = [
migrations.RemoveConstraint(
model_name='filter',
name='keywords null or regex null',
),
migrations.AddConstraint(
model_name='filter',
constraint=models.CheckConstraint(check=models.Q(('keywords__isnull', False), ('regex__isnull', False), _connector='OR'), name='keywords null or regex null'),
),
]

View File

@ -1,17 +0,0 @@
# Generated by Django 5.0.1 on 2024-04-30 09:29
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('home', '0014_remove_filter_keywords_null_or_regex_null_and_more'),
]
operations = [
migrations.RemoveConstraint(
model_name='filter',
name='keywords null or regex null',
),
]

View File

@ -1,17 +0,0 @@
# Generated by Django 5.0.1 on 2024-04-30 09:36
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('home', '0015_remove_filter_keywords_null_or_regex_null'),
]
operations = [
migrations.AddConstraint(
model_name='filter',
constraint=models.CheckConstraint(check=models.Q(('keywords__isnull', False)), name='keywords is not null'),
),
]

View File

@ -1,21 +0,0 @@
# Generated by Django 5.0.1 on 2024-04-30 09:37
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('home', '0016_filter_keywords_is_not_null'),
]
operations = [
migrations.RemoveConstraint(
model_name='filter',
name='keywords is not null',
),
migrations.AddConstraint(
model_name='filter',
constraint=models.CheckConstraint(check=models.Q(('keywords__isnull', True)), name='keywords is not null'),
),
]

View File

@ -1,17 +0,0 @@
# Generated by Django 5.0.1 on 2024-05-01 09:31
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('home', '0017_remove_filter_keywords_is_not_null_and_more'),
]
operations = [
migrations.RemoveConstraint(
model_name='filter',
name='keywords is not null',
),
]

View File

@ -1,18 +0,0 @@
# Generated by Django 5.0.1 on 2024-05-01 13:20
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('home', '0018_remove_filter_keywords_is_not_null'),
]
operations = [
migrations.AddField(
model_name='subscription',
name='filters',
field=models.ManyToManyField(to='home.filter'),
),
]

View File

@ -1,28 +0,0 @@
# Generated by Django 5.0.4 on 2024-05-03 13:35
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('home', '0019_subscription_filters'),
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.RemoveConstraint(
model_name='savedguilds',
name='unique name & guild_id pair',
),
migrations.AlterField(
model_name='subscription',
name='filters',
field=models.ManyToManyField(blank=True, null=True, to='home.filter'),
),
migrations.AddConstraint(
model_name='savedguilds',
constraint=models.UniqueConstraint(fields=('added_by', 'guild_id'), name='unique added_by & guild_id pair'),
),
]

View File

@ -1,18 +0,0 @@
# Generated by Django 5.0.1 on 2024-05-07 09:14
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('home', '0020_remove_savedguilds_unique_name_guild_id_pair_and_more'),
]
operations = [
migrations.AlterField(
model_name='subscription',
name='filters',
field=models.ManyToManyField(to='home.filter'),
),
]

View File

@ -1,18 +0,0 @@
# Generated by Django 5.0.4 on 2024-05-31 22:41
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('home', '0021_alter_subscription_filters'),
]
operations = [
migrations.AlterField(
model_name='subscription',
name='filters',
field=models.ManyToManyField(blank=True, to='home.filter'),
),
]

View File

@ -1,24 +0,0 @@
# Generated by Django 5.0.4 on 2024-06-10 23:20
import django.db.models.deletion
import django.utils.timezone
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('home', '0022_alter_subscription_filters'),
]
operations = [
migrations.CreateModel(
name='TrackedContent',
fields=[
('guid', models.CharField(max_length=128, primary_key=True, serialize=False)),
('title', models.CharField(max_length=128)),
('creation_datetime', models.DateTimeField(default=django.utils.timezone.now, editable=False)),
('subscription', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='home.subscription')),
],
),
]

View File

@ -251,5 +251,6 @@ class Subscription(models.Model):
class TrackedContent(models.Model):
guid = models.CharField(primary_key=True, max_length=128)
title = models.CharField(max_length=128)
url = models.URLField()
subscription = models.ForeignKey(to=Subscription, on_delete=models.CASCADE)
creation_datetime = models.DateTimeField(default=timezone.now, editable=False)