Django form fields not showing up
<p>I am new to django and trying to show a form in an html file and I don't see the fields when I get to this particular page on my browser. Anybody has an idea why?</p>

<p>Here is the html file : In which I can see everything but the form showing up
add_device.html </p>

<pre><code>{% extends 'layout/layout1.html' %}
{% block content %}
    &lt;form action = "userprofile/" method = "post"&gt;
        {% csrf_token %}
        {{ form }}
        &lt;input type = "submit" value = "Submit"/&gt;
    &lt;/form&gt;
{% endblock %}
</code></pre>

<p>forms.py</p>

<pre><code>from django import forms
from models import UserProfile

class UserProfileForm(forms.ModelForm):
    class Meta:
        model = UserProfile
        fields = ('deviceNb',)
</code></pre>

<p>models.py</p>

<pre><code>from django.db import models
from django.contrib.auth.models import User


class UserProfile(models.Model):
    user = models.OneToOneField(User)
    deviceNb = models.CharField(max_length = 100)

User.profile = property(lambda u : UserProfile.objects.get_or_create(user = u)[0])
</code></pre>

<p>views.py</p>

<pre><code>def user_profile(request):
    if request.method == 'POST':
        #we want to populate the form with the original instance of the profile model and insert POST info on top of it
        form = UserProfileForm(request.POST, instance=request.user.profile)

        if form.is_valid:
            form.save()
            #to go back to check that the info has changed
            return HttpResponseRedirect('/accounts/loggedin')

        else:
            #this is the preferred way to get a users info, it is stored that way
            user = request.user
            profile = user.profile
            #if we have a user that has already selected info, it will pass in this info
            form = UserProfileForm(instance=profile)

        args = {}
        args.update(csrf(request))
        args['form'] = form

        print(form)

        return render_to_response('profile.html',args)
</code></pre>

<p>I am pretty sure my url file is ok, since I get to the right urls, my problem is really the form fields not showing up. </p>

<p>Thank you so much!! </p>