# Path: pttrack/validators.py
# def validate_attending(value):
#     '''
#     Verify that a provider has attending priviledges.
#     '''
# 
#     Provider = apps.get_model('pttrack', 'Provider')
#     attending = Provider.objects.get(pk=value)
# 
#     if not attending.clinical_roles.filter(signs_charts=True).exists():
#         raise ValidationError("This provider is not allowed to sign charts.")


from builtins import str
from builtins import object
from django.db import models
from django.db.models import Q
from django.utils.timezone import now
from simple_history.models import HistoricalRecords
from django.core.urlresolvers import reverse
from django.core.validators import MinValueValidator
from pttrack.models import Note, Provider, ReferralLocation, ReferralType
from pttrack.validators import validate_attending
from . import validators as workup_validators
import datetime

    got_voucher = models.BooleanField(default=False)
    voucher_amount = models.DecimalField(
        max_digits=6, decimal_places=2, blank=True, null=True,
        validators=[MinValueValidator(0)])
    patient_pays = models.DecimalField(
        max_digits=6, decimal_places=2, blank=True, null=True,
        validators=[MinValueValidator(0)])

    got_imaging_voucher = models.BooleanField(default=False)
    imaging_voucher_amount = models.DecimalField(
        max_digits=6, decimal_places=2, blank=True, null=True,
        validators=[MinValueValidator(0)])
    patient_pays_imaging = models.DecimalField(
        max_digits=6, decimal_places=2, blank=True, null=True,
        validators=[MinValueValidator(0)])

    # Please note that these are no longer shown on the form and will not
    # be filled out because the referral app handles this functionality
    referral_type = models.ManyToManyField(ReferralType, blank=True)
    referral_location = models.ManyToManyField(ReferralLocation, blank=True)

    will_return = models.BooleanField(default=False,
                                      help_text="Will the pt. return to SNHC?")

    A_and_P = models.TextField()

    signer = models.ForeignKey(Provider,
                               blank=True, null=True,
                               related_name="signed_workups",

# Path: pttrack/validators.py
# def validate_attending(value):
#     '''
#     Verify that a provider has attending priviledges.
#     '''
# 
#     Provider = apps.get_model('pttrack', 'Provider')
#     attending = Provider.objects.get(pk=value)
# 
#     if not attending.clinical_roles.filter(signs_charts=True).exists():
#         raise ValidationError("This provider is not allowed to sign charts.")


# Path: workup/models.py
from builtins import str
from builtins import object
from django.db import models
from django.db.models import Q
from django.utils.timezone import now
from simple_history.models import HistoricalRecords
from django.core.urlresolvers import reverse
from django.core.validators import MinValueValidator
from pttrack.models import Note, Provider, ReferralLocation, ReferralType
from pttrack.validators import validate_attending
from . import validators as workup_validators
import datetime


    got_voucher = models.BooleanField(default=False)
    voucher_amount = models.DecimalField(
        max_digits=6, decimal_places=2, blank=True, null=True,
        validators=[MinValueValidator(0)])
    patient_pays = models.DecimalField(
        max_digits=6, decimal_places=2, blank=True, null=True,
        validators=[MinValueValidator(0)])

    got_imaging_voucher = models.BooleanField(default=False)
    imaging_voucher_amount = models.DecimalField(
        max_digits=6, decimal_places=2, blank=True, null=True,
        validators=[MinValueValidator(0)])
    patient_pays_imaging = models.DecimalField(
        max_digits=6, decimal_places=2, blank=True, null=True,
        validators=[MinValueValidator(0)])

    # Please note that these are no longer shown on the form and will not
    # be filled out because the referral app handles this functionality
    referral_type = models.ManyToManyField(ReferralType, blank=True)
    referral_location = models.ManyToManyField(ReferralLocation, blank=True)

    will_return = models.BooleanField(default=False,
                                      help_text="Will the pt. return to SNHC?")

    A_and_P = models.TextField()

    signer = models.ForeignKey(Provider,
                               blank=True, null=True,
                               related_name="signed_workups",

                               validators=[validate_attending])