allways_update argument
It would be nice to be able to force the update of slug values so that the slug "follows" the value in the field it's populating from.
This could be done by adding an always_update keyword argument (default to False) for AutoSlugField. This argument would then be checked in the pre_save method.
For example: {{{ #!python
if (self.populate_from and not value) or self.always_update: value = utils.get_prepopulated_value(self, instance) }}}
Comments (4)
-
Account Deleted -
repo owner - marked as enhancement
- changed status to open
Initially I was against this because the slug is meant to be a part of URI, and "cool URIs don't change". But since this is not the first time the issue is raised, I agree that this option won't do any harm at least by default :) and in some cases it can be a reasonable requirement.
Could you please rewrite that chunk of code as a patch (preferably in a fork @BB) with tests?
Thanks.
-
reporter Rewrote this in a fork and added the test. A pull request has been sent.
-
repo owner - changed status to resolved
Great, thanks! Your changeset has made into the main repo. Available on PyPI as v.1.4.0.
- Log in to comment
I agree.