textarea showing image instead of code

14 views
Skip to first unread message

akash...@ranosys.com

unread,
Mar 27, 2015, 3:36:32 AM3/27/15
to django...@googlegroups.com
Hie to all,
In one of my template i am using text area. The issue is that when i write html tags with some image link using img tag, when i am saving this i am getting image on the desription field.

Actual-Image is comming

Expected-I want HTML code to be displayed in the discription.

Please suggest

aRkadeFR

unread,
Mar 27, 2015, 5:12:05 AM3/27/15
to django...@googlegroups.com
Hello,

You could provide us more information when asking for
help please. Your template and view code at least.

I guess your problem is in your HTML but to be sure, please
dump your information at the POST request to see what
is send. Then review your template. Maybe there's a "name"
attribute on the img tag?

Have a good one
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/597ca45f-a1d9-43a4-a77b-a4ffc29d1b69%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Akash Patni

unread,
Mar 27, 2015, 5:21:00 AM3/27/15
to django...@googlegroups.com
Hi This is my html

{% block content %}

<!-- Begin Body Columns -->

  <div class="container-top">
        <div class="container-top-icon"><img src="/site_media/images/digital-assets-note-icon.png" alt="Notes" /></div>
        <h2>View Notes</h2>
        <div class="container-top-detail">See your notes details.</div>
  </div>
  <div class="clear"></div>

    {% for i in result %}
<div class="da_row">
   <div class="da_label">Note Title</div>
   <div class="da_description">{{i.note_title}}</div>
</div>
<div class="clear"></div>
<div class="da_row">
   <div class="da_label">Note</div>
   <div class="da_description">{{i.note}</div>
 
</div>
<div class="clear"></div>

<div class="da_row">
   <div class="da_label">Beneficiaries</div>
   <div class="da_description">
   {% if all_nominees %}
   {% for nominee in all_nominees %}
   {% if nominee.1 %}
   {{nominee.0.first_name}} {% if nominee.last_name %}{{nominee.last_name}}{% endif %} {% if nominee.0.is_charity %}(charity){% else %}(individual){% endif %}
   <br />
   {% endif %}
   {% endfor %}
{% else %}
<div>No beneficiaries at the moment.</div>
{% endif %}
   </div>
</div>
<div class="clear"></div>

<div class="da_row">
   <div class="da_label">Action</div>
   <div class="da_description">
       <div class="dashboard-options edit-btn"><a title="Edit" href="/user/notes/edit?id={{i.key}}">Edit</a></div>
       <div class="dashboard-options edit-btn"><a title="Delete" href="/user/notes/delete?id={{i.key}}" onclick="return deleteConfirmation();">Delete</a></div>
   </div>
</div>
<div class="clear"></div>
  {% endfor %}

{% endblock %}

This is my model

class AssetNotes(db.Model):
    user_id = db.ReferenceProperty(User)
    written_on = db.DateProperty(verbose_name="Note Date")
    note_title = db.StringProperty(verbose_name = "Note Title *")
    note = db.TextProperty(verbose_name = "Note")
    add_date = db.DateTimeProperty(verbose_name=None, auto_now_add=True)
    update_date = db.DateTimeProperty(verbose_name=None, auto_now=True)
    client_id = db.StringProperty(verbose_name = "Client ID", default="")
    def __unicode__(self):
        return self.note_title
I want to show only code but instead of that it is showing image in descrption field.

and the code contains image url.

--
You received this message because you are subscribed to a topic in the Google Groups "Django users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/django-users/6bheSzmXFGc/unsubscribe.
To unsubscribe from this group and all its topics, send an email to django-users...@googlegroups.com.

To post to this group, send email to django...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.

For more options, visit https://groups.google.com/d/optout.



--
Best Regards,
Akash Patni
Software Engineer

ranosys
  facebooktwitterlinkedingoogleplus 

Head Office: 
Oxley Bizhub, #06-48 | 73 Ubi Road 1 | Singapore - 408733
Tel: +65 66331556  |  HP: +65 98573420

Global Offices:
San Francisco, USA | Jaipur, India | Bikaner, India


aRkadeFR

unread,
Mar 27, 2015, 8:29:54 AM3/27/15
to django...@googlegroups.com
What is db.TextProperty!? Is it Django?
Where the "result" variable comes from?

please read:
https://docs.djangoproject.com/en/1.7/ref/models/
Reply all
Reply to author
Forward
0 new messages