Reputation: 1487
I am using the following code. I tried everything as per docs, but can't find any way. Am I missing something. The models.py contains the following code.
from django.db import models
from datetime import datetime
from django.contrib import admin
class Category(models.Model):
category_name = models.CharField(max_length=200)
category_id = models.CharField(max_length=200)
class Meta:
app_label = 'ebay'
def __unicode__(self):
return u'%s' % (self.category_id)
class MyCategory(Category):
@staticmethod
def autocomplete_search_fields():
return ("category_name__icontains", "category_id__icontains")
class Meta:
proxy = True
class Listing(models.Model):
ebay_id = models.CharField(max_length=200,null=True)
amazon_id = models.CharField(max_length=200)
category = models.ForeignKey(MyCategory)
class Meta:
app_label = 'ebay'
def __unicode__(self):
return u'%s' % (self.ebay_id)
class ListingOptions(admin.ModelAdmin):
# define the raw_id_fields
raw_id_fields = ('category',)
# define the autocomplete_lookup_fields
autocomplete_lookup_fields = {
'fk': ['category'],
}
I am using Django version 1.8.1
Upvotes: 1
Views: 726
Reputation: 11814
At the moment, Grappelli is not yet compatible with Django 1.8. One of the issue that you encounter could be #591.
Temporary solution:
grappelli
) but with Django 1.8 mindset.django.contrib.admin
) and wait for next release of GrappelliUpvotes: 1