I solved it. Problem was this:

category_id = models.ForeignKey(Category)

which creates category_id_id in mysql table.

In the model, remove _id and it should of been:
 category = models.ForeignKey(Category)

Thank you.

On Jan 28, 2:04 pm, "johnny" <[EMAIL PROTECTED]> wrote:
> I want the category to show up in drop down list, in product app with
> product_form.html template.
> In my product_form.html, I have the following:
> <p>
>     <label for="id_category">Category:</label> {{ form.category }}
>     {% if form.category.errors %}*** {{ form.category.errors|join:",
> " }}{% endif %}
> </p>
>
> In my model for product, I specify Category as ForeignKey.
> For some reason product_form.html template is not providing the
> dropdown list.  In admin,
> I get a drop down list.  Any help is appreciated.
>
> class Category(models.Model):
>     id = models.AutoField(primary_key=True)
>     parent_id = models.IntegerField()
>     name = models.CharField(maxlength=200)
>
>     class Admin:
>         pass
>
>     def __str__(self):
>         return self.name
>
> class Product(models.Model):
>     id = models.AutoField(primary_key=True)
>     category_id = models.ForeignKey(Category)
>         name = models.CharField(maxlength=200)


--~--~---------~--~----~------------~-------~--~----~
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