Does django-cms really integrate with django and models - django

I am migrating an existing small business admin system that uses a variety of spreadsheets and access databases to a Linux server to provide both intranet and internet access to our own office staff, to external partners and to customers.
There is some fairly complex database work which will be using postgreSQL and python.
There needs to be a professional looking public website which can access some of the database content both to generic "customers" and tailored data visibility to actual clients.
None of the traditional CMS offerings like wordpress, drupal, joomla etc seemed flexible enough, so I found my way to django.
I've built models, populated data tables, built some basic views to manipulate the data and started to play a bit with html layout tags and css, and I've started looking at forms including crispy-forms.
I need to work with pdf files - scanning, uploading, splitting into single pages, displaying on the site alongside form data entry etc.
I was hoping that I could use django-cms to handle the aspects of the public facing words and pictures and dealing with the jpgs pdfs etc, and to do the page layout stuff, while using django models and python to simplify the database access and provide the intelligence.
When I read the django-cms docs around integrating models I get the impression that there is not really a proper integration - that you can build a site that switches between cms pages and django pages or maybe embeds a django view into a cms page, but I'm not sure if I can do the look and feel and static bits in cms and the dynamic bits on the same page in django without still having to do the work in django as well.
the django system revolves around the models, the django-cms docs read as if models are some sort of extra bit you might want to use.
There's talk of the different ways to integrate django models but they all treat the django model as a foreign item that can be added.
I've found other people who've asked "how does django-cms work with django models" and the answers seem to be no different from those that ask "how do I ad a django model to a drupal site"
So my question really is - does django-cms integrate with django to provide ease of building sites with good integration between cms features and model features or are they really two separate systems that can share space on the same page with a bit of work but don't play nice together in any useful way?
Is there another tool I can use for my static stuff and page formatting and navigation to integrate with my models and python code?

Yes
Yes, it does integrate with django and it does provide ease of building sites with good integration between cms features and model features. Like comment by Simeon Visser hinted - you can create your own plugins to add managing different features into django cms part. And most often - most things will not need such integration - simple django admin views and models will suffice.

Related

Django model React

I'm trying some Django + React stuff and I'm a bit confused with the particular role of Django model in this scheme.
As I can understand Django model provide smooth way to create some typical forms by users of the site (please correct me). And I can't feel the edge of what should be hardcoded and what I need to store in model.
In case of React (I'm trying to connect react with django through api via djangorestframework) should I create a model for Header? And store bg image with it and my slogans. I feel it's should be purely in frontend. But next section with 3 typical screens (they will be listed horizontally and swap each other). They are just copy of each other with different data (title, bg, fg, text, link), for me it seems closer to model usage. But model initially empty and if I want to get this data from model I firstly need to somehow store this data to model.
So in general my question is what the right cases for using Django models and when it's no needed. And if it possible with applying to my example to better understanding for me )
ofc I searched this info widely but so far can't create clear understanding by myself.
Thanks )
You might actually be in search of a headless CMS.
To combine React and Django and still use a CMS to allow administrating text blocks and images, Django Wagtail's StreamField is a good choice.
https://docs.wagtail.io/en/v2.0/topics/streamfield.html
See for example our company's homepage: https://www.blu-beyond.com. It runs on Django Wagtail, having JS animated text blocks that are administered in the CMS (just jQuery and other JS libs, no React, in this case).
Django Wagtail offers a JSON API, as well, that can be used in React:
https://docs.wagtail.io/en/v2.8/advanced_topics/api/v2/usage.html#fetching-content
It also offers a GraphQL API.

Can I extend django admin to one of the good looking bootstrap admin templates?

I am trying to use django as the platform for a website development. I was using wordpress so far. I liked its CMS and admin system. Can I make a function rich admin backend with django that has; pages, menus, categories, tags, posts, images etc. as the wordpress. In order to make it look good, is it possible to use boostrap or similar dashboard templates? How much of difficulty are you expecting for this project?
Looking forward for your opinions
Thanks
Django admin is a great utility that comes with django, which helps to create basic CRUD application very quickly.
Now customizing it can be somewhat difficult because it is tightly coupled.
Thought the docs are awesome and you can see if the customization will get your work done. There are many themes available such as django-suit, django-jet etc. which makes it even more awesome.
You might also want to have a look at django-cms and wagtail.
Hope it helps!

Django vs Django-CMS -business compare site

I've developing in django for the past few months and I find it extremely great.
My next project is a price-comparing site for local businesses - where each user can add business and comment on each.
The admin of the site won't be a programmer, but with basic knowledge in web and python.
Should I stick to the old familiar django or should I try it out?
Thanks :)
Matan.
django CMS is built on top of Django and meant to be integrated into existing Django applications or extended with new ones. So your question is flawed.
So instead ask yourself if you need CMS functionality (pages managed by your admins). It sounds like your main app (the compare bit) is better handled by a Django application, but maybe you want the site admin to be able to easily edit the About Us page etc, this is where django CMS could come in handy.

CodeIgniter & Datamapper as frontend, Django Admin as backend, database tables inconsistent

I created a database for a site i'm doing using Django as the admin backend. However because the server where the site is hosted on, won't be able to support Python, I find myself needing to do the front end in PHP and as such i've decided to use CodeIgniter along with Datamapper to map the models/relationship.
However DataMapper requires the tables to be in a specific format for it to work, and Django maps its tables differently, using the App name as the prefix in the table. I've tried using the prefix & join_prefix vars in datamapper but still doesn't map them correctly.
Has anyone used a combination of this? and if so how have the fixed the issue of db table names being inconsistent? Is there anything out there that i can use to make them work together?
----edit: clarification on backend---
Let me clarify: i'm going to be running the admin from a subdomain pointing to a python ready server. However i can't move the main domain name from the php only webserver because of certain constraints/binding contracts the company got itself in. and don't want to use cloaking/masking because of seo purposes.
i'm using the django admin because i'm using some packages to make a pretty/functional admin, such as grappelli for the admin template, along with its editor for editing news stories, etc. also using photologue to manage photos/galleries. etc.
If your problem is simply making Django use the same tables as your other software, use the db_column and db_table parameters in the models.
http://www.djangoproject.com/documentation/models/custom_columns/
Two apparent solutions:
Instead of hacking one or both to work well with each other, emulate the Django admin in PHP/CodeIgniter code. **
Get a server that supports Django. Make the frontend in Django.
Time-wise, either one of those solutions will be less involving than trying to make two different frameworks using different programming languages mesh well together. I can't imagine the future maintenance required to ensure everlasting compatibility and interoperability.
Also, I assume by saying:
I created a database for a site i'm doing using Django as the admin backend
You really mean that you modeled your apps using Django, and that you also intend on administrating the database that has resulted from this modeling in the Django admin. (In which case you already have your Models layer complete and should just try building the rest of the site in Django)
If that's the case then in your models you are going to need to define the exact column names (db_column) that DataMapper will expect, as well as manually define the table names (db_table), including M2M tables.
You may also have to define all of your primary keys manually, if DM expects something named differently.
Also:
If the server can't support Python, where are you going to be running your backend? Different server? Locally? This plan just isn't making a lot of sense.
** I would not suggest trying this. I had been attempting to make a CI backend that actually shared much of the same ideas as Django's admin, before I knew about Django's admin. And of course once discovering Django, I dropped the CI work immediately and continued on with what I have found to be a much more amazing framework that is much faster to develop on.
So as I understand you plan on using Django just because of django-admin, and you are trying to use CI for the actual site because the server runs PHP, right?
So why don't you use framework that generates something like Django's admin but that you can run on your server?
The Symfony Framework has a really nice admin generator, in the spirit of Django's and you might be able to run it on your server. This would save you from the maintainance nightmare that might come later as #jonwd7 answered

How to port from Drupal to Django?

What would be the best way to port an existing Drupal site to a Django application?
I have around 500 pages (mostly books module) and around 50 blog posts. I'm not using any 3rd party modules.
I would like to keep the current URLS (for SEO purposes) and migrate database to Django. I will create a simple blog application, so migrating blog posts should be ok. What would be the best way to serve 500+ pages with Django? I would like to use Admin to edit/add new pages.
All Django development is similar, and yours will fit the pattern.
Define the Django model for your books and blog posts.
Unit test that model using Django's built-in testing capabilities.
Write some small utilities to load your legacy data into Django. At this point, you'll realize that your Django model isn't perfect. Good. Fix it. Fix the tests. Redo the loads.
Configure the default admin interface to your model. At this point, you'll spend time tweaking the admin interface. You'll realize your data model is wrong. Which is a good thing. Fix your model. Fix your tests. Fix your loads.
Now that your data is correct, you can create templates from your legacy pages.
Create URL mappings and view functions to populate the templates from the data model.
Take the time to get the data model right. It really matters, because everything else is very simple if your data model is solid.
It may be possible to write Django models which work with the legacy database (I've done this in the past; see docs on manage.py inspectdb).
However, I'd follow advice above and design a clean database using Django conventions, and then migrate the data over. I usually write migration scripts which write to the new database through Django and read the old one using the raw Python DB APIs (while it is possible to tie Django to multiple databases simultaneously, too).
I also suggest taking a look at the available blogging apps for Django. If the one included in Pinax suits your need, go ahead and use Pinax as a starting point.
S.Lott answer is still valid after years, I try to complete the analysis with the tools and format to do the job.
There are many Drupal export tools out of there by now but with the very same request I go for Views Datasource choosing JSON as format. This module is very solid and available for the last version of Drupal. The JSON format is very fast in both parsing and encoding and it's easy to read and very Python-friendly (import json).
Using Views Datasource you can create a node view sorted by node id (nid), show a limited number of elements per page, configure a view path, add to it a filter identifier and pass to it the nid to read all elements until you get an empty JSON response.
When importing in Django you have a wide set of tools as well, starting from loaddata to load fixtures. Views Datasource exported JSON but it's not formatted as Django expects fixtures: you can write a custom admin command to do the import, where you can have the full control of the import flow.
You can start your command passing a nid=0 as argument and then let the procedure read, import and then fetch data from the next page passing simply the last nid read in the previous HTTP request. You can even restrict access to the path on view but you need additional configuration on the import side.
Regarding performance, just for example I parsed and imported 15.000+ nodes in less than 10 minutes via a Django 1.8 custom admin command on an 8 core / 8 GB Linux virtual machine and PostgreSQL as DBMS, logging success and error information into a custom model for each node.
These are the basics for import/export between these two platform, for detailed information I described all the major steps for export from Drupal and then import to Django in this guide.