Is it better to save the pool in the database or generate dynamically?

I am working on a django project and would like to include slug at the end of the url as it is done here on stackoverflow.com: http://example.com/object/1/my-slug-generated-from-my-title

The identifier of the object will be used to search for the element, not for slug - and, like stackoverflow.com, the pool will not have any value when receiving a link (only when it is displayed).

Qestion : is there a drawback (or growth potential) for generating a bullet dynamically, and not for saving it as a real database field?

For example (not real code):

class Widget(models.Model):
    title = models.CharField()

    def _slug(self):
      return slugify(self.title)
    slug = property(_slug)

Instead of using something like AutoSlugField ( for example )?

, , , .

!

+5
4

( ) , - .

, :

@property
def slug(self):
  return slugify(self.title)
+8

"" "浦 安 鉄 筋 家族".

, poo, .

.

+2

, . , , .

In any case, this is good, it depends only on your performance and space requirements.

+1
source

The main disadvantage of generating a bullet dynamically is that you miss the opportunity to configure bullets for each object, for example. make them shorter and more beautiful. For English titles, this may be OK, but for non-English content, the generated bullets can be ugly.

0
source

All Articles