On Fri, Apr 25, 2008 at 8:02 AM, Matias Surdi <[EMAIL PROTECTED]> wrote:

>
> Matias Surdi escribió:
> > 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.
> >
>

Well, what result do you get?  Why not tell us instead of making us guess?

Unless it's a typo. one problem is you have is you try to get the
'cirriculum' url but you named the field 'curriculum'.

(I'm also wondering why you are overriding _get_FIELD_url at all, since it
seems pretty hackish, but I guess that's beside the point.)


>
> > 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.
> >
> >
> > >
> >
>
> I think I'm isolating the problem, I think it's related to the field's
> name size... when it's longer than 8 character, the problem appears.
>

That's surprising, since there's nothing in Django that has any dependence
on field name length here.

Karen

--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to