Sorry, there was an error in the previous message:
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.es is 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_cirriculum_url(), I don't get the same result than
with
the first one.
The only difference is the field name.
am I missing something here? what could be happening?
NOTE: Database is destroyed/recreated on each test.
Thanks.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---