I have these tables:

class Defect(models.Model):
    name = models.CharField(max_length=100)

class Klarf(models.Model):
    dr4i = models.ForeignKey(DR4i, db_index=True)
    defect = models.ForeignKey(Defect)
    xrel = models.FloatField(null=True)
    yrel = models.FloatField(null=True)

I have a dr4i_id and I want to select the Klarf rows for that, in
order by the defect name. I am doing this:

karlfs = Klarf.objects.filter(dr4i_id=dr4i.id).order_by(defect__name)

But I'm getting NameError: "global name 'defect__name' is not defined"

I've tried this 20 different ways, but none work. I'm sure this is
just case of not enough coffee.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to