I've got a Form which I'm using the following field in.
contact_country = forms.ModelChoiceField(queryset=Country.objects.all())
The Country model looks like this
class Country(models.Model):
iso = models.CharField(max_length=2)
name = models.CharField(max_length=80)
printable_name = models.CharField(max_length=80)
iso3 = models.CharField(max_length=3,null=True, blank=True)
numcode = models.IntegerField(null=True, blank=True)
special = models.BooleanField(default=False)
def __unicode__(self):
return self.printable_name
class Meta:
ordering = [ 'printable_name' ]
The 'special' field indicates that the country is "special". If the country is "special" I want it to appear before the rest of the listing - as I'm sure you've seen elsewhere on the wed.
e.g. I want English speaking countries like Australia, United Kingdom and United States at the top of the select but also want them to appear again with the rest of the countries.
Is that possible with QuerySet? Or should I be looking elsewhere?