J'ai actuellement :
class Sheet_Price(models.Model):
auteur = models.CharField(max_length=15)
date = models.DateField(max_length=15, blank=True, null=True)
current = models.BooleanField(max_length=15)
archive_date = models.DateField(max_length=15, blank=True, null=True)
def __int__(self):
return self.id
class Element(models.Model):
name = models.CharField(max_length=15)
reference = models.CharField(max_length=15)
front_price = models.FloatField(max_length=200)
recurrent_price = models.FloatField(max_length=10)
id_sheet_price = models.ForeignKey(Sheet_Price, on_delete=models.CASCADE)
Dans la page d'administration je récupère les informations de ces classes
class Sheet_Price_Admin(admin.ModelAdmin):
list_display = ('auteur','date','current', 'archive_date')
ordering = ('date', 'current',)
class Element_Admin(admin.ModelAdmin):
list_display = ('name','reference','front_price', 'recurrent_price','id_sheet_price')
ordering = ('id_sheet_price', 'id', )
A l'affichage (dans la page d'administration) je récupère toutes les informations mais le champs 'id_sheet_price
'Sheet_Price object'
. Comment puis-je afficher l'id à la place ?