javascript - Inserting an image between text in django when both text and image are in the model -


i'm looking way of inserting image in between text of blog made django. want achieve in following image:

enter image description here

as see text divided in 2 columns. there titles, links image , caption.

right model like:

class post(models.model):     body_col1 = models.textfield()     body_col2 = models.textfield()     body_col1_html = models.textfield(editable=false, blank=true, null=true)     body_col2_html = models.textfield(editable=false, blank=true, null=true)     image = image = models.imagefield() 

the text transformed markdown can add css format in admin panel. did render variables in html template using tags:

<div class="column-left">     {{ object.body_col1_html|safe}} </div> <div class="column-right">     {{ object.image}}     {{ object.body_col1_html|safe}} </div> 

doing have 2 columns , image on top of second column.

i'm looking way remove 2 fields text, have 1 text field, can add image inside text. have javascript function automatically divides text 2 columns. have this:

<div class="columns">     {{ object.body|safe}} </div> 

where body field have image inside (the same way can add css or links).

what tried far add tag in text box {{object.image}} but, since i'm using markdown, converts text instead of image got useless string.

is there way add image body text box in admin panel? call template tag there?

the code of django blog here.

i think need called rich text editor, allow build external html pages want , safe them singe field in database. 1 of popular editors ckeditor, suggest take @ at django-ckeditor


Comments

Popular posts from this blog

ruby - Trying to change last to "x"s to 23 -

jquery - Clone last and append item to closest class -

css - Can I use the :after pseudo-element on an input field? -