This is what i do (sorry about my REALLY BAD english): (Slugify its a snippet that i use to convert the spanish names into a url you can find them on internet and i think django has his own, but for english only i think, his names its slugifi you can use it importing it "from django.template.defaultfilters import slugify" i never try it)
In models.py... ---START CODE--- from os.path import splitext from django.db import models from foo.bar.slughifi import slughifi #here i suppoust that you have a main folder to contain all galleries files, into that #you creat one folder per gallery, into each you create a folder for images, videos, etc #and put your images, into images folders. def getPicPath(instance, filename): name, ext = splitext(filename) #idem for videos or whatever you want, just change "images" for your media return 'galleries/%s/images/%s%s' % (slugify(instance.Gallery.Title), slugify(name), ext) class galleries (models.Model): title = models.CharField() url = models.URLField() #this automatically convert the title of a gallerie into a url on save def save(self, *rgs, **kwargs): if not self.id: self.url = slughifi(self.title) super(galleries, self).save(*args, **kwargs) class medias (models.Model): gallery = models.ForeignKey(galleries) title = models.CharField() url = models.URLField() def save(self, *rgs, **kwargs): if not self.id: self.url = slughifi(self.title) super(medias, self).save(*args, **kwargs) #i extend the functionality of medias for pics, videos and audios, you mus to create others class pics (medias): file = models.ImageField(upload_to=getPicPath) def __unicode__(self): return self.file.url ---END OF CODE--- You must to create a get**Path method for each type of media (because you create the files structure there, see return instruction of getPicPath) You must to configure your settings.py to indicates django where put your "galleries" folder who contain all your galleries and medias files. (EX.: ROOT_PATH = os.path.dirname(__file__) DOMAIN_NAME = 'http://www.yoursite.com' MEDIA_ROOT = os.path.join(ROOT_PATH, 'media') MEDIA_URL = DOMAIN_NAME + '/media/' ) Hope to help you Cheers 2013/5/7 Hélio Miranda <helio...@gmail.com> > I am making an application in django with mongodb. > He liked to have a uplaod files (photos / videos), where to save the files > in a folder on the server, and saves the mongodb url file. > > Does anyone know how I can do this? > > Someone can help me? > > thank you > > -- > 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+unsubscr...@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. > > > -- Rafael E. Ferrero Claro: (03562) 15514856 -- 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+unsubscr...@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.