Re: Compare the fields of the same model

2009-01-22 Thread Costin Stroie
raise AttributeError, "%s: %s" % (e, "model: %s, field: %s" % model1, field1) model2 = model2._meta.db_table # Create the WHERE clause self.where = "%s.%s %s %s.%s" % (model1, field1, op, model2, field2) def get_sql(sel

Re: Compare the fields of the same model

2009-01-21 Thread Costin Stroie
won't. Your example works, but it is not what I need. I need a queryset method, much like .filter(), to return a queryset, applying that condition. -- Costin Stroie --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Gr

Compare the fields of the same model

2009-01-19 Thread Costin Stroie
Hi! I have the following model: class MyModel(models.Model): maxwidth = models.IntegerField(Maximum width', default = '0') width = models.IntegerField('Width', default = '0') I need to perform a query similar to this: SELECT * FROM mymodel WHERE width > maxwidth; The result should be