Django CMS CSS styling - django

so I’m working with Django and I’m trying to figure out how in the edit the CSS using nothing but Django CMS?
Is there a way?
Anything would be helpful.

Django CMS does not have any inline editing features of CSS or any other markup. This is by design and it is not something like Wordpress.
To edit CSS you will need to create your own css files as part of your project.

If you need to add eg an HTML or CSS snippet into a page, there's an offical plugin for that 👌 - https://github.com/django-cms/djangocms-snippet
And as #Aiky30 said, the global CSS code is better to place in static in accordance with django best practices.

Related

How can I upload new webpages to a django app?

I am quite new to django so I am sorry if I have overlooked something simple.
This is my current website: https://www.michealnestor.com
I am trying to remake it using react and django, and a lot of it is different, however I want to keep the functionality of being able to run my js apps from the website: https://www.michealnestor.com/projects EXAMPLE: https://www.michealnestor.com/projects/sortingalgorithms/ .
I want to be able to upload project folders, with html, css and js in them from the admin page, and then be able to open these projects from my website. I am not sure how to do this though.
I have tried manually placing such a folder in a templates folder in my app, and I have managed to use a view to load the html file, but this file can't seem to find the css and js.
Maybe I am going about this the wrong way, in any case I would appreciate some guidance!

Django - Best way to organize/serve mostly static website?

My friend with very little coding experience began making a business site and passed it on to me. Currently, it is mostly static html and css files but I want to take what he has and build on it using Django because I will be adding features like user login/auth and checkout. I was wondering what the best thing to do with all these html and css files are and how I might go about fitting it to Django framework.
All of the content on these pages will be static but I could imagine in the future once I add a login, the header might be different to show whether or not a user is logged in. Would I need to make separate apps for each page, include them all in one app, or just put them all in the static folder?
Would I need to make separate apps for each page
Assuming you are referring to django apps. Then No, you do not need to create a separate application for each page. django apps are a way to organize individual pieces of your projects.
To gain the most out of django, I would suggest looking into the Django Template Engine to improve the html (blocks, include and extend etc) and make it more readable and future proof ( urls, media, forms)
just put them all in the static folder?
I'm not sure you'd be able to get away with it being in the static folder, Static files in django are used for CSS and Media files such as images, videos etc. To render a template in django you need use render() or TemplateView
I hope this helps clear up some of your doubts.
Django is a Model-View-Template (MVT) framework where you create templates (HTML files) and use Jinja syntax there to display the data passed from Django views. You don't need to create apps for each page, instead, you can define functions in an app's views.py file and then reference that view from the corresponding path (URL) from the urls.py file.
You can create a main HTML template that will be extended by each sub-page. And applying your logic to your main template's header (i.e. if/else) in the main template will affect your all pages.
My recommendation is that you should first study the Django docs carefully and understand at least it's basics before starting the migration of the HTML site to Django. Django has one of the best documentation available for software on the Internet and you should be grasping the basics very quickly if you have a little programming background.

How to use django-ckeditor in frontend forms?

I'm working with Django. To integrate a Rich Text Editor with my site, I use the django-CKEditor from https://github.com/django-ckeditor/django-ckeditor
While it works quite fine in the Admin Panel, I'd like to use it in frontend forms to allow the users of my website to edit their own texts via CKEditor. But I can not figure it out...
Is it true that this django-ckeditor can only be used in Admin Panel? If it isn't true, how to make it available in the frontend? Or any recommendation for other Rich Text Editor which I can use at the frontend?
Thanks a lot!!!
I just include ckeditor in static/js and apply it to whichever fields I need.
I initially tried what you are trying, and this (more conventional) way was super easy.
http://ckeditor.com/download
This is an old question, but here is a new answer for people directed here by a search engine...
The js is already downloaded with the package, no need to add it to your statics again, just load the js by adding
{{ form.media }}
in your templates <form> </form> section and RichtTextFields will be rendered using RichTextWidget (with ckeditor js). Expecting form to be the template variable holding the form.
Reference: https://pypi.org/project/django-ckeditor/#outside-of-django-admin

Integrate existing blog code into Django-CMS?

If I already have a blog app done with Django and I want to use it with my new Django CMS site, is it okay to simply drop it into my new Django CMS project as a decoupled app and match anything /blog/ to the blog app as apposed to a Django CMS plugin? I guess what I need to know is when is it best to write my Django app as a plugin vs an entire app?
Thx
JeffC
Yes, but you don't just drop it into the urls.py, instead you can write an AppHook to tie your blog's URL scheme to a particular page in your CMS.
Plugins on the other hand are useful if you want to inserts particular aspects of you app into other page's placeholders - for example to show your latest 3 posts on the frontpage.
You might also want to include your blog's paths in a breadcrumb or menu on your site - in that case you need to write a custom Menu too.
Finally, it might also be useful to make use of django cms's placeholders in you blog model. His would allow you to post a variety of content via plugins.

WISiWYG with uploading pictures: Django way

I'm trying to integrate TinyMCE or CKEditor into Django, but I have no idea how to manage uploading pictures.
I've been searching and found some django apps, but they won't work with my Django version (1.1.1), buggy and not maintained.
Maybe I missed something? Can you please give me a step-by-step guide how to add WYSIWYG with uploading into django form?
Use TinyMCE or CKEditor with django-filebrowser.
Description from the official site:
The FileBrowser is an extension to the Django Admin-Interface in order to
browse directories on your server and upload/delete/edit/rename files.
include images/documents to your models/database using the FileBrowseField.
select images/documents for TinyMCE and CKEditor.
Try this:
https://pypi.python.org/pypi/Django-tinymce-filebrowser
Its allow to manage images and files from tinyMCE