how can i access ForeignKey model attribute value in save() or __unicode__ method? some hint will help.
here is my model.py: class PhotoSetPhotoItem(models.Model): photo_item = models.ForeignKey('Photo', related_name='photoitem') slug = models.SlugField(blank = True, null = True) def __unicode__(self): # ----> BELOW IS THE PROBLEMATIC PART return str(self.photo_set)+str(self.photo_item)+str (self.photo_item.img) def save(self, force_insert=False, force_update=False): if self.photo_item != None: # ----> BELOW IS THE PROBLEMATIC PART self.slug = str(self.photo_set)+str(self.photo_item)+str (self.photo_item.img) super(PhotoSetPhotoItem, self).save(force_insert, force_update) class Photo(models.Model): title_hr = models.CharField('(hr)', max_length=255) slug = models.SlugField() img = FileBrowseField(max_length=200, initial_directory="", ...) def __unicode__(self): return self.title_hr def getImg(self): return self.img 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 -~----------~----~----~----~------~----~------~--~---