hi guys;
i wrote this codes. but how can i use in template

like first choose
company
   category
       product



On 12 Şubat, 19:13, danfreak <freakclimb...@gmail.com> wrote:
> Right, I created my Genric Category model using :
>
> -----------------------------------------
> from django.db import models
> from django.contrib.auth.models import User
> from django.contrib.contenttypes.models import ContentType
> from django.contrib.contenttypes import generic
> from django import forms
>
> class CategoryItem(models.Model):
>     """A tag on an item."""
>     name = models.CharField(max_length=200)
>     content_type = models.ForeignKey(ContentType)
>     object_id = models.PositiveIntegerField()
>     content_object = generic.GenericForeignKey()
>
>     def __unicode__(self):
>         return self.name
>
> -----------------------------------------
>
> And it works fine in admin.
>
> But how can I create a selectin admin that filters all categories
> associated to Product for example?
>
> -----------------------------------------
> # Create your models here.
> class Company(models.Model):
>     name = models.CharField(max_length=200)
>     users = models.ForeignKey(User)
>     def __unicode__(self):
>             return self.name
>
> class Product(models.Model):
>     name = models.CharField(max_length=200)
>     description = models.TextField()
>     users = models.ForeignKey(User)
>     company = models.ForeignKey(Company)
>     category = generic.GenericRelation(CategoryItem)
>     def __unicode__(self):
>             return self.name
> -----------------------------------------
--~--~---------~--~----~------------~-------~--~----~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to