For example a model class:
class Category(models.Model):
objects = CurrentSiteManager()
site = models.ForeignKey(Site, blank=True, default=settings.SITE_ID)
cat_name = models.CharField(maxlength=255, verbose_name="Category Name") # name of the category
cat_order = models.PositiveSmallIntegerField(default=0, verbose_name="Order") # order of categories on the forum-categories list
class Meta:
verbose_name = "Category"
verbose_name_plural = "Categories"
class Admin:
list_display = ('cat_name', 'cat_order', 'site')
fields = (
(None, {
'fields': ('cat_name', 'cat_order')
}),)
def __str__(self):
return self.cat_name
It uses Sites to add/edit/show objects for current site by SITE_ID. The problem is that in Admin Panel list of objects will show all objects, not only from current site, while editing will work only for objects assigned to current site (other will get Page not found (404) when trying to edit them). Admin Panel should use THECLASS.objects.all() in this case...