So, I have two models and one holds a foreign key reference to the other:
Model1:
blah = models.ForeignKey(Model2)
I also have the following admins for Model2:
model2admin(models.ModelAdmin)
inline = [model1inline]
model1admin(admin.TabularLine):
def queryset(self, request):
qs = super(model2admin, self).queryset(request)
return qs.filter(...)
I’m trying to filter the queryset in the model1admin for instances of model2 (It makes sense to me because when you click on one of the items on the admin page, it would be a single model instance). So how would I do that? In the documentation, I only see some functions in which you can have obj as an argument but I think those are only “callable” for display.
nevermind, apparently when you have an inline model admin, the queryset for those models are automatically cut down to only the ones that match the other model (don’t see this documented but i do just usually skim and ctrl f everything)