django_site

Issue #35 resolved
Soo Ling Lim created an issue

Postman requires the django_site table in order to work, but 'django.contrib.sites' is an optional package, and I prefer not to have it in my app.

Is it possible to add RequestSite to places where Site is used so that Postman will work even if I don't have django_site?

E.g.:

from django.contrib.sites.models import RequestSite
from django.contrib.sites.models import Site

        if Site._meta.installed:
            site = Site.objects.get_current()
        else:
            site = RequestSite(request)

Comments (5)

  1. Patrick Samson repo owner
    • changed status to open

    Your proposal is a step but it doesn't cover the situation where there is not even a request object available, which is the case of the API access. The site object is used only in two templates, to render the subject of email notifications. In the worst situation (no Site, no request) - you may say it's not yours but the app must deal with it - , you would have to overwrite these templates to hard-code the site name, or change the sentence. I believe it is acceptable, do you agree?

  2. Log in to comment