This is probably really sinple, but I'm pretty new to Sjango, and I can't seem to figure it out.
I've used Django before, and came back to it once I saw the recent commit that added ability to override admin formfields, which looks to be exactly what I need. I have a Product model and an AffiliateProduct model with a foreign key to product. I'm trying to get the admin to only display the AffiliateProduct's currently selected Product in the foreignkey field (ideally also showing no options if it's blank). I'm using basically the same code from the example in the admin docs: class AffiliateProductAdmin(admin.ModelAdmin): def formfield_for_foreignkey(self, db_field, request, **kwargs): if db_field.name == "product": kwargs["queryset"] = Product.object.filter(pk=?????????) return db_field.formfield(**kwargs) return super(AffiliateProductAdmin, self).formfield_for_foreignkey(db_field, request, **kwargs) Basically, I need to fill in the ?????. I'm not familiar enough with the innards of Django to even guess where to begin. --~--~---------~--~----~------------~-------~--~----~ 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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---