Ghostino Doggio
Ghostino Doggio

Reputation: 371

Django, get_absolute_url method for file object

def get_absolute_url(self):
        return "/uploads/%i" % self.id

It's not what I want but This is far as I can think of. I need a link for my files (like.../photo.jpg)

I just learned how to get feeds from my django website. And I want this jpeg's absolute url.

http://myDjangoWeb/uploads/goodies_89087_1211864024_1.jpeg

How can I get this file's absolute url.....self.?????

Upvotes: 28

Views: 33642

Answers (1)

vartec
vartec

Reputation: 134721

Just use .url property of the file field.

See "Managing files" in Django documentation.

Upvotes: 58

Related Questions