Hi all! I have two models, Person and License.
class License(models.Model): number = models.IntegerField(max_length=10) class Person(models.Model): name = models.CharField(max_length=30) license = models.ForeignKey(License,verbose_name="Centro di costo",blank=True,null=True) class PersonAdmin(admin.ModelAdmin): list_display = ('name', 'license') ordering = ('name','license') list_filter = ('name','license') As you can see, a new person can be added with no license at all: "blank=True,null=True" options. That's what I want. In my admin panel I get the list of all the persons I have added. I wish I could filter or order this list so that I get all the persons that have no license. The point is, if I use "blank=True,null=True" I'm not allowed to have this filtering/ordering in my admin panel. (The table I get in the admin panel can't be ordered by the column "license".) If I only use the "blank=True" option, then I am allowed to order by license but no "empty" values are then allowed when adding a new person. This way, each person must have a license, which is not the case. Well, I guess I could use a not-existing license number instead of null. For example 0000000000 instead of NULL. But it seems tricky and I might need that number in the future. How can I solve this? Thanks, Fabio. -- Fabio Natali --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---