# Path: profiles/models.py
# class Profile(User):
#     objects = UserManager()
#     _extensions_imported = False
# 
#     @classmethod
#     def remove_field(cls, f_name):
#         # Removes the field form local fields list
#         cls._meta.local_fields = [f for f in cls._meta.local_fields if f.name != f_name]
# 
#         # Removes the field setter if exists
#         if hasattr(cls, f_name):
#             delattr(cls, f_name)
# 
#     @classmethod
#     def register_extension(cls, register_fn):
#         register_fn(cls, ProfileAdmin)
# 
#     @classmethod
#     def register_extensions(cls, *extensions):
#         if not hasattr(cls, '_profile_extensions'):
#             cls._profile_extensions = set()
# 
#         here = cls.__module__.split('.')[:-1]
#         here_path = '.'.join(here + ['extensions'])
# 
#         for ext in extensions:
#             if ext in cls._profile_extensions:
#                 continue
# 
#             try:
#                 if isinstance(ext, basestring):
#                     try:
#                         fn = get_callable(ext + '.register', False)
#                     except ImportError:
#                         fn = get_callable('%s.%s.register' % (here_path, ext), False)
#                 # Not a string, so take our chances and just try to access "register"
#                 else:
#                     fn = ext.register
# 
#                 cls.register_extension(fn)
#                 cls._profile_extensions.add(ext)
#             except Exception:
#                 raise
# 
#     def save(self, *args, **kwargs):
#         # Remove leading and trailing whitespace from name.
#         try:
#             self.first_name = self.first_name.strip()
#             self.last_name = self.last_name.strip()
#         except AttributeError:
#             pass
# 
#         if not self.username:
#             self.username = generate_id(first_name=self.first_name,
#                                         last_name=self.last_name, email=self.email)
#         super(Profile, self).save(*args, **kwargs)
# 
#     def get_full_name(self):
#         full_name = super(Profile, self).get_full_name()
#         if not full_name:
#             return self.username
#         return full_name
# 
#     def get_profile(self):
#         return self


from django.db import models
from django.utils.translation import ugettext_lazy as _
from orderable.models import Orderable
from profiles.models import Profile



class ProfileFieldsChoices(object):
    """
    Iterable that will yield Profile fields as choices. 
    This is necessary to delay accessing the Profile class until it has been defined.
    """

    def __init__(self ):
        self.count = 0

    def next(self):
        if self.count >= len(Profile._meta.fields):
            self.count = 0
            raise StopIteration
        else:
            c = self.count
            self.count += 1
            return self.__getitem__(c)

    def __getitem__(self, item):

# Path: profiles/models.py
# class Profile(User):
#     objects = UserManager()
#     _extensions_imported = False
# 
#     @classmethod
#     def remove_field(cls, f_name):
#         # Removes the field form local fields list
#         cls._meta.local_fields = [f for f in cls._meta.local_fields if f.name != f_name]
# 
#         # Removes the field setter if exists
#         if hasattr(cls, f_name):
#             delattr(cls, f_name)
# 
#     @classmethod
#     def register_extension(cls, register_fn):
#         register_fn(cls, ProfileAdmin)
# 
#     @classmethod
#     def register_extensions(cls, *extensions):
#         if not hasattr(cls, '_profile_extensions'):
#             cls._profile_extensions = set()
# 
#         here = cls.__module__.split('.')[:-1]
#         here_path = '.'.join(here + ['extensions'])
# 
#         for ext in extensions:
#             if ext in cls._profile_extensions:
#                 continue
# 
#             try:
#                 if isinstance(ext, basestring):
#                     try:
#                         fn = get_callable(ext + '.register', False)
#                     except ImportError:
#                         fn = get_callable('%s.%s.register' % (here_path, ext), False)
#                 # Not a string, so take our chances and just try to access "register"
#                 else:
#                     fn = ext.register
# 
#                 cls.register_extension(fn)
#                 cls._profile_extensions.add(ext)
#             except Exception:
#                 raise
# 
#     def save(self, *args, **kwargs):
#         # Remove leading and trailing whitespace from name.
#         try:
#             self.first_name = self.first_name.strip()
#             self.last_name = self.last_name.strip()
#         except AttributeError:
#             pass
# 
#         if not self.username:
#             self.username = generate_id(first_name=self.first_name,
#                                         last_name=self.last_name, email=self.email)
#         super(Profile, self).save(*args, **kwargs)
# 
#     def get_full_name(self):
#         full_name = super(Profile, self).get_full_name()
#         if not full_name:
#             return self.username
#         return full_name
# 
#     def get_profile(self):
#         return self


# Path: profiles/modules/notifications/models.py
from django.db import models
from django.utils.translation import ugettext_lazy as _
from orderable.models import Orderable
from profiles.models import Profile




class ProfileFieldsChoices(object):
    """
    Iterable that will yield Profile fields as choices. 
    This is necessary to delay accessing the Profile class until it has been defined.
    """

    def __init__(self ):
        self.count = 0

    def next(self):
        if self.count >= len(Profile._meta.fields):
            self.count = 0
            raise StopIteration
        else:
            c = self.count
            self.count += 1
            return self.__getitem__(c)

    def __getitem__(self, item):

        field = Profile._meta.fields[item]