# 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.models import Model
from django.db.models import SlugField
from django.db.models import CharField
from django.db.models import BooleanField
from django.db.models import ManyToManyField
from django.db.models import ForeignKey
from django.db.models import DateTimeField
from django.db.models import TextField
from django.utils.translation import ugettext as _
from django_countries.fields import CountryField
from imagekit.models.fields import ProcessedImageField
from imagekit.processors import ResizeToFill
from apps.account.models import Account
    logo        = ProcessedImageField(upload_to=_upload_to, 
                                      processors=[ResizeToFill(525, 100)],
                                      format='PNG', options={'quality': 90})
    active      = BooleanField(default=False)
    application = TextField() 

    # meta
    created_by  = ForeignKey(Account, related_name='team_created')
    created_on  = DateTimeField(auto_now_add=True)
    updated_by  = ForeignKey(Account, related_name='team_updated')
    updated_on  = DateTimeField(auto_now=True)

    def __unicode__(self):
        return u"%s (%s)" % (self.name, self.country.name)

    class Meta:
        
        ordering = ['name']


class JoinRequest(Model):

    # main data
    team = ForeignKey( # team user wants to join
        'team.Team', related_name='join_requests'
    )
    requester = ForeignKey( # user who is requesting to join
        Account, related_name='join_requests_made'
    ) 
    processor = ForeignKey( # user who answerd the request

# 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/team/models.py
from django.db.models import Model
from django.db.models import SlugField
from django.db.models import CharField
from django.db.models import BooleanField
from django.db.models import ManyToManyField
from django.db.models import ForeignKey
from django.db.models import DateTimeField
from django.db.models import TextField
from django.utils.translation import ugettext as _
from django_countries.fields import CountryField
from imagekit.models.fields import ProcessedImageField
from imagekit.processors import ResizeToFill
from apps.account.models import Account

    logo        = ProcessedImageField(upload_to=_upload_to, 
                                      processors=[ResizeToFill(525, 100)],
                                      format='PNG', options={'quality': 90})
    active      = BooleanField(default=False)
    application = TextField() 

    # meta
    created_by  = ForeignKey(Account, related_name='team_created')
    created_on  = DateTimeField(auto_now_add=True)
    updated_by  = ForeignKey(Account, related_name='team_updated')
    updated_on  = DateTimeField(auto_now=True)

    def __unicode__(self):
        return u"%s (%s)" % (self.name, self.country.name)

    class Meta:
        
        ordering = ['name']


class JoinRequest(Model):

    # main data
    team = ForeignKey( # team user wants to join
        'team.Team', related_name='join_requests'
    )
    requester = ForeignKey( # user who is requesting to join
        Account, related_name='join_requests_made'
    ) 
    processor = ForeignKey( # user who answerd the request

        Account, related_name='join_requests_processed', 