﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
9545	FileField: height_field and width_field are not working	julian24	nobody	"With this model `height_field` and `width_field` aren't working:

{{{
#!python
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:

{{{
#!python
	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()
}}}"		closed	File uploads/storage	1.0		worksforme			Accepted	0	0	0	0	0	0
