# Path: aninstance_framework/search.py
# class AninstanceSearchView(AccessMixin, SearchView):
#     RESULTS_HEADING = 'Matching search results'
#     def __init__(self, **kwargs):
#     def get_queryset(self):
#     def get_context_data(self, *args, **kwargs):
#     def get(self, request, *args, **kwargs):
#     def model_search_conf(self, request):
# 
# Path: aninstance_framework/tz.py
# class SetTimeZone(generic.View):
#     SUBMITTED_TEMPLATE = 'timezone.html'
#     SUBMITTED_HEADING = 'Set your timezone'
#     def get(self, request):
#     def post(request):
# 
# Path: invoicing/api.py
# class ClientViewSet(viewsets.ModelViewSet):
#     # API endpoint for creation, editing or viewing of Client model
#     queryset = Account.objects.all().order_by('account_name')
#     serializer_class = ClientSerializer
# 
# 
#     # # REFERENCE METHOD TO SHOW MODEL VIA API
#     #
#     #
#     # def get_view_clients(self, request):
#     #     api_resource = 'client'
#     #     api_request_url = '{}://{}/{}'.format(
#     #         self.API_PROTO,
#     #         self.API_BASE_URL,
#     #         api_resource
#     #     )
#     #     try:
#     #         data = requests.get(api_request_url,
#     #                             headers={'User-Agent': 'Magic Browser',
#     #                                      'Authorization': 'Token {}'.format(
#     #                                          Token.objects.get_or_create(user=request.user)[0])
#     #                                      })
#     #         doc = data.json()
#     #     except Exception as e:
#     #         return http.HttpResponseNotFound(self.RESPONSE_INFO_API_CLIENT_ERROR)
#     #     # format for display
#     #     clients = []
#     #     try:
#     #         for client in doc.get('results'):
#     #             clients.append([{field[1]: client[field[0]]} for field in Client.CLIENT_VERBOSE_FIELDNAMES])
#     #     except TypeError:
#     #         self.context.update({'no_results': self.NO_CLIENTS_BLURB})
#     #     self.context.update({'clients': clients})
#     #     return render(request, self.TEMPLATE_NAME, self.context)


from django.conf.urls import url, include
from django.conf.urls.static import static
from django.conf import settings
from django.contrib import admin
from django.contrib.auth import views as auth_views
from aninstance_framework import search, tz
from django.views.generic.base import RedirectView
from rest_framework import routers
from rest_framework.authtoken import views as rest_auth_views
from invoicing.api import ClientViewSet  # API

# REST API framework
router = routers.DefaultRouter()
router.register(r'invoicing/client', ClientViewSet)
# URL patterns
urlpatterns = [
    ### INCLUDES
    # Invoicing app
    url(r'^invoicing/', include('invoicing.urls')),
    # Admin section
    url(r'^adminardo/', admin.site.urls),
    # Search
    url(r'^search/?$', search.AninstanceSearchView.as_view(), name='search_view'),
    ### ROUTING
    # Set timezone

# Path: aninstance_framework/search.py
# class AninstanceSearchView(AccessMixin, SearchView):
#     RESULTS_HEADING = 'Matching search results'
#     def __init__(self, **kwargs):
#     def get_queryset(self):
#     def get_context_data(self, *args, **kwargs):
#     def get(self, request, *args, **kwargs):
#     def model_search_conf(self, request):
# 
# Path: aninstance_framework/tz.py
# class SetTimeZone(generic.View):
#     SUBMITTED_TEMPLATE = 'timezone.html'
#     SUBMITTED_HEADING = 'Set your timezone'
#     def get(self, request):
#     def post(request):
# 
# Path: invoicing/api.py
# class ClientViewSet(viewsets.ModelViewSet):
#     # API endpoint for creation, editing or viewing of Client model
#     queryset = Account.objects.all().order_by('account_name')
#     serializer_class = ClientSerializer
# 
# 
#     # # REFERENCE METHOD TO SHOW MODEL VIA API
#     #
#     #
#     # def get_view_clients(self, request):
#     #     api_resource = 'client'
#     #     api_request_url = '{}://{}/{}'.format(
#     #         self.API_PROTO,
#     #         self.API_BASE_URL,
#     #         api_resource
#     #     )
#     #     try:
#     #         data = requests.get(api_request_url,
#     #                             headers={'User-Agent': 'Magic Browser',
#     #                                      'Authorization': 'Token {}'.format(
#     #                                          Token.objects.get_or_create(user=request.user)[0])
#     #                                      })
#     #         doc = data.json()
#     #     except Exception as e:
#     #         return http.HttpResponseNotFound(self.RESPONSE_INFO_API_CLIENT_ERROR)
#     #     # format for display
#     #     clients = []
#     #     try:
#     #         for client in doc.get('results'):
#     #             clients.append([{field[1]: client[field[0]]} for field in Client.CLIENT_VERBOSE_FIELDNAMES])
#     #     except TypeError:
#     #         self.context.update({'no_results': self.NO_CLIENTS_BLURB})
#     #     self.context.update({'clients': clients})
#     #     return render(request, self.TEMPLATE_NAME, self.context)


# Path: aninstance/urls.py
from django.conf.urls import url, include
from django.conf.urls.static import static
from django.conf import settings
from django.contrib import admin
from django.contrib.auth import views as auth_views
from aninstance_framework import search, tz
from django.views.generic.base import RedirectView
from rest_framework import routers
from rest_framework.authtoken import views as rest_auth_views
from invoicing.api import ClientViewSet  # API


# REST API framework
router = routers.DefaultRouter()
router.register(r'invoicing/client', ClientViewSet)
# URL patterns
urlpatterns = [
    ### INCLUDES
    # Invoicing app
    url(r'^invoicing/', include('invoicing.urls')),
    # Admin section
    url(r'^adminardo/', admin.site.urls),
    # Search
    url(r'^search/?$', search.AninstanceSearchView.as_view(), name='search_view'),
    ### ROUTING
    # Set timezone

    url(r'^set_timezone/$', tz.SetTimeZone.as_view(), name='set_timezone'),