magic-removal: Added django.contrib.sites in preparation for moving it out of django.models.core.

git-svn-id: http://code.djangoproject.com/svn/django/branches/magic-removal@1842 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Joseph Kocherhans 2006-01-06 22:18:19 +00:00
parent 548ee3795b
commit 4e713af133
2 changed files with 23 additions and 0 deletions

View File

View File

@ -0,0 +1,23 @@
from django.db import models
from django.utils.translation import gettext_lazy as _
class SiteManager(models.Manager):
def get_current(self):
from django.conf.settings import SITE_ID
return self.get_object(pk=SITE_ID)
class Site(models.Model):
domain = models.CharField(_('domain name'), maxlength=100)
name = models.CharField(_('display name'), maxlength=50)
objects = SiteManager()
class Meta:
verbose_name = _('site')
verbose_name_plural = _('sites')
ordering = ('domain',)
admin = models.Admin(
list_display = ('domain', 'name'),
search_fields = ('domain', 'name'),
)
def __repr__(self):
return self.domain