Nope, but I finally found what seems to be the "right" way to do this (copies the file to the appropriate upload_to location, etc):
from django.core.files.base import File def create_a_company(name, logo_path): company = Company() company.name = name logo_file = open(logo_path) company.logo = File(logo_file) company.save() On Oct 2, 10:15 pm, akonsu <ako...@gmail.com> wrote: > did you try > > company.logo = relative_path > > ? > > On Oct 2, 4:45 pm, Nan <ringe...@gmail.com> wrote: > > > OK, this seemed to work: > > > def create_a_company(name, logo_path): > > company = Company() > > company.name = name > > relative_path = path_relative_to_media_root(logo_path) > > company.logo.name = relative_path > > company.save() > > > Thank you! --~--~---------~--~----~------------~-------~--~----~ 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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---