I was using the django_ajax library for ajax lookup in one of the form elements.
The model:
class Alpha(models.Model):
name = models.CharField()
description = models.TextField()
submitted = models.BooleanField(default=False)
The form
class MyForm(forms.Form):
alpha = AutoCompleteSelectField('alpha')
def __init__(self, loser, *args, **kwargs):
super(MyForm, self).__init__(*args, **kwargs)
self.loser = loser
self.fields['alpha'].widget.attrs['class'] = 'big-text-box'
The problem with the current implementation is it shows me all the alpha
entries, but in the lookup field i want only those alphas
whose submitted
is false
.
How do I write a selector?