Code Monkey home page Code Monkey logo

django-addendum's Introduction

Django Addendum

Build Status

Current PyPI release

Download count

Change snippets of copy on your site, on the fly, for any application, and without a full-fledged CMS.

Solving queries like:

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

And:

The footer copy needs to be updated.

And:

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!

This is all simple stuff and it's probably coded right into your templates. Changing it is easy enough, but requires a developer and then a release. Boo!

Usage

Just add addendum_tags to your templates:

{% load addendum_tags %}

{% snippet 'home:greeting' %}Hi!{% endsnippet %} {{ user.first_name }}

<footer>
  {% snippet 'home:footer' %}&copy; 2011 by Acme Corp.{% endsnippet %}
</footer>

Now you can edit content for these placeholders from the admin interface. If you don't add anything or you delete text, the site text will always revert to what is in the template.

Use it for small bits of user modifiable text from any template on your site, and for swapping out -lorem ipsum- text when prototyping.

Find some more information in the docs

Installation

Install the package from PyPI:

pip install django-addendum

Add it to your INSTALLED_APPS tuple:

INSTALLED_APPS += ('addendum')

Contributing

Contributions are welcome but should follow some basic guidelines to make life easier:

  • Pull requests should be made from distinct branches that include only the requested changes branched from the canonical master branch.
  • Include tests for bug fixes and new features. Ensure that your Travis build is passing before submitting the pull request.
  • Include documentation for any new features.
  • For multi-commit updates please squash commits so the packager maintainer only has at most a few commits to review.
  • Please limit changes to your specific pull request (excluding extraneous changes and please do not bump the version for your own changes).

License

BSD licensed.

Testing

To run the tests, clone the repository and install tox.:

pip install tox

Then use the command:

tox

To run the tests against specified (or all) environments.

Otherwise, install the test requirements in requirements.txt and then run the py.test comand. tox is recommended.

django-addendum's People

Contributors

bennylope avatar cirotix avatar jscissr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

django-addendum's Issues

Initial Migrations Failing with South

When installing the app and creating DB tables with south, there are errors with migration 0004.

Specifically, running "python manage.py migrate addendum" causes:

  • Migrating forwards to 0004_auto__del_field_snippet_id__chg_field_snippet_key__add_unique_snippet_.

    addendum:0004_auto__del_field_snippet_id__chg_field_snippet_key__add_unique_snippet_
    FATAL ERROR - The following SQL query failed: ALTER TABLE "addendum_snippet" ADD CONSTRAINT "addendum_snippet_45544485" UNIQUE ("key")
    The error was: relation "addendum_snippet_45544485" already exists

Exception raised is from line 27 of migration 0004:
RuntimeError: Cannot reverse this migration. 'Snippet.id' and its values cannot be restored.

Suggest nuking the migration history and starting with a new, clean 0001 :)

Cannot save without content despite what docs say

In the docs it says:

If you don’t add anything or you delete text, the site text will always revert to what is in the template.

However when I try to save with no text, I get an error that the field cannot be empty!

image

Do you like implement inline-editor and optional WYSIWYG?

Your application I almost fit!

As I see it in final form:

  • There is a special templatetag, as the "snippet", but without specifying a token (optional)
  • There is a model with fields: token, text, created_at / updated_at + languages ​​like you have now

Process:

  1. In some templates inserted such blocks
    {% snippet%} Hello, Kitty! {% endsnippet%}
  2. If we "user.is_staff", the toolbar appears on the page "Editable mode (Languages: en / ru / zh and Logout link)" for each snippet-block there is a link "Edit"
  3. By clicking on the "Edit" appears inline-editor like that http://ckeditor.com/demo#inline
  4. When saving "Hello, Kitty!", If we do not specify a token for the snippet, then we get the hash from the "text (original, from template) + template_name" as a token

Are you interested in such a change in your application?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.