A small app to ensure your users re-agree to Terms of Service changes
Find a file
Frank Wiles 559280f043 Merge pull request #3 from cypreess/master
Bug fixes and merge with saebyn commits
2013-03-03 11:31:10 -08:00
tos Load url template tag from future for support of Django versions 1.3 through 1.5. 2013-01-30 09:14:48 -08:00
tos_i18n django-tos i18n support using django-modeltranslation 2013-02-17 20:56:19 +01:00
.gitignore Changing .gitignore 2010-11-16 12:20:15 -06:00
__init__.py first commit 2010-06-18 11:17:07 -05:00
AUTHORS.txt - Bumping version to 1.1 2012-10-14 23:45:49 +02:00
LICENSE.txt Fixing license oops 2012-11-18 08:27:22 -06:00
README.rst README reformatting 2013-02-17 20:58:25 +01:00
setup.py setup.py fix 2010-12-22 14:39:11 -06:00

==========
django-tos
==========

This project gives the admin the ability to reset terms of agreement with the end users. It tracks when TOS are changed and when users agree to the new TOS.

Summary
=======

    - keeps track of when TOS is changed
    - Users need to be informed and agree/re-agree when they login (custom login is provided)
    - Just two models (TOS and user agreement)
    
Installation
============
 
 1. Add `tos` to your INSTALLED_APPS setting.

 2. Run the command `manage.py syncdb`.
 
 3. In your root urlconf file `urls.py` add::
 
     # terms of service links
     urlpatterns += patterns('',
         url(r'^login/$', 'tos.views.login', {}, 'auth_login',),
         url(r'^terms-of-service/', include('tos.urls')),
     )


===============
django-tos-i18n
===============

django-tos internationalization using django-modeltranslation.

Installation
============

Assuming you have correctly installed django-tos in your app you only need to add following apps to ``INSTALLED_APPS``::

    INSTALLED_APPS += ('modeltranslation', 'tos_i18n')

and also you should also define your languages in django ``LANG`` variable, eg.::

    LANGUAGES = (
        ('pl', 'Polski'),
        ('en', 'English'),
        )

Please note that adding those to ``INSTALLED_APPS`` **changes** django models. Concretely it adds for every registered ``field`` that should translated, additional fields with name ``field_<lang_code>``, e.g. for given model::

    class MyModel(models.Model):
        name = models.CharField(max_length=10)

There will be generated fields: ``name`` , ``name_en``, ``name_pl``.

You should probably migrate your database, using South is recommended. Migrations should be kept in your local project.

How to migrate tos with South
`````````````````````````````

Here is some step-by-step example how to turn your legacy django-tos instalation synced using syncdb into translated tos with South migrations.

1. Inform South that you want to store migrations in custom place::

    # Add to INSTALLED_APS
    SOUTH_MIGRATION_MODULES = {
        'tos': 'YOUR_APP.migrations.tos',
    }

2. Add required directory (django package)::

    mkdir -p YOUR_APP/migrations/tos
    touch YOUR_APP/migrations/tos/__init__.py

3. Create initial migration (referring to the database state as it is now)::

    python manage.py schemamigration --initial tos

4. Fake migration (because the changes are already in the database)::

    python manage.py migrate tos --fake

5. Install tos_i18n to INSTALLED_APPS::

    INSTALLED_APS += ('tos_i18n', )

6. Migrate what changed::

    $ python manage.py schemamigration --auto tos
    $ python migrate tos


That's it. You are now running tos in i18n mode with languages you declared in LANGUAGES setting.

This app will also make all required adjustments in django admin.

For more info on how translation works in details please refer to `django-modeltranslation docs<https://django-modeltranslation.readthedocs.org/en/latest/>`_.