Re: adding images to my content

2006-10-16 Thread RajeshD


> > > The admin does not show the full path of the uploaded file, so the end
> > > user would need to fiddle with the path ... trying to smoothen this
> > > process so the url that is displayed in admin is the full path or at
> > > least a path that works.  Or god forbid drag and drop! ;)
> > As a quick fix, in the admin list page for your images, you could add a
> > custom column that does show the correct (Markdown-friendly) path for
> > each image. The user could then cut and paste that path into the
> > Markdown based text where needed.

> Another column in the model that is updated from the other attributes
> of the object ...  sounds like it should do the trick.

Incidentally, I meant to say add a "display column" in the admin list
page through list_display and not add a database column to your model.
Basically, this "display column" would show output of a custom function
that's defined in your model. You could even use get__url in
your list_display directly. See below for more on that.

> It turns out MEDIA_URL is used to render the links for file fields as
> expected, but mine didn't have a trailing slash so was being truncated,
> hence broken.

I see.

 The anchor is rendered like {{ myapp.files.file }}
> which turns out to be something like  href="http://1.2.3.4:8000/media/upload/20060914R4.oak.pdf; >
> upload/20060914R4.oak.pdf .

A better way to render the anchor is to use the get__url
method in your model where fieldname is the name of the FileField. See:
http://www.djangoproject.com/documentation/model_api/#filefield

>
> I think I will change this to
> Tutorials 1-N Sections
> Tutorials 1-N Files
>
> So files can be reused in different sections and both sections and
> files can be edited in one admin screen using edit_inline.
> 

Yes, reuse is a good thing ;)


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



Re: adding images to my content

2006-10-16 Thread RajeshD

>
> The admin does not show the full path of the uploaded file, so the end
> user would need to fiddle with the path ... trying to smoothen this
> process so the url that is displayed in admin is the full path or at
> least a path that works.  Or god forbid drag and drop! ;)
>

As a quick fix, in the admin list page for your images, you could add a
custom column that does show the correct (Markdown-friendly) path for
each image. The user could then cut and paste that path into the
Markdown based text where needed.


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



adding images to my content

2006-10-16 Thread Milan Andric

Hello,

I can serve my static files no problem,
in apache I did 
SetHandler None and an Alias /media
/homedir/djangostuff/myapp/media.

The trick comes in the process or flow of adding files/images into a
body of text.

I'm adding content to the db through the admin and using markdown in
the content for rendering html ... works great.  Now I'd like to add
images to the post , embed them inline:

in markdown that's ![alt text][/my/path/image.jpg "title"]

The admin does not show the full path of the uploaded file, so the end
user would need to fiddle with the path ... trying to smoothen this
process so the url that is displayed in admin is the full path or at
least a path that works.  Or god forbid drag and drop! ;)

I got some hints that the best way to do that would be to use a custom
admin template. admin/myapp/mymodel/change_form.html.

Any more help? Thanks.


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