Best way to build a custom Django CMS - python

I am new to Django, but heard it was promising when attempting to create a a custom CMS.
I am looking to get started, but their seems to be a lack of documentation, tutorials, etc on how to actually get something like this going.
I am curious if their are any books/tutorials/guides that can help me get started with CMS django building.
PS- I have heard of django-cms, but am unsure what exactly it is and how it is different from django.

Here is a list of tutorials that has been put together by authors of Two Scoops of Django. http://twoscoopspress.com/pages/django-tutorials

django CMS is a CMS on top of django. It supports multiple languages really well and plays nice together with your own django apps. The basic idea is that you define placeholders in your template and then are able to fill those placeholders with content plugins. A content plugin can be a anything from text, picture, twitter stream, multi column layout etc.

You can look into this, it's about creating placeholder that can be replaced later, which is what CMS is, technically
https://docs.django-cms.org/en/latest/introduction/02-templates_placeholders.html

Related

Highly customized admin - Create an app or hack the source code?

I have been facing a big challenge with django since I was assigned the task to rebuild the admin page of our platform. I started unsure of what to do and now that I am half way on, I am even more unsure.
Here is my question:
If I want to build a highly customized admin, should I do a giant hack on the source code or create a new app?
1) Giant Hack
That is how I started and got stuck. A couple of problems appeared on the way, for instance:
I had to extend the AdminSite and override every view I wanted to change
Django's admin is very modular (I mean, very very modular) and a screen might be the sum of tons of other templates
Creating a simple navbar is a pain in the ass (at least it has been for a newbie like me). This is due to the fact that app_list (the variable that contains the mapped models to show in admin's first page) not being accessible when other templates rather than base.html are injected. Thus, I would have to create a context processor, replace every TemplateResponse() by render() (technically, since I tried to do it and it didn't work as well)
The problems go on and on. Given my lack of experience with django, I might be doing crap, but it does feel like I am on the wrong way.
this guy's answer motivated me to post this.
2) Building a brand new app
Of course it will take a little while to implement this, but it seems like a robust and maintainable way of getting it done. One of the points is that I will need to give the same flexibility as the default admin site gives when adding models and promptly having their cruds and tables (I am not really sure how to accomplish this behavior).
I am pretty new to django and any guidelines will be highly appreciated. Give me your thoughts on how to make it.
There is no need to overwrite admin views. The easiest way is to overwrite the templates and add your own css & javascripts.
I have added my own navbar, sidebars and bottom. It is really easy if you overwrite the admin base templates.
If needed you can provide custom data to the template by using own templatetags.

Django models and multilingual websites

I have a model that has multiple text properties - title, short and long description etc. I want to have multilanguage site so I need a way to easy by able to add new languages and translations for this field for every item. What is the best way to achieve this?
Django has built-in support for I18N (read internationalization):
http://docs.djangoproject.com/en/dev/topics/i18n/internationalization/
Some possible multilingual model candidates:
http://code.google.com/p/django-multilingual-model/
http://and-other-things.blogspot.com/2009/04/list-of-django-multilingual-model.html
I found that django transmeta, also listed by The Myyn is actually quite right for what llian is looking for. We have a very similar setup in production for some of our high traffic websites.

Using Django CMS

I know python and have just read a basic intro of django. I have to built something like a travel website with real time updates. Will django be sufficent for this? Somebody advised me to look at django-CMS, I couldn't find a very beginner's tutorial there. Should I opt for django-CMS? Also how much of django should i know before i can try out django-cms?
Edit: Not too much real time stuff but just updates on the fly, like availibilty etc. Do i really need CMS?
Thanks
From your brief description it sounds like the main part of you project will be something that manages travel information and displays it to visitors to a website. This definitely sounds like something Django would be perfect for.
Django projects tend to be very modular, so the content management part of you code would likely be completely distinct from the travel parts of your project. Personally I'd start with the core travel functionality, rather than start out with worrying about content management. Then once you have that in place you'll be better positioned to decide whether django-cms fits your content needs, or whether something hand rolled will do.
Start by defining your models for the travel application. Then register those models with the admin. Get happy with how the data is modelled and then try and create one of the basic views. You should have something up and running pretty quickly.
You might also be interested in the GeoDjango project http://code.djangoproject.com/wiki/GeoDjango which provides lots of geographical and mapping tools - which sounds pretty relevant to your project.
I would say no. Django CMS is well designed, if you change content frequently. It has nice features to build up a page. But that means it only shows its benefits, when you create a lot pages/subpages and so on.
For a simple website that only presents data, without adding new pages/views, Django will suffice.
And from my experience, you should at lest be familiar with Views and URLs in order to use Django CMS well. But the same applies to Django itself. Everything else can be found on google.
Hope that helps.

customizing Django look and feel in Python

I am learning Django and got it to work with wsgi. I'm following the tutorial here:
http://docs.djangoproject.com/en/1.1/intro/tutorial01/
My question is: how can I customize the look and feel of Django? Is there a repository of templates that "look good", kind of like there are for Wordpress, that I can start from? I find the tutorial counterintuitive in that it goes immediately toward customizing the admin page of Django, rather than the main pages visible to users of the site. Is there an example of a "typical" Django site, with a decent template, that I can look at and built on/modify? The polls application is again not very representative since it's so specialized.
any references on this would be greatly appreciated. thanks.
Search for generic CSS/HTML templates, and add in the Django template language where you need it. Because unless you are trying to skin a particular app (such as the admin system), there is nothing Django-specific about any of your HTML.
The fact that you're thinking in terms of Wordpress templates, and that you think the tutorial's poll application is highly specialised, are hints that you haven't really grasped what Django is. It isn't a content management system or a blog engine, although it can be used to build those things.
There's no such thing as a typical Django site, and it simply doesn't make sense to have pre-packaged templates, because the front end could be absolutely anything at all - like a poll.
You write the template like you would write any standalone HTML+CSS page, perhaps with placeholders for the content, then turn those placeholders into actual Django template tags. If you know how to do write HTML, then you know how to make a Django template.
Actually Django does not have a "look and feel". You are probably referring to the built in Django Admin application. That app comes with its own templates.
There are third party applications that can change the Admin interface, Django Grapelli is a great example.
For any other application you want to build yourself, or download. Most likely you'll have to do the templates yourself. In order to come up with something pretty you need to learn about CSS/HTML/JS and design principles as the Django Templates will quite likely be out of your way.
I always recommend HTML Dog for learning the basics of HTML, CSS and JS.

How can I use Django admin list and filterering in my own views?

I’m just beginning to learn Django and I like the automatic listing in Django admin and the way you can configure filters and what columns to show. Is it possible to use it in my own applications?
I’ve looked in the source for the admin and figured out that I probably want to subclass the “ChangeList”-object in some way and use it in my own views. Any ideas?
You're better off doing the following.
Define a regular old Django query for your various kinds of filters. These are very easy to write.
Use the supplied generic view functions. These are very easy to use.
Create your own templates with links to your filters. You'll be building a list links based on the results of a query. For a few hard-coded cases, this is very easy. In the super-general admin-interface case, this is not simple.
Do this first. Get it to work. It won't take long. It's very important to understand Django at this level before diving into the way the admin applications work.
Later -- after you have something running -- you can spend several hours learning how the inner mysteries of the admin interface work.

Categories