title: ModelForm has no model class specified
body: <p>please help to solve the problem .</p>
  
  <p>I tried to create a user profile page , which a user reaches after registration and login. after loading the address / userprofile / loaded view user_profile (request).</p>
  
  <p>Startup page displays the following error message :</p>
  
  <pre><code>Request Method: GET
  Request URL: http://127.0.0.1:8000/userprofile/
  Django Version: 1.6.2
  Exception Type: ValueError
  Exception Value:
  ModelForm has no model class specified.
  Exception Location: C: \ Python33 \ lib \ site-packages \ django \ forms \ models.py in __ init__, line 308
  </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)
  likes_cheese = models.BooleanField (default = True)
  favorite_hamster_name = models.CharField (max_length = 50)
  
  
  User.profile = property (lambda u: UserProfile.objects.get_or_create (user = u) [ 0])
  </code></pre>
  
  <p>forms.py:</p>
  
  <pre><code>from django import forms
  from userprofile.models import UserProfile
  
  
  class UserProfileForm (forms.ModelForm):
  
  class Meta:
  user = UserProfile
  fields = ('likes_cheese', 'favorite_hamster_name')
  </code></pre>
  
  <p>views.py:</p>
  
  <pre><code>from django.shortcuts import render_to_response
  from django.http import HttpResponse, HttpResponseRedirect, Http404
  from django.template import loader, RequestContext
  # from django.core.context_processors import csrf
  from userprofile.forms import UserProfileForm
  from django.contrib.auth.decorators import login_required
  
  
  @ login_required
  def user_profile (request):
  if request.method == 'POST':
  form = UserProfileForm (request.POST, instance = request.user.profile)
  if form.is_valid ():
  form.save ()
  return HttpResponseRedirect ('/ accounts / loggedin /')
  else:
  user = request.user
  profile = user.profile
  form = UserProfileForm (instance = profile)
  
  args = {}
  # args.update (csrf (request))
  args ['form'] = form
  
  return render_to_response ('profile.html', args)
  </code></pre>
  
  <p>when you create a user profile page , I used the following <a href="http://www.youtube.com/watch?v=qLRxkStiaUg" rel="nofollow">tutorials</a></p>