I think you can use "self.album.id" or "self.album_id".
On Wed, Dec 5, 2018 at 9:20 AM Sourajit Mohanty <[email protected]> wrote: > class Album(models.Model): > artist=models.CharField(max_length=250) > title=models.CharField(max_length=500) > > class Song(models.Model): > album=models.ForeignKey(Album,on_delete=models.CASCADE) > song_title=models.CharField(max_length=250) > > def get_absolute_url(self): > //I need to access the Album ID from here..so that i can redirect > myself to the Album's url after adding a new song > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at https://groups.google.com/group/django-users. > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-users/935048ff-94f5-4831-bde0-231a473c0fa4%40googlegroups.com > . > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAL1UH0v35yeCDAoFkQZk1JkYrc59vMOMZ9sjx5sS3A9QZvPNiw%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.

