def get_context_data(self, **kwargs):
        context = super().get_context_data(**kwargs)
        context['building'] = self.get_object()
        context['active_units'] = True
        context['can_create_unit'] = BuildingPermissions.can_create_unit(
            user=self.request.user,
            building=self.get_object(),
        )

        context[
            'can_view_unit_detail'] = BuildingPermissions.can_view_unit_detail(
                user=self.request.user,
                building=self.get_object(),
            )

        context[
            'can_view_update_menu'] = BuildingPermissions.can_edit_building(
                user=self.request.user,
                building=self.get_object(),
            )

        context['can_edit_unit'] = BuildingPermissions.can_edit_unit(
            user=self.request.user,
            building=self.get_object(),
        )

        return context
 def test_func(self):
     return BuildingPermissions.can_view_unit_detail(
         user=self.request.user,
         building=self.get_object().building,
     )