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 14695 Field's `name` kwarg gets paved over erikrose nobody "`Field.set_attributes_from_name` should [source:/django/trunk/django/db/models/fields/__init__.py?rev=14069#L229 set self.name = name] only if `self.name` is `None`. As things stand, any `name=whatever` kwarg we pass to a field on construction is obliterated by `set_attributes_from_name`. This means things like… {{{ _category = models.IntegerField(db_column='category', name='category') }}} …end up with a `get__category_display` method (note the 2 underscores in a row) rather than a `get_category_display`. I've attached a quick but functional patch that fixes this; the tests (in 1.2.3, anyway) still all pass. One possible improvement might be to use `get_attname` rather than saying `self.name` directly, but (1) I'm not sure what the layering intentions are in there and (2) it blew up in a hairly-looking way when I tried—so I wouldn't mind some clueful feedback about that. FWIW, my use case is replacing my model's `category` attr with a descriptor so I can do some custom stuff on get. #3148 would make this unnecessary for me, but I could see that taking awhile to land." Bug closed Database layer (models, ORM) 1.2 Normal fixed dceu2011 Ready for checkin 1 0 0 0 0 0