# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.contrib import admin


# Register your models here.
from .models import *
from django.utils.translation import ugettext_lazy as _

class ProductPropAdmin(admin.ModelAdmin):
    list_display=('value','categoryprop','company')
    list_filter=('categoryprop',)
    search_fields=('value',)
admin.site.register(ProductProp,ProductPropAdmin)


class ProInline(admin.TabularInline):
    model = PrdProps
    #def formfield_for_foreignkey(self, db_field, request, **kwargs):
    #    if db_field.name == "car":
    #        kwargs["queryset"] = Car.objects.filter(owner=request.user)
    #    return super(MyModelAdmin, self).formfield_for_foreignkey(db_field, request, **kwargs)

class ProductAdmin(admin.ModelAdmin):
    list_display=('name','company','remark',)
    list_filter=('company',)
    search_fields=('name',)
    inlines = [
        ProInline,
    ]

    



admin.site.register(Product,ProductAdmin)


