this is my model.py:

class Event(models.Model):
    title = models.CharField('Event Name', max_length=300)
    photo_set = models.ForeignKey(PhotoSet, blank=True, null=True)

class PhotoSet(models.Model):
    title = models.CharField(max_length=300)
    slug = models.CharField(max_length=300)


and this is my views.py

def getProgrammAsXML(request):
    entries = Event.objects.filter(start_time__year=2009)
    for item in entries:
        print item.title
        print item.photo_set
        # this one gets the error:
        print item.photo_set.title

i'm getting this error when i try to access item.photo_set.title.
'NoneType' object has no attribute 'title'

when i try item.photo_set, then i get the name of that object so i
think that reference to object is ok...
what am i doing wrong here? or do i have to do that some other way?

tnx,
vedran
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to