From 5bad53b8bc564c5b7b462a1e5a1d8fd975d93470 Mon Sep 17 00:00:00 2001 From: pydanny Date: Fri, 18 Jun 2010 12:30:01 -0500 Subject: [PATCH] README install instructions. models cleanup --- .gitignore | 1 + README.rst | 19 ++++++++++++++++++- tos/models.py | 14 +++++++------- 3 files changed, 26 insertions(+), 8 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..7e99e36 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +*.pyc \ No newline at end of file diff --git a/README.rst b/README.rst index d8f8339..cd3b0ec 100644 --- a/README.rst +++ b/README.rst @@ -10,4 +10,21 @@ Summary - based flatpage - keep track of when TOS is changed - Users need to be informed and reagree when they relogin (custom login) - - 2 models likely (TOS table and user re-agree) \ No newline at end of file + - 2 models likely (TOS table and user re-agree) + +Installation +============ + +django-tos relies on django-flatpages so you have to follow those rules of installation: + + 1. Install the sites framework by adding `django.contrib.sites` to your INSTALLED_APPS setting, if it’s not already in there. + + 2. Also make sure you’ve correctly set `SITE_ID` to the ID of the site the settings file represents. This will usually be 1 (i.e. `SITE_ID = 1`, but if you’re using the sites framework to manage multiple sites, it could be the ID of a different site. + + 3. Add `django.contrib.flatpages` to your INSTALLED_APPS setting. + + 4. Add `tos` to your INSTALLED_APPS setting. + + 5. Add `django.contrib.flatpages.middleware.FlatpageFallbackMiddleware` to your MIDDLEWARE_CLASSES setting. + + 5. Run the command `manage.py syncdb`. \ No newline at end of file diff --git a/tos/models.py b/tos/models.py index 7396a79..ec3c226 100644 --- a/tos/models.py +++ b/tos/models.py @@ -1,24 +1,24 @@ from django.contrib.auth.models import User -from django.contrib.flatpages import FlatPage +from django.contrib.flatpages.models import FlatPage from django.core.exceptions import ValidationError from django.db import models from django.utils.translation import ugettext_lazy as _ class BaseModel(models.Model): - created = models.DateTimeField(label=_('created'), auto_now_add=False, editable=False) - modified = models.DateTimeField(label=_('modified'), auto_now=False, editable=False) + created = models.DateTimeField(auto_now_add=False, editable=False) + modified = models.DateTimeField(auto_now=False, editable=False) class Meta: abstract = True class TermsOfService(BaseModel): - flat_page = models.ForeignKey(FlatPage, label=_('terms of service'), related_name='flatpage') + flat_page = models.ForeignKey(FlatPage, related_name='flatpage') active = models.BooleanField(_('active'), _('Only one terms of service is allowed to be active')) class Meta: - ordering = ('created') + ordering = ('created',) verbose_name=_('Terms of Service') verbose_name_plural=_('Terms of Service') @@ -37,8 +37,8 @@ class TermsOfService(BaseModel): class UserAgreement(BaseModel): - terms_of_service = models.ForeignKey(FlatPage, label=_('terms of service'), related_name='terms') - user = models.ForeignKey(User related_name='user') + terms_of_service = models.ForeignKey(FlatPage, related_name='terms') + user = models.ForeignKey(User, related_name='user') def __unicode__(self): return self.terms_of_service \ No newline at end of file