class FK(models.ForeignKey):
def __init__(self, to, to_field=None, **kwargs):
models.ForeignKey.__init__(self, to, to_field=None, **kwargs)
def get_choices(self, include_blank=True):
c = Category.objects.filter(id__gt=2)
returnList = []
for cc in c:
returnList.append([cc.id, cc.cat_name])
return returnList
class Category(models.Model):
cat_name = models.CharField(maxlength=255, verbose_name=_("Category Name"))
cat_order = models.PositiveSmallIntegerField(default=0, verbose_name=_("Order"))
cat_foo = FK('self', verbose_name=_("test"), blank=True, null=True)