I am just simply trying to display all existing objects in a form

MODEL:
class Product(models.Model):
    name = models.CharField(max_length=30)

    def __unicode__(self):
        return self.name

VIEW
def product(request):
    product = Product.objects.all()
    form = ProductForm(instance=product)
    return render_to_response('index.html', {'form' : form})


Throws this error:
=============

Environment:

Request Method: GET
Request URL: http://localhost:8000/product/
Django Version: 1.0.1 final
Python Version: 2.5.2
Installed Applications:
['django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.sites',
 'demo.home']
Installed Middleware:
('django.middleware.common.CommonMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware')


Traceback:
File "C:\Python25\lib\site-packages\django\core\handlers\base.py" in
get_response
  86.                 response = callback(request, *callback_args,
**callback_kwargs)
File "C:\Django\demo\..\demo\home\views.py" in product
  10.     form = ProductForm(instance=product)
File "C:\Python25\Lib\site-packages\django\forms\models.py" in
__init__
  216.             object_data = model_to_dict(instance, opts.fields,
opts.exclude)
File "C:\Python25\Lib\site-packages\django\forms\models.py" in
model_to_dict
  119.     opts = instance._meta

Exception Type: AttributeError at /product/
Exception Value: 'QuerySet' object has no attribute '_meta'




Any suggestions?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to