This is a very strange mistake. I get it only on my server to the hero.
This is how my model is:
# Abstract Model class CommonInfo(models.Model): active = models.BooleanField('Enabled?', default=False) date_created = models.DateTimeField(auto_now_add=True) date_updated = models.DateTimeField(auto_now=True) class Meta: abstract = True class Country(CommonInfo): name = models.CharField('Country Name', db_index=True, max_length=200, help_text='eg France') official_name = models.CharField('Official Name', max_length=400, blank=True, help_text='eg French Republic') population = models.IntegerField('Population', help_text='Population must be entered as numbers with no commas or separators, eg 39456123', null=True, blank=True) alpha2 = models.CharField('ISO ALPHA-2 Code', max_length=2, blank=True) class News(CommonInfo): title = models.CharField('Title', max_length=250) slug = models.CharField('slug', max_length=255, unique=True) body = models.TextField('Body', null=True, blank=True) excerpt = models.TextField('Excerpt', null=True, blank=True) author = models.ForeignKey(Author) country = models.ManyToManyField(Country, null=True, blank=True) def __unicode__(self): return self.title
When I try to access news items from the Admin site on my production server, I get this error (everything works fine on my dev server):
FieldError: Cannot resolve keyword 'news' into field. Choices are: active, alpha2, date_created, date_updated, id, name, official_name, population File "/app/.heroku/python/lib/python2.7/site-packages/django/db/models/query.py", line 687, in _filter_or_exclude clone.query.add_q(Q(*args, **kwargs)) File "/app/.heroku/python/lib/python2.7/site-packages/django/db/models/sql/query.py", line 1271, in add_q can_reuse=used_aliases, force_having=force_having) File "/app/.heroku/python/lib/python2.7/site-packages/django/db/models/sql/query.py", line 1139, in add_filter process_extras=process_extras) File "/app/.heroku/python/lib/python2.7/site-packages/django/db/models/sql/query.py", line 1337, in setup_joins "Choices are: %s" % (name, ", ".join(names)))
I am running the same versions of django (1.5.4) and python (2.7.2) in my development and development environment.
My Heroku Server
Any ideas that might cause a bug?
UPDATE
The admin.py configuration is as follows:
from django.contrib import admin from APP.models import Country, News class NewsForm(ModelForm): class Meta: model = News class NewsAdmin(ModelAdmin): form = NewsForm search_fields = ['title', 'country__name'] list_filter = ('country', 'active' ) list_per_page = 30 list_editable = ('active', ) list_display = ('title', 'active' ) list_select_related = True prepopulated_fields = {"slug": ("title",)} admin.site.register(Country) admin.site.register(News, NewsAdmin)