Mirza Delic
Mirza Delic

Reputation: 4339

django sites framework custom settings for each site

How can i extend django sites framework?

I need to add more fields, like logo file, subtitle, etc.

Or any other solution for this kind of thing?

Upvotes: 1

Views: 672

Answers (1)

doniyor
doniyor

Reputation: 37876

just make OneToOne Relation with Site Model

from django.contrib.sites.models import Site

class CustomSite(models.Model):
   class Meta:
       verbose_name = "Custom Domain"
       verbose_name_plural = "Custom Domains"
   site = models.OneToOneField(Site, null=True, related_name='customsite')
   subtitle = models.CharField(max_length=100)
   #...
   #...
   def __unicode__(self):
       return 'Customsite of {0}'.format(self.site.domain)

Upvotes: 2

Related Questions