In the admin panel, I want to populate the slug field based on a specific text field
eg.
Title: My Awesome Page
will be automatically filled
Slug: my_awesome_page
For SlugField, the prepoulate_from option to 0.96 was used before. After that, he became administrative. See here for reference.
Alternatively, you can override the model save method to calculate the value of the slug field in the save () file.
This question may also be helpful.
, django-autoslug, AutoSlugField. , :
class Something(models.Model): title = models.CharField(max_lenght=200) slug = AutoSlugField(populate_from='title') ...
AutoSlugField , , - (, DateTimeField).
. http://pypi.python.org/pypi/django-autoslug.
Source: https://habr.com/ru/post/1702900/More articles:Есть ли лучший способ справиться с именованием причуд? - naming-conventionsHow to create a local user profile for an anonymous user of an ASP.Net MVC application in IIS 7? - windows-7.NET Лучший подход к внедрению модели очередей клиентов и серверов с внешним приложением? - .netWhy Ruby on Rails abandoned the scaffold method - ruby | fooobar.comXML Documentation: with a few typical type parameters - genericsPassing data in ASP.NET MVC using LINQ - nuttiness - c #Global custom view for document libraries in Sharepoint - sharepointAdding a row to a data table using ArrayDataModel in jsf? - javaMVC table LINQ to SQL Join Record Display - join.NET 3.5 SP1 as a requirement (or should I try installing 3.5 without SP1)? - .netAll Articles