[Django]-How to make complex post with Django blog

6πŸ‘

βœ…

I think you make be looking for a rich text editor if I understand your question correctly.

There are two rich text editors that are (seemingly) the most popular tinymce and ckeditor.

Here’s a link to a few answers that may be of use to you for the admin part:

django-ckeditor-to-django-admin and django-admin-tinymce-integration

Both of which can turn your text area into rich text editors with the ability to insert code, images, even math etcetera.

You stated in your question:

I want my users to be able to upload images or adding code sample inside the text area.

Which seems to fit the above options (or another editor).

πŸ‘€Pythonista

1πŸ‘

A lightweight option would be to use Markdown instead of a raw text field.

This project : https://github.com/jamesturk/django-markupfield provides a field that you can choose to parse with Markdown or other parsers. This way, you can add code samples (with ```, like in StackOverflow).

Note : the code blocks aren’t colored.

You can also include images with ![my alt text](http://example.com/image.png), though you have to upload them somewhere on the internet.

For uploading images directly through the Django admin page, you may use an ImageField

πŸ‘€Gabriel

Leave a comment