diff options
Diffstat (limited to 'app/normalize')
-rw-r--r-- | app/normalize/__init__.py | 0 | ||||
-rw-r--r-- | app/normalize/admin.py | 13 | ||||
-rw-r--r-- | app/normalize/migrations/0001_initial.py | 31 | ||||
-rw-r--r-- | app/normalize/migrations/0002_alter_relatedpost_id.py | 18 | ||||
-rw-r--r-- | app/normalize/migrations/__init__.py | 0 | ||||
-rw-r--r-- | app/normalize/models.py | 17 |
6 files changed, 79 insertions, 0 deletions
diff --git a/app/normalize/__init__.py b/app/normalize/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/app/normalize/__init__.py diff --git a/app/normalize/admin.py b/app/normalize/admin.py new file mode 100644 index 0000000..cf67658 --- /dev/null +++ b/app/normalize/admin.py @@ -0,0 +1,13 @@ +from django.contrib import admin + +from utils.widgets import AdminImageWidget, LGEntryForm + +from .models import RelatedPost + +@admin.register(RelatedPost) +class RelatedPostAdmin(admin.ModelAdmin): + list_display = ('title', 'slug', 'pub_date', 'model_name') + list_filter = ['model_name'] + + class Media: + js = ('next-prev-links.js',) diff --git a/app/normalize/migrations/0001_initial.py b/app/normalize/migrations/0001_initial.py new file mode 100644 index 0000000..358677a --- /dev/null +++ b/app/normalize/migrations/0001_initial.py @@ -0,0 +1,31 @@ +# Generated by Django 3.1.3 on 2020-11-30 22:45 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ('contenttypes', '0002_remove_content_type_name'), + ] + + operations = [ + migrations.CreateModel( + name='RelatedPost', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('entry_id', models.IntegerField()), + ('title', models.CharField(max_length=200)), + ('slug', models.CharField(max_length=50)), + ('pub_date', models.DateTimeField(verbose_name='Date published')), + ('model_name', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='contenttypes.contenttype')), + ], + options={ + 'ordering': ('-model_name', '-pub_date'), + 'get_latest_by': 'pub_date', + }, + ), + ] diff --git a/app/normalize/migrations/0002_alter_relatedpost_id.py b/app/normalize/migrations/0002_alter_relatedpost_id.py new file mode 100644 index 0000000..16f958e --- /dev/null +++ b/app/normalize/migrations/0002_alter_relatedpost_id.py @@ -0,0 +1,18 @@ +# Generated by Django 3.2.8 on 2021-10-06 20:25 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('normalize', '0001_initial'), + ] + + operations = [ + migrations.AlterField( + model_name='relatedpost', + name='id', + field=models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID'), + ), + ] diff --git a/app/normalize/migrations/__init__.py b/app/normalize/migrations/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/app/normalize/migrations/__init__.py diff --git a/app/normalize/models.py b/app/normalize/models.py new file mode 100644 index 0000000..f45f90b --- /dev/null +++ b/app/normalize/models.py @@ -0,0 +1,17 @@ +from django.db import models +from django.contrib.contenttypes.models import ContentType + + +class RelatedPost(models.Model): + model_name = models.ForeignKey(ContentType, null=True, on_delete=models.SET_NULL) + entry_id = models.IntegerField() + title = models.CharField(max_length=200) + slug = models.CharField(max_length=50) + pub_date = models.DateTimeField('Date published') + + class Meta: + ordering = ('-model_name', '-pub_date',) + get_latest_by = 'pub_date' + + def __str__(self): + return "%s - %s" % (self.model_name, self.title) |