Opened 19 years ago
Last modified 18 years ago
#1985 closed defect
CurrentSiteManager can't find field — at Initial Version
Reported by: | Owned by: | Adrian Holovaty | |
---|---|---|---|
Component: | Core (Other) | Version: | |
Severity: | normal | Keywords: | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
The code (taken from docs) in rev [2970] ..
from django.db import models
from django.contrib.sites.models import Site
from django.contrib.sites.managers import CurrentSiteManager
class Photo(models.Model):
photo = models.FileField(upload_to='/home/photos')
photographer_name = models.CharField(maxlength=100)
pub_date = models.DateField()
publish_on = models.ForeignKey(Site)
objects = models.Manager()
on_site = CurrentSiteManager('publish_on')
Does not work, gives following error. Changing publish_on to site also does the same. Environment OSX and mysql, svn version [2970]
raise ValueError, "%s couldn't find a field named %s in %s." % \
ValueError: CurrentSiteManager couldn't find a field named publish_on in Photo