Closed MaybeThisIsRu closed 2 years ago
It appears to me that sites is only used on the send
and send_many
methods which sends emails to informs users of new moderation items OR accept/reject status for a moderation item. They populate context
which is then used to render a template — none of the templates however use the site
context variable.
Where the Site package is imported: https://github.com/dominno/django-moderation/blob/master/moderation/moderator.py#L2
Where it is used: https://github.com/dominno/django-moderation/blob/master/moderation/moderator.py#L138-L202
Templates: notification_subject_user.txt, notification_subject_moderator.txt, notification_message_user.txt, notification_message_moderator.txt
Could probably write a helper/util method to check INSTALLED_APPS
in django.conf.settings
and act accordingly. Then we make it so that it is only included in the context by default if sites app is installed by the user.
With this approach, anyone who relies on the site
context variable for their templates (in case they have over-ridden it) will not be left hanging.
If this sounds about right, let me know and I'll try to PR.
Good question. Thank you for providing informative text 👍
For me, it sounds reasonable to make it optionally as you proposed. For that change, I would like also to hear from @dominno. Do you think we need to do it and release in new version?
Sites framework offered by Django is optional but it seems this package requires that it be installed and configured:
Using
django-moderation
without sites results in:Is there any particular reason we assume that sites is mandatory and this package cannot be used without it?
Python 3.9, Django 3.2.x