# Path: config/settings.py
# SANITIZER_ALLOWED_TAGS = [
#     'a', 'p', 'b', 'u', 'i', 'h1', 'h2', 'h3', 'img', 'br', 'table', 'tbody',
#     'tr', 'td', 'span', 'li', 'ul'
# ]
# 
# SANITIZER_ALLOWED_ATTRIBUTES = [ 'href', 'src', 'style', 'width', 'height']
# 
# Path: apps/account/models.py
# class Account(Model):
# 
#     # main data
#     user = ForeignKey('auth.User', unique=True, related_name="accounts")
#     description = TextField(blank=True)
#     source = CharField(max_length=64, choices=SOURCE_CHOICES, default='OTHER')
#     mobile = CharField(max_length=1024, blank=True)
#     links = ManyToManyField('link.Link', null=True, blank=True) 
#     passport = ProcessedImageField(upload_to=_upload_to, null=True, blank=True, 
#                                    processors=[ResizeToFit(1024, 768)],
#                                    format='JPEG', options={'quality': 90})
# 
#     # meta
#     # created_by = self
#     # updated_by = self
#     created_on = DateTimeField(auto_now_add=True)
#     updated_on = DateTimeField(auto_now=True)
# 
#     def get_name():
#         return self.user.username
# 
#     def __unicode__(self):
#         return self.user.username
# 
#     class Meta:
# 
#         ordering = ['user__username']


from django.db import models
from django.utils.translation import ugettext as _
from django.core.validators import RegexValidator
from sanitizer.models import SanitizedCharField
from config.settings import SANITIZER_ALLOWED_TAGS, SANITIZER_ALLOWED_ATTRIBUTES
from apps.account.models import Account
# -*- coding: utf-8 -*-
# Copyright (c) 2012 Fabian Barkhau <fabian.barkhau@gmail.com>                  
# License: MIT (see LICENSE.TXT file) 




class Page(models.Model):

    team        = models.ForeignKey("team.Team", related_name="pages")
    link        = models.SlugField(unique=True)
    name        = models.CharField(max_length=1024)
    content     = SanitizedCharField(
                    max_length=50000, allowed_tags=SANITIZER_ALLOWED_TAGS, 
                    allowed_attributes=SANITIZER_ALLOWED_ATTRIBUTES, strip=False
                )

    order       = models.IntegerField(blank=True, null=True)

    # meta
    created_by  = models.ForeignKey(Account, related_name="pages_created")
    created_on  = models.DateTimeField(auto_now_add=True)

# Path: config/settings.py
# SANITIZER_ALLOWED_TAGS = [
#     'a', 'p', 'b', 'u', 'i', 'h1', 'h2', 'h3', 'img', 'br', 'table', 'tbody',
#     'tr', 'td', 'span', 'li', 'ul'
# ]
# 
# SANITIZER_ALLOWED_ATTRIBUTES = [ 'href', 'src', 'style', 'width', 'height']
# 
# Path: apps/account/models.py
# class Account(Model):
# 
#     # main data
#     user = ForeignKey('auth.User', unique=True, related_name="accounts")
#     description = TextField(blank=True)
#     source = CharField(max_length=64, choices=SOURCE_CHOICES, default='OTHER')
#     mobile = CharField(max_length=1024, blank=True)
#     links = ManyToManyField('link.Link', null=True, blank=True) 
#     passport = ProcessedImageField(upload_to=_upload_to, null=True, blank=True, 
#                                    processors=[ResizeToFit(1024, 768)],
#                                    format='JPEG', options={'quality': 90})
# 
#     # meta
#     # created_by = self
#     # updated_by = self
#     created_on = DateTimeField(auto_now_add=True)
#     updated_on = DateTimeField(auto_now=True)
# 
#     def get_name():
#         return self.user.username
# 
#     def __unicode__(self):
#         return self.user.username
# 
#     class Meta:
# 
#         ordering = ['user__username']


# Path: apps/page/models.py
from django.db import models
from django.utils.translation import ugettext as _
from django.core.validators import RegexValidator
from sanitizer.models import SanitizedCharField
from config.settings import SANITIZER_ALLOWED_TAGS, SANITIZER_ALLOWED_ATTRIBUTES
from apps.account.models import Account

# -*- coding: utf-8 -*-
# Copyright (c) 2012 Fabian Barkhau <fabian.barkhau@gmail.com>                  
# License: MIT (see LICENSE.TXT file) 




class Page(models.Model):

    team        = models.ForeignKey("team.Team", related_name="pages")
    link        = models.SlugField(unique=True)
    name        = models.CharField(max_length=1024)
    content     = SanitizedCharField(
                    max_length=50000, allowed_tags=SANITIZER_ALLOWED_TAGS, 
                    allowed_attributes=SANITIZER_ALLOWED_ATTRIBUTES, strip=False
                )

    order       = models.IntegerField(blank=True, null=True)

    # meta
    created_by  = models.ForeignKey(Account, related_name="pages_created")
    created_on  = models.DateTimeField(auto_now_add=True)

    updated_by  = models.ForeignKey(Account, related_name="pages_updated")