# Path: apps/team/models.py
# class Team(Model):
# 
#     link        = SlugField(unique=True) # team url name 
#     links       = ManyToManyField('link.Link', null=True, blank=True) # team social media links
#     name        = CharField(max_length=1024, unique=True)
#     country     = CountryField()
#     members     = ManyToManyField(Account, null=True, blank=True, 
#                                   related_name="teams") 
#     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']


from django.utils.translation import ugettext as _
from django.forms import Select
from django.forms import Form
from django.forms import ModelChoiceField
from django.db.models import Count
from apps.team.models import Team
# -*- coding: utf-8 -*-
# Copyright (c) 2012 Fabian Barkhau <fabian.barkhau@gmail.com>
# License: MIT (see LICENSE.TXT file)



teams = Team.objects.all().annotate(bike_count=Count("bikes__id"))
teams = teams.filter(active=True, bike_count__gt=0)

class TeamSelectForm(Form):

    team = ModelChoiceField(
        label='', empty_label=_("PICK_A_LOCATION"),

# Path: apps/team/models.py
# class Team(Model):
# 
#     link        = SlugField(unique=True) # team url name 
#     links       = ManyToManyField('link.Link', null=True, blank=True) # team social media links
#     name        = CharField(max_length=1024, unique=True)
#     country     = CountryField()
#     members     = ManyToManyField(Account, null=True, blank=True, 
#                                   related_name="teams") 
#     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']


# Path: apps/site/forms.py
from django.utils.translation import ugettext as _
from django.forms import Select
from django.forms import Form
from django.forms import ModelChoiceField
from django.db.models import Count
from apps.team.models import Team

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



teams = Team.objects.all().annotate(bike_count=Count("bikes__id"))
teams = teams.filter(active=True, bike_count__gt=0)

class TeamSelectForm(Form):

    team = ModelChoiceField(
        label='', empty_label=_("PICK_A_LOCATION"),

        queryset=teams,