Easy Web Content Snippets with Django-Addendum

Easily edit arbitrary text snippets on a site without a full-fledged CMS or issuing another site release. Like a mini-CMS for every site.

Surely, you’ve never built a site and later heard:

Hey, we need to change the greeting on login from “Hi!” to “Sup?”

Or:

The footer copy needs to be udpated.

Or:

The marketing team would really like to be able to change that message on a monthly basis. I don’t care that that’s a third-party appliwhoozitz!

No, of course not!

This is usually basic boilerplate or one-off marketing copy. And usually it doesn’t need to change. Usually. When you do need to change it, the site managers or content editors have to wait for a new release from someone else.

A mini or anti-CMS

The answer to editing site content is a content management system. But while a full CMS is the right answer for a publishing site, it’s not for many sites.

For data driven applications (like the assessment tracking system we developed) or user driven application (like BuzzTown, with its local business generated content) there isn’t a need to have a typical page driven CMS. Instead the need is to update copy here and there, usually nothing that demands the likes of a Django CMS.

Django-Addendum allows you to delineate short snippets of code that should be editable by a site administrator if necessary, but that also shouldn’t require user input.

The scenario

Let’s say you have some footer text:

<footer>
<p>&copy; 2012, The Acme Companies.</p>
<p>The 2nd Best Company in the World!</p>
</footer>

That’s the copy the team decided to go with, so that’s now coded into the base template.

But it’s not 2012 anymore! Well, we can solve the copyright year issue with a template tag so it’s always up to date, but a month later the sales team says the company is now the first best. And then a month later everyone finds out that the company is actually the best in the galaxy.

It’s a simple change, but the marketing director wants the changes made right away, and each time she makes the request the development team is at a beer making offsite meeting.

The solution

Let’s make those snippets editable:

{% load addendum_tags %}
<footer>
<p>{% snippet 'footer:copy' %}&copy; 2012, The Acme Companies.{% endsnippet %}</p>
<p>{% snippet 'footer:winning' %}The 2nd Best Company in the World!{% endsnippet %}</p>
</footer>

By default it’ll look like the first example:

<footer>
<p>&copy; 2012, The Acme Companies.</p>
<p>The 2nd Best Company in the World!</p>
</footer>

But once some content has been added for the matching keys, it shows what the content manager added:

<footer>
<p>&copy; 2013, The Acme Companies.</p>
<p>The Best Company in the Galaxy!</p>
</footer>

And of course the base language can always be changed later to keep the codebase up to date - or not. Does it really matter anymore?

The limits

Django-Addendum is very basic by design. It’s made with the primary site content managers in mind, not just any user. You also need to know how the snippet keys have been named. That’s probably the biggest drawback right now, and something we’re keen to update in the future.

You can get started with django-addendum right now by installing from PyPI or forking.

pip install django-addendum
blog comments powered by Disqus