mirror of
https://github.com/Alexander-D-Karpov/akarpov
synced 2024-11-22 01:36:33 +03:00
added slug index
This commit is contained in:
parent
e3454a142a
commit
98e9a4e036
|
@ -65,7 +65,7 @@ class SlugModel(models.Model):
|
|||
for custom slug length use: slug_length, private_slug_length Meta options
|
||||
"""
|
||||
|
||||
slug = models.SlugField(max_length=20, blank=True, unique=True)
|
||||
slug = models.SlugField(max_length=20, blank=True, unique=True, db_index=True)
|
||||
|
||||
@classmethod
|
||||
def __init_subclass__(cls, **kwargs):
|
||||
|
@ -73,6 +73,7 @@ def __init_subclass__(cls, **kwargs):
|
|||
models.signals.pre_save.connect(create_model_slug, sender=cls)
|
||||
|
||||
class Meta:
|
||||
indexes = ["slug"]
|
||||
abstract = True
|
||||
|
||||
class SlugMeta:
|
||||
|
|
Loading…
Reference in New Issue
Block a user