mirror of
https://github.com/Hopiu/django-tos.git
synced 2026-03-16 20:10:24 +00:00
README install instructions. models cleanup
This commit is contained in:
parent
e96044f412
commit
5bad53b8bc
3 changed files with 26 additions and 8 deletions
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
*.pyc
|
||||
19
README.rst
19
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)
|
||||
- 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`.
|
||||
|
|
@ -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
|
||||
Loading…
Reference in a new issue