django attribute error : object has no attribute 'get_bound_field'
<p>Apparently a form being loaded on my template is requiring a field that isn't being passed to it. </p>

<p>Can anyone tell me what is causing this error?</p>

<p>Error occurs during template rendering</p>

<pre><code>In template C:\django\projectname\static\templates\link_list.html, error at line 114
'UserProfile' object has no attribute 'get_bound_field'
104     
105           &lt;/p&gt;
106     
107         &lt;/form&gt;
108           &lt;/div&gt;
109           &lt;div id="make-offer" style="display: none"&gt;
110     
111           &lt;p&gt;Make an offer&lt;/p&gt;
112           &lt;form class=".formLayout" name="offer-form" action="" method="post" enctype="multipart/form-data"&gt;
113           {% csrf_token %}
114           {{ form.as_table }}
115           &lt;input type="submit" class="data" style="font-family: VT323; font-size: 50%" value="Submit" /&gt;
116           &lt;/form&gt;
117           &lt;/div&gt;     
118           &lt;/div&gt;
119         &lt;/div&gt;
120       &lt;/div&gt;
</code></pre>

<p>This is served by the following view:</p>

<pre><code>def link(request):
    print("trying to authenticate...")
    if request.user.is_authenticated():
        user_profile = UserProfile.objects.get(user=request.user)

    else:
        return render(request, 'login.html')

    if request.method == "POST":
        print("request was a post.")
        if request.is_ajax():
            ...
        else:        

            if request.method == "POST":    
                form = OfferForm(request.POST, request.FILES, maker_id=user_profile.id)
                if form.is_valid():
                    if request.POST.get('location'):                        
                        offer = form.save()
                        offer.save()
                    offer.maker = maker
                    offer.save()

                else:
                    print form.errors

            return render(request, "link_list.html", {'form' : form} )

    else:

        form = OfferForm(maker_id=user_profile.id)
        print("request wasn't ajax.")
        data = {'form': form}
        return render(request, 'link_list.html', data)
</code></pre>

<p>Here are the relevant models and forms: </p>

<pre><code>class OfferForm(forms.ModelForm):        

    def __init__(self, *args, **kwargs):
        maker_id = kwargs.pop('maker_id')
        super(OfferForm, self).__init__(*args, **kwargs)
        maker = UserProfile.objects.get(id=maker_id)
        self.fields['maker'] = maker


    class Meta:
        model = Offer
        fields = [
            "name", 
            "value",
            "description",
            "tags",
            "location",
            "service",
            "icon",
        ]
        widgets = {
            'name': forms.TextInput(
                attrs={'id': 'name', 'class': '.formLayout', 'style': 'font-family: VT323; font-size: 60%', 'required': True, 'placeholder': 'name'}
            ),
            'value': forms.TextInput(
                attrs={'id': 'value', 'class': '.formLayout', 'style': 'font-family: VT323; font-size: 60%', 'required': True, 'placeholder': 'value'}
            ),
            'description': forms.TextInput(
                attrs={'id': 'description', 'class': '.formLayout', 'style': 'font-family: VT323; font-size: 60%', 'required': True, 'placeholder': 'description'}
            ),
            'tags': forms.TextInput(
                attrs={'id': 'tags', 'class': '.formLayout', 'style': 'font-family: VT323; font-size: 60%', 'required': True, 'placeholder': 'tags'}
            ),   
            'location': forms.TextInput(
                attrs={'id': 'location', 'class': 'geo', 'data-geo': 'location', 'required': False, 'placeholder': 'leave blank to use your location'}
            ),
            'service': forms.CheckboxInput(
                attrs={'id': 'service', 'class': '.formLayout', 'required': False}
            ),
}
</code></pre>

<p>models.py</p>

<pre><code>class UserProfile(models.Model):

    user = models.OneToOneField(User)    
    website = models.URLField(blank=True, null=True)
    location = models.CharField(max_length=200, null=True)
    longitude = models.FloatField(null=True)
    latitude = models.FloatField(null=True)
    credit = models.FloatField(default=0, null=True)
    picture = models.ImageField(upload_to=upload_location, blank=True)

    def __unicode__(self):
        return self.user.username

class Offer(models.Model):

    name = models.CharField(max_length=120)
    description = models.CharField(max_length=120)
    value = models.FloatField(default=0.0) 
    tags = models.CharField(max_length=120, null=True)
    maker = models.ForeignKey(UserProfile, null=True)


    def __unicode__(self):
        return self.name   
</code></pre>

<p>In your form you're getting a UserProfile object and then assigning it as a field. But it's not a field, it's a model object.</p>

<p>I don't know what you're trying to do there, but don't assign that object to the fields dict.</p>

python django models