1 2 3 4 5 6 7 8 9 10 11 12 13 14 | class Article(models.Model):
site = models.ForeignKey(Site)
title = models.CharField(max_length=100)
body = models.TextField()
pub_date = models.DateTimeField()
class Admin:
# In this example, the Admin's object list will show *only* Articles
# which are related to the current Site.
# However, you could specify any Manager you like:
# manager = MyCustomManager()
from django.contrib.sites.managers import CurrentSiteManager
manager = CurrentSiteManager()
|
More like this
- User manager by diverman 3 years, 10 months ago
- FieldsetForm by Ciantic 6 years, 1 month ago
- ActiveManager: filter objects depending on publication and/or expiration dates by haplo 4 years, 10 months ago
- Django enumeration for model field choices by martinthenext 1 year, 1 month ago
- Fetching top items by ubernostrum 6 years, 2 months ago
Comments
This does not work in Django 1.1 where you don't use the Admin class but where you have ModelAdmin class registered separately.
#