Why SlugField() in Django?

前端 未结 3 834
深忆病人
深忆病人 2020-12-13 08:43

Django has models.SlugField() which helps us to create some cool looking urls. My question is why specifying it as a field

suppose I have this m

3条回答
  •  Happy的楠姐
    2020-12-13 09:20

    I am making a multi-tenant calendar app. If the calendar urls were something like: /calendar/id/ where the ids were successive integers, then hackers could guess the ids and find out more about my business than I want. By using a url /calendar/slug/ it is much harder to find all the calendars.

提交回复
热议问题