mirror of
https://github.com/Alexander-D-Karpov/akarpov
synced 2024-11-25 16:23:43 +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
|
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
|
@classmethod
|
||||||
def __init_subclass__(cls, **kwargs):
|
def __init_subclass__(cls, **kwargs):
|
||||||
|
@ -73,6 +73,7 @@ def __init_subclass__(cls, **kwargs):
|
||||||
models.signals.pre_save.connect(create_model_slug, sender=cls)
|
models.signals.pre_save.connect(create_model_slug, sender=cls)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
|
indexes = ["slug"]
|
||||||
abstract = True
|
abstract = True
|
||||||
|
|
||||||
class SlugMeta:
|
class SlugMeta:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user