# Path: formunculous/fields.py
# EMPTY_VALUES = (None, '',)
# class HoneypotField(Field):
# class DocumentFormField(FileField):
# class DocumentField(models.FileField):
# class USZipCodeModelField(models.CharField):
# class USZipCodeField(RegexField):
# class MultipleChoiceToStringField(MultipleChoiceField):
#     def clean(self, value):
#     def __init__(self, *args, **kwargs):
#     def clean(self, data, initial=None):
#     def formfield(self, **kwargs):
#     def __init__(self, *args, **kwargs):
#     def formfield(self, **kwargs):
#     def __init__(self, max_length=None, min_length=None, *args, **kwargs):
#     def clean(self, value):


from django.db import models
from django.contrib.auth.models import User, Group
from django.contrib.sites.models import Site
from django.contrib.contenttypes.models import ContentType
from localflavor.us.forms import USStateSelect
from localflavor.us.models import PhoneNumberField
from django.utils.translation import ugettext_lazy as _
from django.utils.encoding import smart_unicode
from django import forms
from django.conf import settings
from formunculous.widgets import *
from formunculous.storage import *
from formunculous import fields
        from django.core.exceptions import ImproperlyConfigured 
import datetime
        import formunculous.models as funcmodels
        import formunculous.models as funcmodels


# Application Definition Models
class CurrentManager(models.Manager):

    def current(self, **kwargs):
        return self.get_query_set().filter(
            start_date__lte=datetime.datetime.now(),
            stop_date__gte=datetime.datetime.now(),
            parent = None, sites=Site.objects.get_current(), **kwargs
            )

    def reviewer(self, user, **kwargs):
        return self.get_query_set().filter( reviewers=user, email_only=False,
                                            parent = None,
                                            sites=Site.objects.get_current(),
                                            **kwargs)

class ApplicationDefinition(models.Model):


    # Site differentiation
    try: 
        sid = settings.SITE_ID 
    except AttributeError: 
        raise ImproperlyConfigured("You're using the Django \"sites framework\"\
                           without having set the SITE_ID setting. Create a site\
                           in your database and set the SITE_ID setting to fix\
                            this error.") 


# Path: formunculous/fields.py
# EMPTY_VALUES = (None, '',)
# class HoneypotField(Field):
# class DocumentFormField(FileField):
# class DocumentField(models.FileField):
# class USZipCodeModelField(models.CharField):
# class USZipCodeField(RegexField):
# class MultipleChoiceToStringField(MultipleChoiceField):
#     def clean(self, value):
#     def __init__(self, *args, **kwargs):
#     def clean(self, data, initial=None):
#     def formfield(self, **kwargs):
#     def __init__(self, *args, **kwargs):
#     def formfield(self, **kwargs):
#     def __init__(self, max_length=None, min_length=None, *args, **kwargs):
#     def clean(self, value):


# Path: formunculous/models.py
from django.db import models
from django.contrib.auth.models import User, Group
from django.contrib.sites.models import Site
from django.contrib.contenttypes.models import ContentType
from localflavor.us.forms import USStateSelect
from localflavor.us.models import PhoneNumberField
from django.utils.translation import ugettext_lazy as _
from django.utils.encoding import smart_unicode
from django import forms
from django.conf import settings
from formunculous.widgets import *
from formunculous.storage import *
from formunculous import fields
        from django.core.exceptions import ImproperlyConfigured 
import datetime
        import formunculous.models as funcmodels
        import formunculous.models as funcmodels



# Application Definition Models
class CurrentManager(models.Manager):

    def current(self, **kwargs):
        return self.get_query_set().filter(
            start_date__lte=datetime.datetime.now(),
            stop_date__gte=datetime.datetime.now(),
            parent = None, sites=Site.objects.get_current(), **kwargs
            )

    def reviewer(self, user, **kwargs):
        return self.get_query_set().filter( reviewers=user, email_only=False,
                                            parent = None,
                                            sites=Site.objects.get_current(),
                                            **kwargs)

class ApplicationDefinition(models.Model):


    # Site differentiation
    try: 
        sid = settings.SITE_ID 
    except AttributeError: 
        raise ImproperlyConfigured("You're using the Django \"sites framework\"\
                           without having set the SITE_ID setting. Create a site\
                           in your database and set the SITE_ID setting to fix\
                            this error.") 


    sites = models.ManyToManyField(Site, default=(sid,))