get rid of example.com for Django's default site
Posted | archive
Suppose you have the following model:
class MyModel(models.Model):
def get_absolute_url(self, *args, **kwargs):
return '/show/%s' % self.pk
The "View on site" button on admin will always take you to example.com, which is bullshit.
Even if you override it with ABSOLUTE_URL_OVERRIDES
in settings.py.
The solution is to fuck Django's default Site in your models.py:
from django.contrib.sites import models as SiteModels
SiteModels.Site._meta.installed = False
Comments