I am still learning Django, and appreciate all of the help I have received. I spent a few hours on this and just cannot figure out how to pull off the get_absolute_url() function the way I describe it below for the Photo class. I want to use the slugs for related models and step through multiple relations. I can get to the id's of the related models as shown in the shell transcript below, but not the slugs yet.
extracted from models.py ==================== class State(models.Model): state = models.CharField(max_length=100, unique=True) slug = models.SlugField(prepopulate_from=('state',)) class City(models.Model): state = models.ForeignKey(State) featured_place = models.ForeignKey('Place', related_name='place', null=True, blank=True) city = models.CharField(max_length=100, unique=True) slug = models.SlugField(prepopulate_from=('city',)) class Place(models.Model): city = models.ForeignKey(City) featured_gallery = models.ForeignKey('Gallery', related_name='gallery', null=True, blank=True) class Gallery(models.Model): user = models.ForeignKey(User) place = models.ForeignKey(Place) featured_photo = models.ForeignKey('Photo', related_name='photo', null=True, blank=True) pub_date = models.DateTimeField(_('date published'), default=datetime.now) title = models.CharField(_('title'), max_length=100, unique=True) slug = models.SlugField(_('slug'), prepopulate_from=('title',), unique=True, help_text=_('A "Slug" is a unique URL- friendly title for an object.')) is_public = models.BooleanField(_('is public'), default=True, help_text=_('Public galleries will be displayed in the default views.')) photos = models.ManyToManyField('Photo', related_name='galleries', verbose_name=_('photos'), filter_interface=models.HORIZONTAL) class Photo(models.Model): user = models.ForeignKey(User) place = models.ForeignKey(Place) image = models.ImageField(_('photograph'), upload_to=PHOTOLOGUE_DIR +"/photos/%Y/%b/%d") pub_date = models.DateTimeField(_('date published'), default=datetime.now) title = models.CharField(_('title'), max_length=100, unique=True) slug = models.SlugField(_('slug'), prepopulate_from=('title',), unique=True, help_text=('A "Slug" is a unique URL- friendly title for an object.')) @permalink def get_absolute_url(self): return ('photo-detail', None, { 'state' : self.photo.place.city.state_slug , 'city' : self.photo.place.city_slug, 'place' : self.photo.place_slug, 'slug': self.slug }) ***Shell output >>> from photologue.models import * >>> photo = Photo.objects.get(slug='golf-course-3') >>> photo.place.city.state_slug Traceback (most recent call last): File "<console>", line 1, in ? AttributeError: 'City' object has no attribute 'state_slug' >>> photo.place.city.state_id 4 >>> photo.get_absolute_url() return ('photo-detail', None, { 'state' : self.photo.place.city.state_slug , 'city' : self.photo.place.city_slug, 'place' : self.photo.place_slug, 'slug': self.slug }) AttributeError: 'RelatedManager' object has no attribute 'place' Any hints would be appreciated. --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---