establishment slug from index_name
This commit is contained in:
parent
25e829e629
commit
6811a5b6c0
|
|
@ -3,6 +3,7 @@ from datetime import datetime
|
|||
from functools import reduce
|
||||
from operator import or_
|
||||
from typing import List
|
||||
from slugify import slugify
|
||||
|
||||
import elasticsearch_dsl
|
||||
from django.conf import settings
|
||||
|
|
@ -655,6 +656,14 @@ class Establishment(GalleryMixin, ProjectBaseMixin, URLImageMixin,
|
|||
def __str__(self):
|
||||
return f'id:{self.id}-{self.name}'
|
||||
|
||||
def save(self, *args, **kwargs):
|
||||
slugify_slug = slugify(
|
||||
self.index_name,
|
||||
word_boundary=True
|
||||
)
|
||||
self.slug = slugify_slug
|
||||
super(Establishment, self).save(*args, **kwargs)
|
||||
|
||||
def delete(self, using=None, keep_parents=False):
|
||||
"""Overridden delete method"""
|
||||
# TODO: If this does not contradict the plan,
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user