Storing HTML in DB using DJANGO

27 views
Skip to first unread message

Sipum Mishra

unread,
Apr 20, 2019, 2:08:41 PM4/20/19
to Django users
Hi friends,

I want to store a html in database using python and need to retrieve that html and convert that in to PDF.
can u plz suggest me how to store that HTML in DB ?

Jani Tiainen

unread,
Apr 21, 2019, 8:42:26 AM4/21/19
to django...@googlegroups.com
Well after all, HTML is just plain text... Though you probably want to think to do some sanitization so you won't get nasty injections via html.

--
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/f301b675-6587-434e-b25d-87de9d9fef10%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--
Jani Tiainen
Software wizard


Always open for short term jobs or contracts to work with Django.

Brian M

unread,
Apr 21, 2019, 10:50:51 AM4/21/19
to django...@googlegroups.com
What if you convert the html to an array of bytes before storing? 

Then you’d convert from bytes array back to string when you retrieve. This way you’d store raw data.

Joel Mathew

unread,
Apr 21, 2019, 12:04:12 PM4/21/19
to django...@googlegroups.com
I fail to see the purpose of that. Serialisation is sufficient. Big projects like wordpress store even big blog posts, which is html like this.
Sincerely yours,

 Joel G Mathew



Sipum Mishra

unread,
Apr 21, 2019, 12:39:09 PM4/21/19
to django...@googlegroups.com
thank you all guys for suggesting.

can I plz get any tutorial for these so that I can learn that properly.

Reply all
Reply to author
Forward
0 new messages