Hello,
I have the following model:
class ModelVersion(models.Model):
model_version_id = models.AutoField(primary_key=True)
major_version = models.IntegerField(null=True, blank=True)
minor_version = models.IntegerField(null=True, blank=True)
class Meta:
db_table = u'model_version'
def __unicode__(self):
return str(self.major_version) + '.' + str(self.minor_version)
class DataPackage(models.Model):
data_package_id = models.AutoField(primary_key=True)
physical_name = models.CharField(max_length=255)
model_version = models.ForeignKey(ModelVersion)
class Meta:
db_table = u'data_package'
def __unicode__(self):
return self.physical_name
class RelationalDatabase(DataPackage):
data_package = models.OneToOneField(DataPackage, parent_link=True)
database_instance_name = models.CharField(max_length=255)
class Meta:
db_table = u'relational_database'
def __unicode__(self):
return self.physical_name + '(' + self.database_instance_name + ')'
So, RelationalDatabase is derived from DataPackage implemented with a
OneToOneField, thus also has a model_version property.
Now, in admin.py, when I have the following:
class RelationalDatabaseAdmin(admin.ModelAdmin):
list_display =
('data_package_id','physical_name','database_instance_name','model_version')
list_filter = ['model_version']
search_fields = ['database_instance_name']
admin.site.register(RelationalDatabase, RelationalDatabaseAdmin);
then model_version gets displayed in the list, but although list_filter
is present, a filter box isn't available in the admin area.
Is this supposed to work?
Thanks,
Thomas
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---