#1985 closed defect (fixed)
CurrentSiteManager can't find field
| 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 (last modified by )
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
Change History (2)
comment:1 by , 19 years ago
| Description: | modified (diff) |
|---|
comment:2 by , 19 years ago
| Resolution: | → fixed |
|---|---|
| Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
Fixed formatting in description.