# Path: users/models.py
# class UserDetail(models.Model):
#     user = models.OneToOneField(User, primary_key=True)
#     longitude = models.FloatField(null=True)
#     latitude = models.FloatField(null=True)
#     token_facebook = models.CharField(null=True, max_length=255)
#     avatar_url = models.URLField(null=True)
#     created_at = models.DateTimeField(auto_now_add=True)
#     updated_at = models.DateTimeField(auto_now=True)
# 
#     def _get_avatar_thumbnail_url(self):
#         return "https://s3.amazonaws.com/walladog/thumbnails/" + self.user.username + ".png"
#     avatar_thumbnail_url = property(_get_avatar_thumbnail_url)
# 
#     def _get_products_count(self):
#         from products.models import Product
#         return Product.objects.filter(seller=self.user.id).filter(active=1).count()
#     products_count = property(_get_products_count)
# 
#     def __unicode__(self):
#         if self.user.first_name or self.user.last_name:
#             return self.user.first_name + " " + self.user.last_name
#         else:
#             return self.user.username
# 
#     def __str__(self):
#         if self.user.first_name or self.user.last_name:
#             return self.user.first_name + " " + self.user.last_name
#         else:
#             return self.user.username
# 
# Path: races/models.py
# class Race(models.Model):
# 
#     name = models.CharField(max_length=40)
#     active = models.BooleanField(default=True)
#     created_at = models.DateTimeField(auto_now_add=True)
#     updated_at = models.DateTimeField(auto_now=True)
# 
#     def __unicode__(self):
#         return self.name
# 
#     def __str__(self):
#         return self.name
# 
# Path: states/models.py
# class State(models.Model):
#     name = models.CharField(max_length=30)
#     active = models.BooleanField(default=True)
#     created_at = models.DateTimeField(auto_now_add=True)
#     updated_at = models.DateTimeField(auto_now=True)
# 
#     def __unicode__(self):
#         return self.name
# 
#     def __str__(self):
#         return self.name
# 
# Path: categories/models.py
# class Category(models.Model):
#     name = models.CharField(max_length=30)
#     active = models.BooleanField(default=True)
#     created_at = models.DateTimeField(auto_now_add=True)
#     updated_at = models.DateTimeField(auto_now=True)
# 
#     def __unicode__(self):
#         return self.name
# 
#     def __str__(self):
#         return self.name
# 
# Path: products/settings.py
# GENDERS = getattr(settings, 'GENDERS', DEFAULT_GENDERS)


from django.contrib.gis.db import models
from users.models import UserDetail
from races.models import Race
from states.models import State
from categories.models import Category
from products.settings import GENDERS

class Product(models.Model):
    name = models.CharField(max_length=30)
    race = models.ForeignKey(Race, null=True, related_name='race')

# Path: users/models.py
# class UserDetail(models.Model):
#     user = models.OneToOneField(User, primary_key=True)
#     longitude = models.FloatField(null=True)
#     latitude = models.FloatField(null=True)
#     token_facebook = models.CharField(null=True, max_length=255)
#     avatar_url = models.URLField(null=True)
#     created_at = models.DateTimeField(auto_now_add=True)
#     updated_at = models.DateTimeField(auto_now=True)
# 
#     def _get_avatar_thumbnail_url(self):
#         return "https://s3.amazonaws.com/walladog/thumbnails/" + self.user.username + ".png"
#     avatar_thumbnail_url = property(_get_avatar_thumbnail_url)
# 
#     def _get_products_count(self):
#         from products.models import Product
#         return Product.objects.filter(seller=self.user.id).filter(active=1).count()
#     products_count = property(_get_products_count)
# 
#     def __unicode__(self):
#         if self.user.first_name or self.user.last_name:
#             return self.user.first_name + " " + self.user.last_name
#         else:
#             return self.user.username
# 
#     def __str__(self):
#         if self.user.first_name or self.user.last_name:
#             return self.user.first_name + " " + self.user.last_name
#         else:
#             return self.user.username
# 
# Path: races/models.py
# class Race(models.Model):
# 
#     name = models.CharField(max_length=40)
#     active = models.BooleanField(default=True)
#     created_at = models.DateTimeField(auto_now_add=True)
#     updated_at = models.DateTimeField(auto_now=True)
# 
#     def __unicode__(self):
#         return self.name
# 
#     def __str__(self):
#         return self.name
# 
# Path: states/models.py
# class State(models.Model):
#     name = models.CharField(max_length=30)
#     active = models.BooleanField(default=True)
#     created_at = models.DateTimeField(auto_now_add=True)
#     updated_at = models.DateTimeField(auto_now=True)
# 
#     def __unicode__(self):
#         return self.name
# 
#     def __str__(self):
#         return self.name
# 
# Path: categories/models.py
# class Category(models.Model):
#     name = models.CharField(max_length=30)
#     active = models.BooleanField(default=True)
#     created_at = models.DateTimeField(auto_now_add=True)
#     updated_at = models.DateTimeField(auto_now=True)
# 
#     def __unicode__(self):
#         return self.name
# 
#     def __str__(self):
#         return self.name
# 
# Path: products/settings.py
# GENDERS = getattr(settings, 'GENDERS', DEFAULT_GENDERS)


# Path: products/models.py
from django.contrib.gis.db import models
from users.models import UserDetail
from races.models import Race
from states.models import State
from categories.models import Category
from products.settings import GENDERS


class Product(models.Model):
    name = models.CharField(max_length=30)
    race = models.ForeignKey(Race, null=True, related_name='race')

    seller = models.ForeignKey(UserDetail, null=False)