Hi Florian; You might want to look into a separate object for your images and add them as either a manytomanyfield in you story object or have them edited inline as foreign key objects. Look at the relationships here: http://www.djangoproject.com/documentation/model-api/#relationships . You would use manytomany if you would like to reuse images in multiple stories and foreign key if you want the authors to upload their images on the same page as the story or the images should always be tied to one and only one story.
I recently had a similar issue with how to give the author the ability to place the images in an exact place of a story. Here you have a few options. You can have a set place for images like a slideshow, you could somehow change an admin field to show the absolute url of the image in the display, or you could create a custom form field for you story object that uses ajax or just javascript to dynamically place text that would be replaced by a manager or while the data is cleaned on the admin side to put the image into the story. You could probably have a middle class also help with that last option, which would be the most flexible and simple, but also the most difficult. Another way that doesn't involve putting the image in the database is by using a textedit kit like YUI's or TinyMCE, which uploads images to a directory and puts the code in. Of course you won't get the django management features with those images. Hope that helps get you on your way, This was one of the hardest parts for me switching from blog applications like wordpress to Django, but once you develop a system it will last forever and be considerably more flexible. Michael Newman On Feb 13, 4:31 am, Florian Lindner <[EMAIL PROTECTED]> wrote: > Hello, > this is a repost of an mail I sent some days ago. Since no one replied > and I don't think that noone has an opinion about that I dare to post > again. > > I have some problems about my blog which I would like to hear your > opinion about. > > A user should have the possibility to upload image files in an post > (which is represented by a Model). Images can be displayed either > seperately from the text or can be embedded in the text. > If embedded in the text [1] the user does not know the real URL when > uploading an image (because he does not necessarily know the value of > MEDIA_ROOT) he can't give the real URL. Therefore I somehow need to > preprocess the text and replace the relative URL (which could be just > the name of the image) with the complete URL. > Is this thought correct so far? Or is there a smarter way to achieve > it? How would you do it? > > The place where images are stored is determined by the value of > MEDIA_ROOT and upload_to of the FileField. If I want to upload the > pictures to "MEDIA_ROOT/blog/p_id" where p_id is the ID of the blog > entry containing the FileField. How would I do that? > > If I user wants to upload n pictures (n > 1): How can I provide him > with multiple FileFields. Just creating a dozens of FileField in my > model just in case does not seem the way to go for me. Is there a > Django solution for a variable number of fields of the same type? > Well, I could make just the FileField a seperat model and use a 1:n > relationship. Any other ways? > > Thanks for all your ideas and comments, > > Florian > > [1] like that: >  --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---