Django admin raw_id_field not working as expected

django, python

Solution

As suggested by Timmy O'Mahony

admin.site.register(CompanyMaster)

Did the trick

Problem

I am new to django and trying out djangoAdmin and i am stuck at one problem. i am using raw_id_field for a column and i am not getting the magnifying glass icon but during edit respective company name shows up next to the field. I know it has something to do with the relations. in the below code how do i say `company_master.p_company_id HAS_ONE company_images.p_company_id` Model.py ``` from django.db import models class CompanyMaster(models.Model): p_company_id = models.IntegerField(primary_key= True) company_name = models.CharField(max_length=200) class Meta: db_table = "company_master" class CompanyImage(models.Model): name = models.CharField(max_length=200) p_company = models.ForeignKey(CompanyMaster) class Meta: db_table = "company_images" ``` Admin.py ``` class CompanyImageAdmin(admin.ModelAdmin): search_fields = ['name'] raw_id_fields = ("p_company",) admin.site.register(CompanyImage, CompanyImageAdmin) ```

Original source