Code

Opened 8 years ago

Closed 7 years ago

#2844 closed defect (wontfix)

[patch] make various field types pass member_name

Reported by: Maximillian Dornseif <md@…> Owned by: nobody
Component: Core (Other) Version: master
Severity: minor Keywords:
Cc: md@… Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

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.

Attachments (0)

Change History (2)

comment:1 Changed 7 years ago by jaywgraves@…

This bit me also. I know 'oldforms' is going away soon, so I just changed my model to use an IntegerField as explained above.

comment:2 Changed 7 years ago by SmileyChris

  • Resolution set to wontfix
  • Status changed from new to closed

Closing because this is oldforms. If someone really wants it, provide a patch and reopen

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.