On 31-7-2012 14:36, Joris wrote: > class SlowModel(models.Model): > rid_fastmodel = models.IntegerField(primary_key=True) > calcfield1 = models.TextField(blank=True) > calcfield2= models.TextField(blank=True) > > SQLstatement = "SELECT rid_fastmodel, calcfield1, calcfield2 from (SELECT > ....) JOIN (...) JOIN (...) WHERE some_condition = %s" > > Is this better?
Yep, dive into PostgreSQL views [1]. It should be possible to create a view that yields the same fields as your SlowModel class and you can use a OneToOneField in the SlowModel corresponding the view's rid_fastmodel. syncdb becomes your enemy, but it is the cleanest solution. [1] http://www.postgresql.org/docs/9.1/static/sql-createview.html, http://www.postgresql.org/docs/9.1/static/tutorial-views.html -- Melvyn Sopacua -- 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.