django-tinymce to work on all textareas in django admin - python

I have been trying to get tiny mce to work for my django admin site on all textareas without having to add each field's widget. I have a lot of forms and would like this to work as "automagically" as possible.
I have installed tiny mce using the "pip install django-tinymce" method.
I have followed the following article and even though it does not throw any errors in firebug or developer mode I cannot see what I am doing wrong.
https://blog.bixly.com/django-tinymce-in-djangos-admin-app
I have followed this to a the letter with no luck at all. Any thoughts or suggestions to get this working on all textareas would be greatly appreciated.
Thanks,
jAC

I was able to get this to work by using admin.py's ModelAdmin classes.
For example:
#admin.register(HomePageSlider)
class HomePageSliderAdmin(admin.ModelAdmin):
class Media:
js = ( '/static/assets/js/tiny_mce/tiny_mce.js' , '/static/assets/js/tiny_mce/textareas.js' )
The first part is for the tinymce location and the second is loading the configuration that i threw in a textareas.js file.

Related

Django Admin ERR_QUIC_PROTOCOL_ERROR

Django Admin list view page for a single model returns a blank page. it only load some of the buttons. console shows this error Failed to load resource: net::ERR_QUIC_PROTOCOL_ERROR. Have been trying somethings but couldn't solve this one. Also it doesn't happen on local machine. I am using django jet. tried using the vanilla django admin but still the same error. Other than this model all the other model's list view page is working fine.
If anyone has faced this error in the past or know anything about it, suggest me some fixes. any help would be appreciated. Thanks

Is there any other way to implement RichTextField in a django blog

I'm working on my blog web using django. In my models.py I implemented RichtextField instead of the normal CharField or Textfield or others. I already imported it like this from ckeditor.fields import RichTextField after installing 'ckeditor' in 'INSTALLED_APPS in my projects settings.py.
Everything is working just Fine!
But there is problem!
The problem i'm facing is, I don't get to see the result of whatever I type in in my Django admin site using the RichTextField except plain text and some HTML tags in my localhost page.
What I mean is:
Supposing in my text-typing, I have something like this 'This is a bright new day...', and I want to bold 'bright' like this- 'bright'. I get to see it working perfectly in my django admin site. But when I refresh to my localhost page to where the text-typing is displayed, I get to see some weird HTML tag like this <b 'bright' /b> instead of 'bright'. And it did the same thing when I used summernotes.
So, please I will like to know why it's going that direction instead of the direction I want.
Secondly, the possibly solution to help me make move in the direction I want.
This same problem cut across to when I want implement codes, italics, headers, etc. in my whatever text I wish to change to those form.

Heroku Django Admin returns 'FileNotFoundError at /admin/projects/project/add/'?

I am trying to setup a Django admin page to be able to update my project portfolio directly. Everything works fine until I click on the 'add project' button. Then I'm hit with an error:
I do not understand what it is looking for. Any insight would be helpful as I've tried searching google/stack and haven't found a similar issue with a solution. If you need more information, let me know and I'll update my question.
I think the problem is in the file path on your django models. try changing the
models.FilePathField(path='#fullpathtoyourphotosdirectory')

django-tellme rendering problem in django admin

I installed this app but when I run it, I get a error in django admin, it does not rendering HTMl text as it should have done, I'm not familiar with how to make these customizations, I have also posted a issue, if it help in understanding my problem, I hope I get a solution for this.
Thanks
I check and asked this question to few more peoples and check the repo carefully and I got the solution that if I use
from django.utils.safestring import mark_safe
when returning elements then it will render html in admin too
you can see it here

how to make django comment model field Site not required

I'm using django-threadedcomments from ericflo on github. This app simply extends the native django comments framework. I am running into the same issue with both frameworks. I continue to get an error relating to mysql that site_id cannot be null. I have no use for the Site field in my comments. I tried to extend the Comment model with my own making site both blank and null but I am still getting the same error. What is the proper way to override that requirement? Thanks
I tried:
class Comment(Comment):
site=models.ForeignKey(Site,null=True,blank=True)
I found it easier to just define one Site object. django-threadedcomments is not the only extension which requires that.
You will not be able to change this without monkey-patching the current model, but it shouldn't be a big deal setting the site field to Site.objects.get_current() in the view/form when saving a comment!

Categories