django-wm: 4.0.0
Warning
This update alters fields on MentionableMixin so you will need to run makemigrations and migrate after upgrading!
MentionableMixin:allow_outgoing_webmentionsdefault now configurable viasettings.WEBMENTIONS_ALLOW_OUTGOING_DEFAULT.Removed
slugfield. If you use this field you can restore the previous behaviour by adding the following to your model.class MyModel(MentionableMixin, models.Model): slug = models.SlugField(unique=True) @classmethod def resolve_from_url_kwargs(cls, slug, **url_kwargs): return cls.objects.get(slug=slug)Deprecated method
all_text, replaced byget_content_html. Overridingall_textstill works for now but will log a warning asking you to rename the method.
Moved template files to
mentionssub-directory. If you have custom overrides of these templates in your roottemplates/directory please move them totemplates/mentions/.Added user agent header to all network requests.
- Customisable via
settings.WEBMENTIONS_USER_AGENT: str.
- Customisable via
Admin-facing strings are now translatable.
Added
urlpatternshelper functionsmentions_path,mentions_re_pathfor (hopefully) simpler setup.- More straightforward view-to-model mapping.
- Removes the need to implement
resolve_from_url_kwargson your MentionableMixin implementation. - See the wiki for example setup instructions.
Support for Wagtail.
Pagemodels should implementMentionableMixinas usual.RoutablePageMixinshould use the new@mentions_wagtail_path,@mentions_wagtail_re_pathdecorators in place of the Wagtail equivalents@path,@re_path.- These work essentially the same
mentions_pathandmentions_re_path.
- These work essentially the same
If using RichTextField call
richtexton any RichTextField values inget_content_html:from wagtail.templatetags.wagtailcore_tags import richtext class MyModel(MentionableMixin, Page): ... def get_content_html(self) -> str: return f"{richtext(self.overview)} {richtext(self.body)}"
Wiki pages are now live! These will be kept up-to-date going forwards but may not be useful for pre-4.0 versions.
Fix: Relative URLs in
h-cardhomepage or avatar are now resolved to absolute URLs.