Hi boys, hi girls,
I would like to ask you if there is a way how can I retrieve model's
data except few attributes.
I have a model
class Example(models.Model):
        lookup1 = models.ForeignKey(Lookup1)
        lookup2 = models.ForeignKey(Lookup2)
        lookup3 = models.ForeignKey(Lookup3)
        field1 = models.CharField(maxlength=64)
        field2 = models.CharField(maxlength=64)
...
        field29 = models.CharField(maxlength=64)
        field30 = models.CharField(maxlength=64)

How can I retrieve this model without loading for example field1
attribute and lookup1 attribute. Why I'm asking - I want to avoid
unnecessary DB queries. If the model has five ForeignKeys then five
additional queries are executed to load those lookup tables. At least
when using newforms.

In my case that's not what I need and I would like to exclude these
attributes. BTW can I exclude some attributes (not rows) from
Model.objects.get() or filter() or other methods?

What I want to do is a form with some model's attributes but I don't
want to load all the unnecessary data. And I would like to choose
which attributes will be loaded. And saved.

Thanks for your hints / clues.
Michal


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