0
나는 다음과 같은 모델이 있습니다관련 모델의 필드를 admin.py에 어떻게 표시합니까?
class Property(models.Model):
user = models.ForeignKey(User)
id = models.CharField(max_length=20, null=True)
class Property_Value(models.Model):
id = models.ForeignKey(Property)
amount = models.DecimalField(max_digits = 10, decimal_places
은 어떻게 관리 페이지의 속성을 통해 Property_Value.amount 액세스합니까?
나는 이것을 가지고 지금까지 ...
class PropertyAdmin(admin.ModelAdmin):
list_display = ('id', 'user', 'property_value')
def property_value(self, obj):
return obj.id.amount
class Meta:
model = Property
admin.site.register(Property, PropertyAdmin)