﻿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
7006	Overridden fields/widgets for ForeignKeys in ModelForms	Simon Litchfield <simon@…>	Manuel Saelices	"The docs give the impression one can easily override fields/widgets in ModelForm declarations, but for ForeignKeys that doesn't seem to work.
http://www.djangoproject.com/documentation/modelforms/#overriding-the-default-field-types

{{{
class Booking(models.Model):
    ...
    affiliate = models.ForeignKey(Affiliate, null=True, blank=True, related_name='bookings')
...
class BookingForm(forms.ModelForm):
    affiliate = forms.CharField(max_length=20, required=False, label='Affiliate Code')
    
    class Meta:
        model = Booking
        fields = ('first_name', 'last_name', 'company', 'email', 'phone', 'mobile',
                  'adults', 'children', 'affiliate', 'notes')
}}}

I need the user to be able to type the 'affiliate' key value straight in without using a dropdown, but using the above approach doesn't attempt to save the affiliate value at all, using r7409. Am I missing something or has this functionality not been catered for?"		closed	Forms	dev		invalid			Accepted	0	0	0	0	0	0
