On Apr 25, 7:25 am, Matias Surdi <[EMAIL PROTECTED]> wrote:
> With the following model:
>
> class Candidate(models.Model):
> name = models.CharField(max_length=100,unique=True)
> file =
> models.FileField(upload_to="curriculums/%Y/%m/%d",max_length=300)
>
> def _get_FIELD_url(self,field):
> return "http://www.google.es"
> if getattr(self, field.attname): # value is not blank
> import urlparse
> return urlparse.urljoin(settings.MEDIA_URL, getattr(self,
> field.attname)).replace('\\', '/')
> return ''
>
> when I do object.get_file_url(),http://www.google.esis returned, as
> expected
>
> but with the following one:
>
> class Candidate(models.Model):
> name = models.CharField(max_length=100,unique=True)
> curriculum =
> models.FileField(upload_to="curriculums/%Y/%m/%d",max_length=300)
>
> def _get_FIELD_url(self,field):
> return "http://www.google.es"
> if getattr(self, field.attname): # value is not blank
> import urlparse
> return urlparse.urljoin(settings.MEDIA_URL, getattr(self,
> field.attname)).replace('\\', '/')
> return ''
>
> when I do object.get_file_url(), I don't get the same result than with
> the first one.
Shouldn't you try object.get_curriculum_url() instead of
object.get_file_url()?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---