Skip to content

Commit 4b72e37

Browse files
Add content_object index to Link
1 parent ca223f4 commit 4b72e37

File tree

3 files changed

+27
-0
lines changed

3 files changed

+27
-0
lines changed

CHANGELOG

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
Unreleased
2+
3+
* Add index to Link (David Venhoff, #202)
4+
15
2.3.0 (2023-12-27)
26

37
* Fix encoding of utf-8 domain names (Timo Brembeck, #190)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Generated by Django 5.1.3 on 2024-11-25 18:00
2+
3+
from django.db import migrations, models
4+
5+
6+
class Migration(migrations.Migration):
7+
8+
dependencies = [
9+
('contenttypes', '0002_remove_content_type_name'),
10+
('linkcheck', '0010_url_add_error_message'),
11+
]
12+
13+
operations = [
14+
migrations.AddIndex(
15+
model_name='link',
16+
index=models.Index(fields=['content_type', 'object_id'], name='content_type_and_object_id'),
17+
),
18+
]

linkcheck/models.py

+5
Original file line numberDiff line numberDiff line change
@@ -525,6 +525,11 @@ class Link(models.Model):
525525
text = models.CharField(max_length=256, default='')
526526
ignore = models.BooleanField(default=False)
527527

528+
class Meta:
529+
indexes = [
530+
models.Index(fields=["content_type", "object_id"], name="content_type_and_object_id"),
531+
]
532+
528533
@property
529534
def display_url(self):
530535
# when page /test/ has a anchor link to /test/#anchor, we display it

0 commit comments

Comments
 (0)