# Path: ovizart/api/api.py
# class AppProtocolResource(ModelResource):
#     class Meta:
#         queryset = FlowDetails.objects.all()
#         resource_name = 'protocols'
#         list_allowed_methods = ['get']
#         detail_allowed_methods = ['get']
#         limit = 0 # unlimited
#         filtering = {
#             'user_id': ALL,
#         }
#         serializer = CustomJSONSerializer()
# 
# class AppProtocolVisualizePacketSizeResource(ModelResource):
#     class Meta:
#         queryset = FlowDetails.objects.all()
#         resource_name = 'protocol_size'
#         list_allowed_methods = ['get']
#         detail_allowed_methods = ['get']
#         limit = 0 # unlimited
#         filtering = {
#             'user_id': ALL,
#             'protocol': ALL,
#         }
#         serializer = AppProtocolPacketSizeCustomJSONSerializer()
# 
# class AppProtocolVisualizePacketCountResource(ModelResource):
#     class Meta:
#         queryset = FlowDetails.objects.all()
#         resource_name = 'protocol_count'
#         list_allowed_methods = ['get']
#         detail_allowed_methods = ['get']
#         limit = 0 # unlimited
#         filtering = {
#             'user_id': ALL,
#             'protocol': ALL,
#             }
#         serializer = AppProtocolPacketCountCustomJSONSerializer()
# 
# class AllProtocolsResource(ModelResource):
#     class Meta:
#         queryset = FlowDetails.objects.all()
#         resource_name = 'all_protocols'
#         list_allowed_methods = ['get']
#         detail_allowed_methods = ['get']
#         limit = 0 # unlimited
#         serializer = AllProtocolsJSONSerializer()
# 
# class AllProtocolsByHashResource(ModelResource):
#     class Meta:
#         queryset = FlowDetails.objects.all()
#         resource_name = 'all_protocols_by_hash'
#         list_allowed_methods = ['get']
#         detail_allowed_methods = ['get']
#         limit = 0 # unlimited
#         serializer = AllProtocolsJSONSerializer()
#         filtering = {
#             'parent_hash_value': ALL,
#             }
# 
# class AppProtocolResourceByHash(ModelResource):
#     class Meta:
#         queryset = FlowDetails.objects.all()
#         resource_name = 'protocols_by_hash'
#         list_allowed_methods = ['get']
#         detail_allowed_methods = ['get']
#         limit = 0 # unlimited
#         filtering = {
#             'parent_hash_value': ALL,
#             }
#         serializer = CustomJSONSerializer()
# 
# class AppProtocolVisualizePacketSizeByHashResource(ModelResource):
#     class Meta:
#         queryset = FlowDetails.objects.all()
#         resource_name = 'protocol_size_by_hash'
#         list_allowed_methods = ['get']
#         detail_allowed_methods = ['get']
#         limit = 0 # unlimited
#         filtering = {
#             'parent_hash_value': ALL,
#             'protocol': ALL,
#             }
#         serializer = AppProtocolPacketSizeCustomJSONSerializer()
# 
# class AppProtocolVisualizePacketCountByHashResource(ModelResource):
#     class Meta:
#         queryset = FlowDetails.objects.all()
#         resource_name = 'protocol_count_by_hash'
#         list_allowed_methods = ['get']
#         detail_allowed_methods = ['get']
#         limit = 0 # unlimited
#         filtering = {
#             'parent_hash_value': ALL,
#             'protocol': ALL,
#             }
#         serializer = AppProtocolPacketCountCustomJSONSerializer()


from django.conf.urls.defaults import *
from django.conf import settings
from tastypie.api import Api
from ovizart.api.api import AppProtocolResource, AppProtocolVisualizePacketSizeResource, \
                                AppProtocolVisualizePacketCountResource, AllProtocolsResource, \
                                AllProtocolsByHashResource, AppProtocolResourceByHash, \
                                AppProtocolVisualizePacketSizeByHashResource, \
                                AppProtocolVisualizePacketCountByHashResource
from django.contrib import admin
#app_protocol_count_resource = AppProtocolVisualizePacketCountResource()

# Uncomment the next two lines to enable the admin:
admin.autodiscover()

urlpatterns = patterns('',
    # Example:
    # (r'^{{ project_name }}/', include('{{ project_name }}.foo.urls')),
    #url(r'^$', 'ovizart.main.views.login_user', name='login_page'),
    url(r'^$', 'ovizart.main.views.main', name='main_page'),
    url(r'^login/', 'ovizart.main.views.login_user', name='login_page'),
    url(r'^logout/$', 'ovizart.main.views.logout_user', name='logout_page'),
    url(r'^about/$', 'ovizart.main.views.about', name='about_page'),
    (r'^pcap/', include('ovizart.pcap.urls')),
    (r'^main/', include('ovizart.main.urls')),
    (r'^api/', include(rest_api.urls)),


    # Uncomment the admin/doc line below to enable admin documentation:
    # (r'^admin/doc/', include('django.contrib.admindocs.urls')),

    # Uncomment the next line to enable the admin:
    (r'^admin/', include(admin.site.urls)),
)


if settings.DEBUG:
    urlpatterns += patterns('',
        (r'^site_media/(?P<path>.*)$', 'django.views.static.serve',
             {'document_root': settings.MEDIA_ROOT, 'show_indexes': True}),

# Path: ovizart/api/api.py
# class AppProtocolResource(ModelResource):
#     class Meta:
#         queryset = FlowDetails.objects.all()
#         resource_name = 'protocols'
#         list_allowed_methods = ['get']
#         detail_allowed_methods = ['get']
#         limit = 0 # unlimited
#         filtering = {
#             'user_id': ALL,
#         }
#         serializer = CustomJSONSerializer()
# 
# class AppProtocolVisualizePacketSizeResource(ModelResource):
#     class Meta:
#         queryset = FlowDetails.objects.all()
#         resource_name = 'protocol_size'
#         list_allowed_methods = ['get']
#         detail_allowed_methods = ['get']
#         limit = 0 # unlimited
#         filtering = {
#             'user_id': ALL,
#             'protocol': ALL,
#         }
#         serializer = AppProtocolPacketSizeCustomJSONSerializer()
# 
# class AppProtocolVisualizePacketCountResource(ModelResource):
#     class Meta:
#         queryset = FlowDetails.objects.all()
#         resource_name = 'protocol_count'
#         list_allowed_methods = ['get']
#         detail_allowed_methods = ['get']
#         limit = 0 # unlimited
#         filtering = {
#             'user_id': ALL,
#             'protocol': ALL,
#             }
#         serializer = AppProtocolPacketCountCustomJSONSerializer()
# 
# class AllProtocolsResource(ModelResource):
#     class Meta:
#         queryset = FlowDetails.objects.all()
#         resource_name = 'all_protocols'
#         list_allowed_methods = ['get']
#         detail_allowed_methods = ['get']
#         limit = 0 # unlimited
#         serializer = AllProtocolsJSONSerializer()
# 
# class AllProtocolsByHashResource(ModelResource):
#     class Meta:
#         queryset = FlowDetails.objects.all()
#         resource_name = 'all_protocols_by_hash'
#         list_allowed_methods = ['get']
#         detail_allowed_methods = ['get']
#         limit = 0 # unlimited
#         serializer = AllProtocolsJSONSerializer()
#         filtering = {
#             'parent_hash_value': ALL,
#             }
# 
# class AppProtocolResourceByHash(ModelResource):
#     class Meta:
#         queryset = FlowDetails.objects.all()
#         resource_name = 'protocols_by_hash'
#         list_allowed_methods = ['get']
#         detail_allowed_methods = ['get']
#         limit = 0 # unlimited
#         filtering = {
#             'parent_hash_value': ALL,
#             }
#         serializer = CustomJSONSerializer()
# 
# class AppProtocolVisualizePacketSizeByHashResource(ModelResource):
#     class Meta:
#         queryset = FlowDetails.objects.all()
#         resource_name = 'protocol_size_by_hash'
#         list_allowed_methods = ['get']
#         detail_allowed_methods = ['get']
#         limit = 0 # unlimited
#         filtering = {
#             'parent_hash_value': ALL,
#             'protocol': ALL,
#             }
#         serializer = AppProtocolPacketSizeCustomJSONSerializer()
# 
# class AppProtocolVisualizePacketCountByHashResource(ModelResource):
#     class Meta:
#         queryset = FlowDetails.objects.all()
#         resource_name = 'protocol_count_by_hash'
#         list_allowed_methods = ['get']
#         detail_allowed_methods = ['get']
#         limit = 0 # unlimited
#         filtering = {
#             'parent_hash_value': ALL,
#             'protocol': ALL,
#             }
#         serializer = AppProtocolPacketCountCustomJSONSerializer()


# Path: ovizart/urls.py
from django.conf.urls.defaults import *
from django.conf import settings
from tastypie.api import Api
from ovizart.api.api import AppProtocolResource, AppProtocolVisualizePacketSizeResource, \
                                AppProtocolVisualizePacketCountResource, AllProtocolsResource, \
                                AllProtocolsByHashResource, AppProtocolResourceByHash, \
                                AppProtocolVisualizePacketSizeByHashResource, \
                                AppProtocolVisualizePacketCountByHashResource
from django.contrib import admin

#app_protocol_count_resource = AppProtocolVisualizePacketCountResource()

# Uncomment the next two lines to enable the admin:
admin.autodiscover()

urlpatterns = patterns('',
    # Example:
    # (r'^{{ project_name }}/', include('{{ project_name }}.foo.urls')),
    #url(r'^$', 'ovizart.main.views.login_user', name='login_page'),
    url(r'^$', 'ovizart.main.views.main', name='main_page'),
    url(r'^login/', 'ovizart.main.views.login_user', name='login_page'),
    url(r'^logout/$', 'ovizart.main.views.logout_user', name='logout_page'),
    url(r'^about/$', 'ovizart.main.views.about', name='about_page'),
    (r'^pcap/', include('ovizart.pcap.urls')),
    (r'^main/', include('ovizart.main.urls')),
    (r'^api/', include(rest_api.urls)),


    # Uncomment the admin/doc line below to enable admin documentation:
    # (r'^admin/doc/', include('django.contrib.admindocs.urls')),

    # Uncomment the next line to enable the admin:
    (r'^admin/', include(admin.site.urls)),
)


if settings.DEBUG:
    urlpatterns += patterns('',
        (r'^site_media/(?P<path>.*)$', 'django.views.static.serve',
             {'document_root': settings.MEDIA_ROOT, 'show_indexes': True}),

        (r'^json_media/(?P<path>.*)$', 'django.views.static.serve',