def queryset(self, request): if in_competition_admin(request): # Get candidates for active competition qs = Candidate.objects.filter(competition=self.admin_site.get_active_competition(request)) return wrap_queryset(self,qs) else: return super(CandidateAdmin,self).queryset(request)
def save_model(self, request, obj, form, change): if in_competition_admin(request): obj.competition = self.admin_site.get_active_competition(request) # Call base class super(JuryMemberAdmin,self).save_model(request,obj,form,change)