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 wrote:
> Right, I created my Genric Category model using :
>
> -
> from django.db import models
> from django.co
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
Yep,
I'm a bginner with Django, but translating it into CakePHP (based on
Rails) I would like to define a kind of relation where, given the:
- Foreign key of let's say the News.id
- the Foreign_model_name (i.e News)
I get the News.category of a specific item
While just retriving the News Categ
if i follow your question - you'd want a ForeignKey in CategoryItem to
your Category model, so you can add both your News object and Product
object to the same category through CategoryItem. then you'll be able
to iterate through all of the items in a categoroy with something like
`mycategory.cat
hi dan -
a little further down on the contenttypes doc page you link to there
is documentation on the generic foreign key mechanism bundled with the
contenttypes app:
http://docs.djangoproject.com/en/dev/ref/contrib/contenttypes/#id1
pretty similar to what you describe ;)
On Wed, Feb 11, 2009 a
Cheers Jake,
given the code:
--
from django.db import models
from django.contrib.contenttypes.models import ContentType
from django.contrib.contenttypes import generic
class CategoryItem(models.Model):
name = models.CharField(max_length=200)
content_type = models.ForeignKey(C
Hey guys,
I was wondering how to create a let's call it "GenericCategory" model.
Given that News, Products, etc, often belongs to a Category, why have
tons of tables (news_categories, products_categories) etc
The "GenericCategory" model table structure should be like:
- id
- foreign_model_name
7 matches
Mail list logo