Ho un modelloUtilizzando height_field e width_field attribuire in ImageField di Django
class Anh_chi_tiet(models.Model):
du_an = models.ForeignKey(Du_an)
title = models.CharField(max_length=120)
url = models.ImageField(upload_to='images', height_field='50', width_field='100')
url_detail = models.ImageField(upload_to='images', height_field='200', width_field='400')
ricevo sempre questo errore:
'Anh_chi_tiet' object has no attribute '100'
Sembra Django richiede entrambi i campi nella stessa tabella Anh_chi_tiet per salvare height_field e width_field.
Come posso impostare direttamente questi valori senza aggiungere nuovi campi nella tabella?
Ci sono un modo per impostare height_field e width_field direttamente senza creare url_height e campi url_width? – ronin1184