Friday, February 15, 2013

The problem with storing relative paths

Hello!

So this is what i wanna do:

I have built a model with an admin interface for letting the user create his own site. it has following fields:
  
    name = models.CharField(max_length = 50)
    formtemplate = FilePathField(path='/path/to/project/myforms/templates/forms', match=".\*.htm[l]")
    thankyoutemplate = FilePathField(path='/path/to/project/myforms/templates/forms', match=".\*.htm[l]", blank=True)
    slug = models.CharField(max_length = 50)

He should be able to upload his template-files to that folder and afterwards selecting it in the model admin. but the database is storing the absolute path which means, after putting the project to another path or system all paths in the database are useless.
id like to avoid that and looked for solutions. I would like the database to store only the relative part and my code should apped it to settings.PROJECT_PATH ... Am i thinking it right or is there a more "django-like" way to do it....

There already is a implementation of a RelativeFilePathField but several people told me there are better ways to accomplish what i wanna do...

Thank you very much for your help.

Jonni

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate