#9545 closed (worksforme)
FileField: height_field and width_field are not working
| Reported by: | julian24 | Owned by: | nobody | 
|---|---|---|---|
| Component: | File uploads/storage | Version: | 1.0 | 
| Severity: | Keywords: | ||
| Cc: | Triage Stage: | Accepted | |
| Has patch: | no | Needs documentation: | no | 
| Needs tests: | no | Patch needs improvement: | no | 
| Easy pickings: | no | UI/UX: | no | 
Description
With this model height_field and width_field aren't working:
class Wallpaper(models.Model): title = models.CharField(_('Title'), max_length=80) wallpaper = models.ImageField(_('Wallpaper'), upload_to = 'wallpapers/', height_field = 'wallpaper_height', width_field = 'wallpaper_width') wallpaper_height = models.IntegerField(_('Wallpaper height'), blank=True, null=True) wallpaper_width = models.IntegerField(_('Wallpaper width'), blank=True, null=True) def __unicode__(self): return unicode(self.title)
But if I add the following save method, it works fine:
def save(self): if self.wallpaper.field.width_field: setattr(self.wallpaper.instance, self.wallpaper.field.width_field, self.wallpaper.width) if self.wallpaper.field.height_field: setattr(self.wallpaper.instance, self.wallpaper.field.height_field, self.wallpaper.height) super(Wallpaper, self).save()
Change History (5)
comment:1 by , 17 years ago
comment:3 by , 17 years ago
| milestone: | → 1.1 | 
|---|---|
| Triage Stage: | Unreviewed → Accepted | 
comment:4 by , 17 years ago
| Resolution: | → worksforme | 
|---|---|
| Status: | new → closed | 
There are now several tests for this, I'm going to mark as worksforme, if you can show case where it doesn't work please reopen with a testcase.
  Note:
 See   TracTickets
 for help on using tickets.
    
What does "aren't working" mean? Is this possibly the same as #8208?