Domanda

I'm currently trying django tinymce, I want to show on the main page a truncated text of around 200 characters in total.

The problem is that I don't want html tags to show up nor images to show up in this truncated text.. Is there an easy way to solve it?

Example: If an image is in between the 200 characters, the img tag, attribute and so on will show up and if i used the safe template tag, the image will be rendered. How should I solve this issue? should I write my own template tag and remove the images?

Second problem is that I couldn't find the option to browse images from the user PC and upload it. I don't want any page to view the media, I only want to browse and upload images.

È stato utile?

Soluzione

1) Django includes a template tag striptags to strip html tags. It uses regular expressions, it's not the right solution but it'll do the job.

2) It seems, browsing images is not included as an option in django-tinymce. You need to use another module and integrate it with TinyMCE to do the job.

Altri suggerimenti

You can use django-multiuploader to upload images. I had nice experience with it.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top