from django.contrib import admin

from services.fabric.models import *
from django import forms
from django.utils.safestring import mark_safe
from django.contrib.auth.admin import UserAdmin
from django.contrib.admin.widgets import FilteredSelectMultiple
from django.contrib.auth.forms import ReadOnlyPasswordHashField
from django.contrib.auth.signals import user_logged_in
from django.utils import timezone
from django.contrib.contenttypes import generic
from suit.widgets import LinkedSelect
from core.models import AddressPool
from core.admin import ServiceAppAdmin,SliceInline,ServiceAttrAsTabInline, ReadOnlyAwareAdmin, XOSTabularInline, ServicePrivilegeInline, TenantRootTenantInline, TenantRootPrivilegeInline
from core.middleware import get_request

from functools import update_wrapper
from django.contrib.admin.views.main import ChangeList
from django.core.urlresolvers import reverse
from django.contrib.admin.utils import quote

#TODO this class has to be redone according to vEE needs
class VEEServiceForm(forms.ModelForm):
    def __init__(self,*args,**kwargs):
        super (VEEServiceForm,self ).__init__(*args,**kwargs)

    def save(self, commit=True):
        return super(VEEServiceForm, self).save(commit=commit)

    class Meta:
        model = VEEService
        fields = '__all__'

class VEEServiceAdmin(ReadOnlyAwareAdmin):
    model = VEEService
    verbose_name = "VEE Service"
    verbose_name_plural = "VEE Services"
    list_display = ("backend_status_icon", "name", "enabled")
    list_display_links = ('backend_status_icon', 'name', )
    fieldsets = [(None, {'fields': ['backend_status_text', 'name','enabled','versionNumber', 'description', "view_url", "icon_url", "autoconfig", ],
                         'classes':['suit-tab suit-tab-general']})]
    readonly_fields = ('backend_status_text', )
    inlines = [SliceInline,ServiceAttrAsTabInline,ServicePrivilegeInline]
    form = VEEServiceForm

    extracontext_registered_admins = True

    user_readonly_fields = ["name", "enabled", "versionNumber", "description"]

    suit_form_tabs =(('general', 'VEE Service Details'),
        ('administration', 'Administration'),
        #('tools', 'Tools'),
        ('slices','Slices'),
        ('serviceattrs','Additional Attributes'),
        ('serviceprivileges','Privileges'),
    )

    suit_form_includes = (('veeadmin.html', 'top', 'administration'),
                           )

    def get_queryset(self, request):
        return VEEService.get_service_objects_by_user(request.user)

admin.site.register(VEEService, VEEServiceAdmin)
