For each Brother object, I'm trying to set the FilePathField attribute
pic.

from django.db.models import FilePathField
from brothers.models import Brother
p = '/media/images/BrotherImages/'
for bro in Brother.objects.all():
    m = '%s/%s%s.jpg' % (bro.year, bro.first_name, bro.last_name)
    bro.pic = FilePathField(path = p, match = m)
    bro.save()

The problem is pic is being saved as unicode text, so I get an error
when I try to call pic.path or pic.match.

Thanks for the help.

-Gordon

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to