[patch] make various field types pass member_name
|Reported by:||Maximillian Dornseif <md@…>||Owned by:||nobody|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
I was having two Model like this:
class FedasCategory(models.Model): id = models.PositiveIntegerField(primary_key=True) [...] class Product(models.Model): [...] fedas = models.ForeignKey('FedasCategory', raw_id_admin=True, null=True, blank=True, help_text='FEDAS Warenklassifikation.')
This thre an exception in admin unless I removed "raw_id_admin=True" or changed PositiveIntegerField to IntegerField. Some investigation showed that forms/__init__.py some field types thake an parameter member_name and some don't. I'm nut sure about the rationale behind this but I suspect it is an error. Changing the *Integer fields and make them pass member_name to their superclass solved my problems. Get a patch at http://c0re.23.nu/c0de/misc/django-3881-field_member_name.diff
I'm not really sure about the member_name thing and I'm not really sure I'm fixing the right thing but I suspecct other fields like FloatField, LargeTextField and EmailField should also accept the member_name parameter in their constructor.