# Path: pttrack/views.py
# class NoteFormView(FormView):
#     note_type = None
# 
#     def get_context_data(self, **kwargs):
#         '''Inject self.note_type and patient into the context.'''
# 
#         if self.note_type is None:
#             raise ImproperlyConfigured("NoteCreate view must have" +
#                                        "'note_type' variable set.")
# 
#         context = super(NoteFormView, self).get_context_data(**kwargs)
#         context['note_type'] = self.note_type
# 
#         if 'pt_id' in self.kwargs:
#             context['patient'] = mymodels.Patient.objects. \
#                 get(pk=self.kwargs['pt_id'])
# 
#         return context
# 
# class NoteUpdate(UpdateView):
#     note_type = None
# 
#     def get_context_data(self, **kwargs):
#         '''Inject self.note_type as the note type.'''
# 
#         if self.note_type is None:
#             raise ImproperlyConfigured("NoteUpdate view must have" +
#                                        "'note_type' variable set.")
# 
#         context = super(NoteUpdate, self).get_context_data(**kwargs)
#         context['note_type'] = self.note_type
# 
#         return context
# 
#     # TODO: add shared form_valid code here from all subclasses.
# 
# def get_current_provider_type(request):
#     '''
#     Given the request, produce the ProviderType of the logged in user. This is
#     done using session data.
#     '''
#     return get_object_or_404(mymodels.ProviderType,
#                              pk=request.session['clintype_pk'])


from builtins import str
from django.shortcuts import get_object_or_404, render
from django.http import (HttpResponseRedirect, HttpResponseServerError,
                         HttpResponse)
from django.core.urlresolvers import reverse
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
from django.template.loader import get_template
from django.utils.timezone import now
from django.views.generic.edit import FormView
from django.conf import settings
from pttrack.views import NoteFormView, NoteUpdate, get_current_provider_type
from pttrack.models import Patient, ProviderType
from xhtml2pdf import pisa
from . import models
from . import forms
from tempfile import TemporaryFile
from __future__ import unicode_literals








def get_clindates():
    '''Get the clinic dates associated with today.'''
    clindates = models.ClinicDate.objects.filter(
        clinic_date=now().date())
    return clindates


def new_note_dispatch(request, pt_id):

    note_types = {
        'Standard Note': reverse("new-workup", args=(pt_id,)),
        'Clinical Psychology Note': reverse("new-progress-note", args=(pt_id,)),
    }

    return render(request, 'workup/new-note-dispatch.html',
                  {'note_types': note_types})



# Path: pttrack/views.py
# class NoteFormView(FormView):
#     note_type = None
# 
#     def get_context_data(self, **kwargs):
#         '''Inject self.note_type and patient into the context.'''
# 
#         if self.note_type is None:
#             raise ImproperlyConfigured("NoteCreate view must have" +
#                                        "'note_type' variable set.")
# 
#         context = super(NoteFormView, self).get_context_data(**kwargs)
#         context['note_type'] = self.note_type
# 
#         if 'pt_id' in self.kwargs:
#             context['patient'] = mymodels.Patient.objects. \
#                 get(pk=self.kwargs['pt_id'])
# 
#         return context
# 
# class NoteUpdate(UpdateView):
#     note_type = None
# 
#     def get_context_data(self, **kwargs):
#         '''Inject self.note_type as the note type.'''
# 
#         if self.note_type is None:
#             raise ImproperlyConfigured("NoteUpdate view must have" +
#                                        "'note_type' variable set.")
# 
#         context = super(NoteUpdate, self).get_context_data(**kwargs)
#         context['note_type'] = self.note_type
# 
#         return context
# 
#     # TODO: add shared form_valid code here from all subclasses.
# 
# def get_current_provider_type(request):
#     '''
#     Given the request, produce the ProviderType of the logged in user. This is
#     done using session data.
#     '''
#     return get_object_or_404(mymodels.ProviderType,
#                              pk=request.session['clintype_pk'])


# Path: workup/views.py
from builtins import str
from django.shortcuts import get_object_or_404, render
from django.http import (HttpResponseRedirect, HttpResponseServerError,
                         HttpResponse)
from django.core.urlresolvers import reverse
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
from django.template.loader import get_template
from django.utils.timezone import now
from django.views.generic.edit import FormView
from django.conf import settings
from pttrack.views import NoteFormView, NoteUpdate, get_current_provider_type
from pttrack.models import Patient, ProviderType
from xhtml2pdf import pisa
from . import models
from . import forms
from tempfile import TemporaryFile

from __future__ import unicode_literals








def get_clindates():
    '''Get the clinic dates associated with today.'''
    clindates = models.ClinicDate.objects.filter(
        clinic_date=now().date())
    return clindates


def new_note_dispatch(request, pt_id):

    note_types = {
        'Standard Note': reverse("new-workup", args=(pt_id,)),
        'Clinical Psychology Note': reverse("new-progress-note", args=(pt_id,)),
    }

    return render(request, 'workup/new-note-dispatch.html',
                  {'note_types': note_types})



class WorkupCreate(NoteFormView):