Ok this solution worked for me :):)
{{{
from django.db import models
from django.contrib.contenttypes.models import ContentType
from django.db.models.query import QuerySet
class SubclassingQuerySet(QuerySet):
def __getitem__(self, k):
result = super(SubclassingQuerySet, self).__getit
this is more or less what I found. I will have to see how I can
implement it on my side.
http://djangosnippets.org/snippets/1037/
--
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
Thank you, this is more or less what I am looking for. I don't however
want to make the CF class an abstract class as I want to have some
common fields in there. The Idea behind this is that I want to store
custom fields (CF) for various models that a user will be defining
themselves. I do not want
Is your CF base class an abstract base class[1]? If it's not, then your
database actually has separate tables for CF, CFI and CFT .. and when you
access a `doc.cf` you're really getting the CF model instance, *not* the
derived class instance.
IIRC if you make CF an abstract base class then this w
Just to clarify your suggestion
In [100]: isinstance(x, CFT)
Out[100]: False
In [101]: isinstance(x, CFI)
Out[101]: False
In [105]: isinstance(e, CF)
Out[105]: True
This is not what I am looking for.
I want to know to what class the CF primary key points to. So if it's
CFT or CFI
--
You rece
On 05/06/2011 03:32 PM, pbzRPA wrote:
I now the isinstance function but that will return the CF class. I
want to know the child class of CF for that specific primary key.
The isinstance function doesn't return a class. It returns a boolean,
based on the class(es) you are inquiring about.
Yo
I now the isinstance function but that will return the CF class. I
want to know the child class of CF for that specific primary key.
On May 6, 9:30 pm, Shawn Milochik wrote:
> This might work:
>
> http://docs.python.org/library/functions.html#isinstance
--
You received this message because you
This might work:
http://docs.python.org/library/functions.html#isinstance
--
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
Hi, I am not sure if this is possible but it would really help if it
is.
I have 4 classes
class CF(models.Model):
class CFT(CF):
data = models.CharField(max_length=20)
class CFI(CF):
data = models.IntegerField()
class Doc(models.Model):
name = models.CharField(max_length =
9 matches
Mail list logo