> > > 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_<fieldname>_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 <a href="{{
> settings.MEDIA_URL }}{{ myapp.files.file }}">{{ myapp.files.file }}</a>
> which turns out to be something like <a
> href="http://1.2.3.4:8000/media/upload/20060914R4.oak.pdf"; >
> upload/20060914R4.oak.pdf </a>.

A better way to render the anchor is to use the get_<fieldname>_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 [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---

Reply via email to