Remove inheritance from ChangeLoggedModel

This commit is contained in:
Jeremy Stretch 2023-06-29 10:13:17 -04:00
parent c9f513ce03
commit c23e3eab34
3 changed files with 10 additions and 7 deletions

View File

@ -206,7 +206,7 @@ class BookmarkSerializer(ValidatedModelSerializer):
class Meta:
model = Bookmark
fields = [
'id', 'url', 'display', 'object_type', 'object_id', 'object', 'user', 'created', 'last_updated',
'id', 'url', 'display', 'object_type', 'object_id', 'object', 'user', 'created',
]
@extend_schema_field(serializers.JSONField(allow_null=True))

View File

@ -1,4 +1,4 @@
# Generated by Django 4.1.9 on 2023-06-26 14:27
# Generated by Django 4.1.9 on 2023-06-29 14:07
from django.conf import settings
from django.db import migrations, models
@ -8,8 +8,8 @@ import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('contenttypes', '0002_remove_content_type_name'),
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('contenttypes', '0002_remove_content_type_name'),
('extras', '0094_tag_object_types'),
]
@ -18,8 +18,7 @@ class Migration(migrations.Migration):
name='Bookmark',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False)),
('created', models.DateTimeField(auto_now_add=True, null=True)),
('last_updated', models.DateTimeField(auto_now=True, null=True)),
('created', models.DateTimeField(auto_now_add=True)),
('object_id', models.PositiveBigIntegerField()),
('object_type', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='contenttypes.contenttype')),
('user', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to=settings.AUTH_USER_MODEL)),

View File

@ -1,7 +1,6 @@
import json
import urllib.parse
from django.conf import settings
from django.contrib import admin
from django.conf import settings
from django.contrib.contenttypes.fields import GenericForeignKey
@ -596,10 +595,13 @@ class JournalEntry(CustomFieldsMixin, CustomLinksMixin, TagsMixin, ExportTemplat
return JournalEntryKindChoices.colors.get(self.kind)
class Bookmark(ChangeLoggedModel):
class Bookmark(models.Model):
"""
An object bookmarked by a User.
"""
created = models.DateTimeField(
auto_now_add=True
)
object_type = models.ForeignKey(
to=ContentType,
on_delete=models.PROTECT
@ -614,6 +616,8 @@ class Bookmark(ChangeLoggedModel):
on_delete=models.PROTECT
)
objects = RestrictedQuerySet.as_manager()
class Meta:
ordering = ('created', 'pk')
constraints = (