# Path: hooks/models.py
# class person(models.Model):
# class product(models.Model):
# class place(models.Model):
# class hook(models.Model):
#     def __str__(self):
#     def __str__(self):
#     def __str__(self):
#     def __str__(self):
#     def hook_product_id(self):
#     def hook_person_id(self):
#     def hook_place_id(self):


from django.contrib import admin
from .models import hook,product,place,person,User
    list_display = ('hook_id', 'hook_desc')
    search_fields = ['hook_id','hook_desc']
    
    
    def formfield_for_foreignkey(self, db_field, request, **kwargs):
        #this function restricts choice of foreign key to those belonging to user/account
        if db_field.name == "place":
            kwargs["queryset"] = place.objects.filter(account=request.user)
        
        
        return super(hookAdmin, self).formfield_for_foreignkey(db_field, request, **kwargs)

    
    
    pass   # (replace this with anything else you need)    

class productAdmin(FilterUserAdmin):
    pass

class placeAdmin(FilterUserAdmin):
    pass

class personAdmin(FilterUserAdmin):
    pass




admin.site.register(hook,hookAdmin)
admin.site.register(product,productAdmin)

# Path: hooks/models.py
# class person(models.Model):
# class product(models.Model):
# class place(models.Model):
# class hook(models.Model):
#     def __str__(self):
#     def __str__(self):
#     def __str__(self):
#     def __str__(self):
#     def hook_product_id(self):
#     def hook_person_id(self):
#     def hook_place_id(self):


# Path: hooks/admin.py
from django.contrib import admin
from .models import hook,product,place,person,User

    list_display = ('hook_id', 'hook_desc')
    search_fields = ['hook_id','hook_desc']
    
    
    def formfield_for_foreignkey(self, db_field, request, **kwargs):
        #this function restricts choice of foreign key to those belonging to user/account
        if db_field.name == "place":
            kwargs["queryset"] = place.objects.filter(account=request.user)
        
        
        return super(hookAdmin, self).formfield_for_foreignkey(db_field, request, **kwargs)

    
    
    pass   # (replace this with anything else you need)    

class productAdmin(FilterUserAdmin):
    pass

class placeAdmin(FilterUserAdmin):
    pass

class personAdmin(FilterUserAdmin):
    pass




admin.site.register(hook,hookAdmin)
admin.site.register(product,productAdmin)

admin.site.register(place,placeAdmin)